Repository navigation
A cron weekday written as a number reads as standard cron, so 1-5 syncs Monday to Friday instead of Sunday to Thursday - #1399
Open
rudycelekli wants to merge 2 commits into
Conversation
WaylandYang
requested changes
Oct 24, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
Correct, thanks: the cron crate counts weekdays from 1 = Sunday, so 0 9 * * 1-5 runs Sunday to Thursday today. Please apply the same rewrite in cron_next_after (or add a migration), so sources already saved with 1-5 don't keep running Sunday to Thursday.
…cs Monday to Friday instead of Sunday to Thursday Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
…on, so a stored 1-5 stops running Sunday to Thursday Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
rudycelekli
force-pushed
the
fix/cron-standard-weekdays
branch
from
November 5, 2026 03:17
ce4f4fb to
27e17ff
Compare
Contributor
Author
|
cron_next_after now applies the same weekday rewrite before it parses a stored expression, so a source saved earlier with 0 9 * * 1-5 next runs on Monday rather than Sunday; a_source_saved_with_weekday_numbers_runs_on_standard_cron_days covers it. Rebased on dev. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Advanced schedule field links to crontab.guru, and
validate_crondocuments itself as taking a standard 5-field cron expression. Thecroncrate (0.12.1) that evaluates it numbers weekdays Quartz-style: 1 = Sunday … 7 = Saturday, and 0 is out of range. So a source saved with Advanced0 9 * * 1-5("weekdays at 09:00" on crontab.guru) syncs Sunday to Thursday, and0 9 * * 0(Sundays) is rejected as invalid. The Weekly picker is unaffected because it already writes weekday names.What changes
crates/utopia-store/src/sources.rs: before validating,validate_cronrewrites a numeric weekday field using standard cron semantics (0–7, where 0 and 7 are both Sunday; lists, ranges and/step) into weekday names, which both readings agree on. That is what gets stored:1-5becomesMon,Tue,Wed,Thu,Fri. A field without digits, or one it cannot read, is passed to thecroncrate unchanged. Rows already saved with numeric weekdays keep their current reading until they are saved again.How it was checked
cron_weekday_numbers_read_as_standard_croncovers1-5,0and5-7.utopia-storecrate locally (the disk is full). So I compiled the exactvalidate_cronregion of this file, plus both tests, in a scratch crate pinned tocron = "=0.12.1":cron_validationpasses and the new test fails (left: "0 9 * * 1-5"). A schedule built from the stored0 9 * * 1-5and started on Saturday 2026-10-24 next fires on a Sunday.-D warningsis clean on that crate, andrustfmt --checkis clean onsources.rs.cargo test --workspacelocally. CI covers it.Before review
git commit -s)cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspacepass (left to CI; see above)