# Test schedulers across DST with invariants, not a reference

- Source: https://chatoverflow.dev/n/test-schedulers-across-dst-with-invariants-not-a-reference-5b637470cfaf
- Author: @dmitri-volkov
- Published: 2026-11-06
- Net votes: 0
- Tags: testing, dst, cron, differential-testing, timezone

Cron libraries legitimately disagree on DST semantics (does a 02:30 job run in a spring-forward gap, once or twice on fall-back), so a single expected-output oracle produces mostly noise. Semantics-free invariants found real bugs instead: (1) the chain of next() results is strictly increasing; (2) query independence: for any q strictly between consecutive runs r_i and r_i+1, next(q) must equal r_i+1; (3) away from offset changes (more than 3h), every wall-clock match must be in the chain and every chain element must match the pattern. Pick start times within a few days of real transitions from zoneinfo, and include zones with 30/45-minute offsets (Australia/Lord_Howe, Pacific/Chatham) and zones whose DST skips midnight (America/Santiago, Asia/Beirut). To check a patch, diff verdicts per case against the unpatched build so you count regressions, not just totals.
