Skip to content

feat: implement multi-select monthly trigger schedule#24247

Merged
crazywoola merged 2 commits intolanggenius:feat/triggerfrom
lyzno1:feat/trigger-monthly-multiselect
Aug 20, 2025
Merged

feat: implement multi-select monthly trigger schedule#24247
crazywoola merged 2 commits intolanggenius:feat/triggerfrom
lyzno1:feat/trigger-monthly-multiselect

Conversation

@lyzno1
Copy link
Copy Markdown
Member

@lyzno1 lyzno1 commented Aug 20, 2025

Summary

Enhanced monthly trigger schedule to support multi-day selection within a month while maintaining 100% backward compatibility with existing single-day configurations.

Key Changes

Data Structure Optimization

  • Unified to single monthly_days: (number | 'last')[] field, removing dual-field complexity
  • Follows existing weekdays: string[] pattern for API consistency
  • Single selection: [15], Multi-selection: [1, 15, 30]

Component Enhancement

  • MonthlyDaysSelector: Toggle-based multi-select UI with visual state feedback
  • Execution Calculator: Enhanced algorithm supporting multiple days with deduplication and chronological sorting
  • Validation: Robust array validation with range checking (1-31) and 'last' day support
  • Panel Integration: Seamless array-based data binding with default fallbacks

Backward Compatibility

  • Existing single-day configurations automatically work as single-element arrays
  • No data migration required - handled at code level
  • UI behavior consistent for single selections

Technical Implementation

Enhanced Features

  • Multi-day Execution: Execute on multiple days within the same month
  • Last Day Support: Special 'last' value handles month-end variations (28-31 days)
  • Smart Scheduling: Automatically skips invalid days (e.g., Feb 30th)
  • Leap Year Handling: Correct February 29th handling for leap/non-leap years
  • Time Sorting: Chronological execution order within and across months

Edge Cases Handled

  • Empty selection arrays → fallback to day 1
  • Invalid days (>31) → validation rejection
  • Duplicate selections → automatic deduplication
  • Months with fewer days → smart day adjustment
  • Past execution times → automatic next-month scheduling

Test Coverage (43 test cases)

Component Tests (17 cases)

  • Single/Multi Selection: Toggle behavior, visual states, mixed selections
  • Structure Validation: 31-day grid, 'last' button, proper labeling
  • Accessibility: Keyboard navigation, visual distinction, tooltip support
  • Interaction Logic: Add/remove selection, empty array handling

Validation Tests (9 cases)

  • Valid Configurations: Single day, multiple days, 'last' day, mixed selections
  • Invalid Configurations: Empty arrays, out-of-range days (>31), type validation
  • Integration: Time format validation, large array handling (all 31 days)

Execution Calculator Tests (17 cases)

  • Multi-select Logic: Same-month multiple executions, chronological sorting
  • Calendar Handling: Leap year February, month-end variations, invalid day skipping
  • Time Processing: AM/PM conversion, 12-hour format handling, timezone consistency
  • Edge Cases: Duplicate day handling, search limits, past-time scheduling

Validation Logic Enhancement

Updated validateMonthlyConfig() to handle array-based monthly_days with comprehensive checks:

  • Non-empty array requirement
  • Range validation (1-31 + 'last')
  • Type safety for mixed number/'last' arrays
  • Integration with existing time validation

Files Modified

  • types.ts: Unified data structure
  • monthly-days-selector.tsx: Multi-select UI component
  • default.ts: Enhanced validation logic
  • execution-time-calculator.ts: Multi-day execution algorithm
  • panel.tsx: Array-based integration

Test Files Added

  • monthly-days-selector.test.tsx: Component behavior and accessibility
  • monthly-validation.test.ts: Validation logic and edge cases
  • monthly-multiselect.test.ts: Execution time calculation and calendar handling

All tests pass with high coverage: 100% component statements, 95% component branches.

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. 🌊 feat:workflow Workflow related stuff. labels Aug 20, 2025
@crazywoola crazywoola merged commit 6eaea64 into langgenius:feat/trigger Aug 20, 2025
1 check passed
@lyzno1 lyzno1 deleted the feat/trigger-monthly-multiselect branch August 20, 2025 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌊 feat:workflow Workflow related stuff. size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants