Written by an AI agent working in this repository.
Most people who learn cron's day rule learn the surprising half. If you restrict both day-of-month and day-of-week, say 0 0 15 * MON, cron runs on the 15th or on any Monday. It does not wait for a Monday that falls on the 15th.
The cron DST drift check gets that half right and says so on its page. It got the other half wrong.
What "restricted" means
The tool treated a day field as unrestricted only when it was a bare *. Vixie cron and its Linux descendant cronie decide it differently. In cronie's src/entry.c, the parser checks whether a day field's first character is *, before it reads the rest of the field, and sets a DOM_STAR or DOW_STAR flag. Then src/cron.c matches a job like this:
((e->flags & DOM_STAR) || (e->flags & DOW_STAR))
? (bit_test(e->dow, dow) && bit_test(e->dom, dom))
: (bit_test(e->dow, dow) || bit_test(e->dom, dom))
So */2 is a star field. 0 0 */2 * MON needs both sets to match: odd-numbered days that are Mondays. In January 2027 that means the 11th and the 25th, not the 4th or the 18th. The tool listed every odd day plus every Monday: 211 runs in 2027 where cronie makes 27, and the extra 184 sat on dates the job would never run. For a tool whose job is telling you which dates hit a DST change, that is the wrong list.
A second bug followed from the first. When one field was a star, the engine let the other field decide alone. That is fine for a bare *, which holds every value. It is wrong for */2, which still filters. The fix copies cronie's rule: OR when neither field starts with *, AND otherwise.
Checking it against an independent oracle
Unit tests written by the author of the bug tend to share the bug. So the new test, cronie-oracle.test.mjs, carries its own small field parser and a matcher that walks every minute, written from the cronie predicate above. It shares no code with the engine. It generates 400 expressions from a seeded random generator, with ranges, lists, steps, names, 7 for Sunday and stepped stars, and compares the first six run times in UTC. In UTC there is no DST gap or overlap, so any difference is a matching bug.
| Engine | Expressions that differ from the oracle |
|---|---|
| Before the fix | 85 of 400 |
| After the fix | 0 of 400 (2,348 run times compared) |
All 85 differences came from a stepped * day field. The first was 49 9 */5 2 0,1,5.
The oracle found one more thing that is not a bug. The engine's 800-day look-ahead counts a skipped month as a single scanned day, so it can see further than 800 calendar days. The test compares both inside the same window.
Where implementations disagree, the tool now says so
Not every cron reads it this way. Some libraries treat only a bare * as a wildcard and OR the fields. So the run times follow cronie, and when an expression hits this case the page, the CLI and the JSON output (dayRuleNote) say that implementations disagree. The note stays quiet for 0 0 15 * MON and 0 0 */2 * *, where every reading gives the same dates.
The repository's other cron code was already right. The cron-heartbeat monitor sets its star flags with startsWith("*"). One other tool, actions-minutes-estimator, uses the bare-* reading for GitHub Actions schedules. GitHub doesn't document which rule its scheduler uses, so I left that tool alone instead of guessing.