Repository navigation
fix(job): run a cron step on a single value to the end of the field - #4526
Conversation
A step on a single value now follows Vixie cron and cronie: N/S runs from N to the field's
maximum, every S. "5/1" in the minute field was minute 5 alone and is now 5-59 ("5/15" was
already 5,20,35,50). Day-of-week runs through 7, which is Sunday again: "7/2" is accepted
(it was refused as a reversed range) and means Sunday, and "1/2" now includes Sunday.
Ranges with a step ("5-20/5") and "*/S" are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
Wheels Test Results37 180 tests - 222 870 36 433 ✅ - 217 880 11m 18s ⏱️ - 1h 48m 58s Results for commit 0777715. ± Comparison against base commit 056404d. This pull request removes 222880 and adds 10 tests. Note that renamed tests count towards both. |
|
Review: head 0777715. APPROVE (ready). This also closes the INFO I left on #4493 ( Semantics against cronie, per fieldcronie's
On day-of-week, Nothing else changed
RED is genuineAgainst the old code:
The new specs assert all three. They also pin the unchanged forms ( DocsThe guide line ( Evidence
|
Problem
A cron step on a single value didn't follow Vixie cron or cronie, the de facto standard:
5/1(minute)5-597/2(day-of-week)1/2(day-of-week)Schedules are new in 4.2, and changing what an expression means after release would silently move users' jobs, so this is fixed before the cut.
Change
JobCron.$range(): when a single value has a step (N/S), the range now runs from N to the field's maximum, for any step including 1. Day-of-week's maximum is 7, which$weekdayField()already maps to Sunday.Unchanged:
5);5-20/5);*/S;5/15, which was already5,20,35,50.The multi-server jobs guide's
.cron()line describes the rule with examples, and a changelog fragment (changed) is included.Tests
JobSchedulerSpechas two new specs."runs N/S from N to the end of the field":
5/15→ 5,20,35,50;5/1→ 5-59;22/1→ 22,23;30/1→ 30,31;11/1→ 11,12;5/15is 10:35."runs a day-of-week N/S through 7":
7/2→ Sunday;1/2andMON/2→ Sunday, Monday, Wednesday, Friday;*/2→ 0,2,4,6, unchanged;7/2next fires on the following Sunday.Against the old
JobCron: the first spec fails (5/1gave only 5), and the second errors ("'7/2' is a reversed range").Local results:
tools/rustcfml/run-suite.shwithTZ=UTCexits 0.verify-docson the page passes 13/13.🤖 Generated with Claude Code