diff --git a/doc/plans/2026-10-25-voice-inbound-cleanup-sleep-audit.md b/doc/plans/2026-10-25-voice-inbound-cleanup-sleep-audit.md index 36cd4496d3c..cbe526fda8e 100644 --- a/doc/plans/2026-10-25-voice-inbound-cleanup-sleep-audit.md +++ b/doc/plans/2026-10-25-voice-inbound-cleanup-sleep-audit.md @@ -272,3 +272,15 @@ All 132 cases across the complete voice-session and inbound-cleanup suites pass on separate fresh databases, and server typechecking passes. Downstream integration and latest-head CI remain required. The separate company-deletion cleanup findings are not resolved by this correction. + +## Fairness-test clock follow-up (2026-10-27) + +CI's backlog test observed two provider failures where it expected one. A controlled +30 ms provider delay reproduced the same failure: the assertion callback advanced +fake time by one second on every retry, in addition to Vitest's ordinary clock +advancement, reaching the failed provider's retry while the original backlog was +still settling through PostgreSQL. Removing that extra clock jump makes the same +controlled case pass. The five-second assertion budget and all product code remain +unchanged. With the temporary provider delay removed, all 13 lifecycle tests pass. +This repairs test clock ownership; it does not weaken provider retries or delivery +fairness. Current-head CI remains required. diff --git a/server/src/__tests__/voice-inbound-cleanup.test.ts b/server/src/__tests__/voice-inbound-cleanup.test.ts index 24c08af29a0..7006f2d6622 100644 --- a/server/src/__tests__/voice-inbound-cleanup.test.ts +++ b/server/src/__tests__/voice-inbound-cleanup.test.ts @@ -184,8 +184,9 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu terminate.mockImplementation(async call => { if (call.id === broken.id && failed) throw new Error("provider unavailable"); return true; }); await start(); expect(terminate.mock.calls.slice(0, 25).some(([call]) => call.id === last.id)).toBe(true); - await vi.waitFor(async () => { - await vi.advanceTimersByTimeAsync(1000); + // waitFor already advances fake time. Extra one-second jumps can reach + // the failed provider's retry while ordinary database writes are pending. + await vi.waitFor(() => { expect(terminate.mock.calls.filter(([call]) => call.id !== broken.id)).toHaveLength(105); }, { timeout: 5000 }); expect(errors).toHaveLength(1); failed = false;