Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #44065 +/- ##
========================================
Coverage 89.85% 89.86%
========================================
Files 6250 6251 +1
Lines 398212 398414 +202
Branches 80242 80311 +69
========================================
+ Hits 357827 358042 +215
+ Misses 34074 34061 -13
Partials 6311 6311
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Added tests for monthly runs and cron syntax handling in next-runs.spec.ts.
|
@crazywoola I updated this PR to the latest main. The weekly test from #44718 now reads times in the schedule timezone, because the preview now returns real run times. I also added tests for monthly previews and for the case with no next run. The new parser follows croniter, so it also handles syntax like Could you take a look when you have time? |
Part of #43937 (step 2)
Problem
The schedule preview does not always show the real runs. Near a DST change, a job can run at a different time or run twice, but the preview shows something else. Some cron expressions show runs in the preview, but the backend never runs them.
Steps to reproduce (Docker)
dockerfolder, point the web service at the current main image and start Dify.Expected
Preview shows the same runs as the backend, in any browser timezone.
Actual
The preview can show a time that does not exist, miss some runs, or move a time by one hour.
This happens because the preview keeps schedule times in browser-local
Dateobjects, so the times follow the browser's DST rules. The preview also usescron-parser, which reads some cron syntax differently from croniter on the backend.Changes
time-model.ts(new) keeps wall-clock time and real instants apart, so the browser timezone no longer changes the result.cron-parser.tsfinds next runs the same way as croniter on the backend. [Refactor/Chore] Schedule Trigger time model: separate wall-clock times from instants #43937 planned to keepcron-parserfor parsing, but the library reads some syntax differently, so parsing follows croniter too.cron-parseris now only used for validation.execution-time-calculator.tsturns visual settings into cron likevisual_to_cron, so visual and cron share one path.timezone.tsno longer exportsgetTimezoneOffsetMinutes, since no other file uses the function.WallTimeand instants are kept apart.toInstantsfinds DST gaps and folds, andtoWallreads the clock in the schedule timezone. No browser-localDatemath is left.Frontend only, execution behavior is unchanged. DST handling follows what the backend does today. The new DST rules come in step 3.
Tests
next-runs.spec.tsfor DST gap and fold (New York, London, Dublin, Santiago, Lord Howe, Chatham), weekly order, cron syntax, and a check that no browser-localDatemethod is called.integration.spec.tsnow checks wall-clock fields in the schedule timezone instead of browser-localgetHours().Checklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint gods