- Implement precise column width calculation to prevent truncation of Job and Total columns
- Add responsive page margins (0.5" left/right, 0.75" top/bottom) on landscape orientation
- Scale font sizes and padding dynamically based on report width (5pt for 31+ days, 6pt for 25+ days, etc.)
- Format date headers as MM-DD instead of YYYY-MM-DD to reduce column width requirements
- Apply date formatting to both PDF export and preview dialog for consistency
- Ensure reports with full month data (like October 31 days) display all columns without cutoff
## Code Quality Improvements
### Global State Removal
- Eliminated global drag_info dictionary
- Moved drag_state management into TimeTracker class
- Removed all global drag_info dependencies
### Updated Components
- **ClickableCell constructor**: Added time_tracker parameter for proper reference
- **ClickableCell methods**: Updated to use self.time_tracker.drag_info
- **TimeTracker methods**: Updated on_global_drag() and on_global_up()
- **Instance creation**: Updated ClickableCell instantiation calls
### Benefits Achieved
- **Better Encapsulation**: State properly contained within class boundaries
- **Thread Safety**: Reduced race conditions from shared global state
- **Testability**: Individual instance testing now possible
- **Instance Isolation**: Multiple TimeTracker instances work independently
- **Maintainability**: Clearer code structure with explicit dependencies
### Verification
- ✅ All drag functionality preserved (paint/erase operations)
- ✅ Drag state management works correctly
- ✅ Multiple instances properly isolated
- ✅ All 6 existing test suites pass (no regressions)
- ✅ New comprehensive test suite created and passing
- ✅ Application starts and runs correctly
## Files Modified
- **time_tracker.py**: Global state removal and class attribute implementation
- **AGENTS.md**: Updated coding guidelines for class preferences
- **TODO.md**: Marked drag_info task as completed, updated progress
- **tests/test_drag_info_class_attribute.py**: New comprehensive test suite
## Testing
- Added complete test suite for drag_info functionality
- Tests verify global state removal and class attribute access
- Confirms multiple instance isolation
- Validates drag state management
Code quality significantly improved with zero functional regressions.
## Security Fixes (Critical)
### 1. Settings file race condition fixed
- Added atomic write operation using temp file + os.replace()
- Prevents corruption if process crashes during settings save
- Uses proper cleanup on failure
### 2. CSV quoting protection implemented
- Added csv.QUOTE_MINIMAL to all CSV DictWriter operations
- Optimal efficiency while maintaining security
- Proper handling of special characters (quotes, commas, newlines)
### 3. Complete CSV field sanitization
- Fixed critical Date field sanitization gap
- Created specialized sanitize_date_text() preserving YYYY-MM-DD format
- All 7 CSV fields now properly sanitized before writing
- Added comprehensive input validation for user input vectors
## New Security Functions
- sanitize_csv_text(): Removes dangerous characters (=,+, -, @)
- sanitize_date_text(): Preserves date format while removing injection attempts
- sanitize_filename(): Path traversal protection
- sanitize_config_text(): JSON/configuration safety
- validate_input(): Centralized input validation with type-specific logic
## Enhanced Features
- Alternating row colors for visual time slot distinction
- Improved conflict resolution with clearer UI indicators
- Enhanced CSV error handling with line numbering
## Testing & Documentation
- Added comprehensive test suites (5 new test files)
- Created AGENTS.md development guide
- Updated TODO.md with staged improvement roadmap
- All tests passing with 100% backward compatibility
## Files Modified
- time_tracker.py: +280 lines (security functions + atomic operations)
- tests/: New security and feature test suites
- .gitignore: Updated to include documentation and tests
All critical vulnerabilities resolved while maintaining full functionality.