Skip to content

refactor: comprehensive schedule trigger component redesign#24359

Merged
crazywoola merged 21 commits intolanggenius:feat/triggerfrom
lyzno1:refactor/schedule-trigger
Aug 23, 2025
Merged

refactor: comprehensive schedule trigger component redesign#24359
crazywoola merged 21 commits intolanggenius:feat/triggerfrom
lyzno1:refactor/schedule-trigger

Conversation

@lyzno1
Copy link
Copy Markdown
Member

@lyzno1 lyzno1 commented Aug 22, 2025

Summary

Complete refactoring of the trigger-schedule component to implement unified timezone handling, simplified frequency modes, and enhanced data structure compatibility.

Key Changes

Architecture Improvements

  • Timezone Unification: Implemented user timezone display with UTC backend transmission
  • Mode Simplification: Removed 'once' frequency mode and simplified hourly execution model
  • Data Structure: Streamlined types and removed legacy fields (datetime, recur_every, recur_unit)

Component Restructure

  • Hourly Mode: Simplified to on_minute field only (execute every hour at minute X)
  • Weekly Mode: Added multi-select support following monthly pattern
  • Monthly Logic: Fixed edge case handling for invalid day selections (skip rather than fallback)
  • Default Frequency: Changed from daily to weekly

Data Structure Changes

// Removed fields
- datetime: Date
- recur_every: number
- recur_unit: 'hours' | 'days'

// Core structure maintained
{
  mode: 'visual' | 'cron',
  frequency: 'hourly' | 'daily' | 'weekly' | 'monthly',
  visual_config: {
    time?: string,           // User format display, UTC transmission
    weekdays?: string[],     // Multi-select support
    on_minute?: number,      // Hourly mode (0-59)
    monthly_days?: (number | 'last')[]
  },
  timezone: string,          // User timezone for display
  enabled: boolean
}

Technical Implementation

  • UTC Conversion: Automatic user time ↔ UTC conversion with format detection
  • Execution Calculator: Enhanced monthly logic to skip invalid days instead of fallback
  • Comprehensive Testing: 146 tests covering all modes, timezone handling, and edge cases
  • UI Components: Custom on_minute selector with left display + right slider design

Testing Coverage

  • Unit Tests: Complete coverage for all frequency modes
  • Timezone Tests: Round-trip conversion validation
  • Edge Cases: Monthly day selection, leap year handling, timezone boundaries
  • Integration: Full validation workflow testing

Related Issues

lyzno1 and others added 20 commits August 22, 2025 21:08
…ty, simplify to every hour on specific minute
- Ensure proper error handling and fallback behaviors
@lyzno1
Copy link
Copy Markdown
Member Author

lyzno1 commented Aug 22, 2025

2025-08-22.22.45.01.mov

@lyzno1 lyzno1 marked this pull request as ready for review August 22, 2025 14:54
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. 🌊 feat:workflow Workflow related stuff. labels Aug 22, 2025
@AAEE86
Copy link
Copy Markdown
Contributor

AAEE86 commented Aug 22, 2025

2025-08-22.22.45.01.mov

expect !

@crazywoola crazywoola merged commit 8e93a8a into langgenius:feat/trigger Aug 23, 2025
1 check passed
@lyzno1 lyzno1 deleted the refactor/schedule-trigger branch August 23, 2025 03:28
ZeroZ-lab pushed a commit to ZeroZ-lab/dify that referenced this pull request Aug 25, 2025
…us#24359)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: zhangxuhe1 <xuhezhang6@gmail.com>
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:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants