Summary
test/unit/bundles/automations/scheduler.test.ts → "Scheduler — backoff respects natural interval > cron automation with 1 error delays to next cron occurrence, not 30s" is time-dependent and flakes during a one-minute wall-clock window.
The test sets a daily 0 8 * * * (Pacific/Honolulu) cron and asserts that after one failure the next run is the natural cron occurrence (hours away) rather than the 30s error backoff:
// Next 8am is at least 1 hour away (unless test runs exactly at 7:59am HST)
expect(nextRunMs - Date.now()).toBeGreaterThan(60_000);
When the suite runs during 07:59 HST, the next 8am occurrence is <60s away, the 30s backoff wins, and the assertion fails. This is self-documented in the test comment.
Evidence
Observed in CI: a run at 17:59:33 UTC (= 07:59:33 HST) failed only this test; an immediate re-run at a different minute passed. Reproduces deterministically by running the test within the 07:59 HST minute.
Fix options
- Inject/mock the clock (freeze
Date.now() to a fixed non-boundary instant) so the assertion is time-independent — preferred.
- Or compute the threshold from the actual next cron occurrence instead of a hard-coded
60_000.
Priority
P3 — flaky test, no production impact.
Summary
test/unit/bundles/automations/scheduler.test.ts→ "Scheduler — backoff respects natural interval > cron automation with 1 error delays to next cron occurrence, not 30s" is time-dependent and flakes during a one-minute wall-clock window.The test sets a daily
0 8 * * *(Pacific/Honolulu) cron and asserts that after one failure the next run is the natural cron occurrence (hours away) rather than the 30s error backoff:When the suite runs during 07:59 HST, the next 8am occurrence is <60s away, the 30s backoff wins, and the assertion fails. This is self-documented in the test comment.
Evidence
Observed in CI: a run at
17:59:33 UTC(=07:59:33 HST) failed only this test; an immediate re-run at a different minute passed. Reproduces deterministically by running the test within the 07:59 HST minute.Fix options
Date.now()to a fixed non-boundary instant) so the assertion is time-independent — preferred.60_000.Priority
P3 — flaky test, no production impact.