86 lines
3.7 KiB
Markdown
86 lines
3.7 KiB
Markdown
# Implementation Plan
|
|
|
|
- [x] 1. Create ScheduleService with core scheduling functionality
|
|
|
|
- Implement datetime parsing and validation methods
|
|
- Add delay calculation logic for scheduling operations
|
|
- Create countdown display functionality with user-friendly formatting
|
|
- _Requirements: 1.1, 1.4, 4.1, 4.2, 4.3_
|
|
|
|
- [x] 2. Implement scheduling wait logic with cancellation support
|
|
|
|
- Add waitUntilScheduledTime method with Promise-based timing
|
|
- Implement graceful cancellation handling during wait period
|
|
- Create status display updates during countdown period
|
|
- _Requirements: 2.2, 3.1, 3.2_
|
|
|
|
- [x] 3. Update environment configuration to support scheduling
|
|
|
|
- Add SCHEDULED_EXECUTION_TIME as optional environment variable to loadEnvironmentConfig
|
|
- Implement validation logic for datetime format when scheduling is provided
|
|
- Ensure backward compatibility when scheduling parameter is not set
|
|
- _Requirements: 1.1, 4.1, 4.2, 4.3, 4.4_
|
|
|
|
- [x] 4. Integrate scheduling into main application flow
|
|
|
|
- Modify main execution function to check for scheduled execution time
|
|
- Add scheduling confirmation display before entering wait period
|
|
- Implement scheduled operation execution with existing ShopifyPriceUpdater logic
|
|
- _Requirements: 1.2, 2.1, 2.3_
|
|
|
|
- [x] 5. Enhance signal handlers for scheduled operation cancellation
|
|
|
|
- Update SIGINT and SIGTERM handlers to support cancellation during wait period
|
|
- Add clear cancellation confirmation messages for scheduled operations
|
|
- Ensure cancellation does not interrupt operations once price updates begin
|
|
- _Requirements: 3.1, 3.2, 3.3_
|
|
|
|
- [x] 6. Add comprehensive error handling for scheduling scenarios
|
|
|
|
- Implement error handling for invalid datetime formats with clear messages
|
|
- Add validation for past datetime values with helpful error messages
|
|
- Create warning system for distant future dates (>7 days)
|
|
- _Requirements: 1.4, 4.3, 4.4_
|
|
|
|
- [x] 7. Update .env.example with scheduling configuration
|
|
|
|
- Add SCHEDULED_EXECUTION_TIME example with proper ISO 8601 format
|
|
- Include comments explaining scheduling functionality and format requirements
|
|
- Provide examples for different timezone specifications
|
|
- _Requirements: 4.1, 4.2_
|
|
|
|
- [x] 8. Implement logging integration for scheduled operations
|
|
|
|
- Add scheduling event logging to existing Logger class methods
|
|
- Log scheduling confirmation, countdown updates, and execution start
|
|
- Integrate scheduled operation context into existing error logging
|
|
- _Requirements: 2.1, 2.3, 5.3, 5.4_
|
|
|
|
- [x] 9. Create unit tests for ScheduleService functionality
|
|
|
|
- Write tests for datetime parsing with various valid and invalid formats
|
|
- Test delay calculation accuracy and edge cases
|
|
- Create tests for cancellation handling during wait periods
|
|
- _Requirements: 1.1, 1.4, 3.1, 4.1, 4.2, 4.3_
|
|
|
|
- [x] 10. Write integration tests for scheduled execution workflow
|
|
|
|
- Test complete scheduling workflow with both update and rollback modes
|
|
- Create tests for cancellation scenarios during countdown period
|
|
- Verify backward compatibility when scheduling is not used
|
|
- _Requirements: 1.2, 2.1, 3.1, 3.2, 5.1, 5.2_
|
|
|
|
- [x] 11. Add error handling tests for scheduling edge cases
|
|
|
|
- Test invalid datetime format handling with clear error messages
|
|
- Create tests for past datetime validation and error responses
|
|
- Test system behavior with distant future dates and warning display
|
|
- _Requirements: 1.4, 4.3, 4.4, 5.3_
|
|
|
|
- [ ] 12. Update package.json scripts for scheduled operations
|
|
|
|
- Add npm scripts for common scheduling scenarios (e.g., schedule-update, schedule-rollback)
|
|
- Include examples in script comments for typical scheduling use cases
|
|
- Ensure existing scripts continue to work without scheduling
|
|
- _Requirements: 1.1, 1.2_
|