Merge codex/sleep-25-voice-call-reports into codex/sleep-26-teams-consent-expiry

Co-Authored-By: Paperclip <noreply@paperclip.ing>

* codex/sleep-25-voice-call-reports:
  test(server): verify voice report resume at its retained deadline
  test(server): verify retention resume at its retained deadline
This commit is contained in:
DottaandPaperclip committed 2026-10-25 09:50:45 -05:00
commit 0bb6de2343
3 files changed
+34 -4

No files matched your search

@@ -50,3 +50,23 @@ then verifies the saved reply sends on resume without another producer.
All later shared-worker consumers inherit this repair through the stack. Their All later shared-worker consumers inherit this repair through the stack. Their
combined-tip checks and PR checks still need fresh verification after propagation. combined-tip checks and PR checks still need fresh verification after propagation.
## Retention resume assertion
The combined-tip consumer run exposed a retention test that called flush after
resume and assumed a zero activity counter meant the retained retry had run. Its
helper checks active work only; zero is now also the correct paused state. The
owner test now advances the actual retained nextWakeAt, waits for row removal,
and checks disarm. Before resume it also proves a stable idle snapshot through a
minute of quiet. All 11 retention cases pass in /tmp/sleep24-drain-tests.log.
No production scheduling deadline or dispatch behavior changed for this repair.
## Report resume assertion
The report test had the same active-counter-only flush assumption. It now checks
idle snapshot stability while paused, advances the retained nextWakeAt on resume,
and verifies one fetch and the available durable report before testing rollback.
All 14 report cases pass in /tmp/sleep25-drain-tests.log. An intermediate new
assertion incorrectly expected state=completed; the schema uses status=available.
That test-authoring failure is retained in /tmp/sleep25-drain-invalid-assertion.log.
The scheduler repair and business deadlines were not changed to satisfy tests.
@@ -141,8 +141,13 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu
}); });
it("retains committed work during drain and ignores rolled-back nested writes", async () => { it("retains committed work during drain and ignores rolled-back nested writes", async () => {
await start(); await flush(); enabled = false; await start(); await flush(); enabled = false;
const call = await session(); await quiet(60_000); expect(await report(call.id)).toBeUndefined(); const call = await session(); await flush();
enabled = true; await flush(); expect(fetchReport).toHaveBeenCalledOnce(); const drained = idleWorkSnapshot();
await quiet(60_000); expect(idleWorkSnapshot()).toEqual(drained); expect(await report(call.id)).toBeUndefined();
const resumeAt = coordinator!.nextWakeAt(); expect(resumeAt).not.toBeNull();
enabled = true; await vi.advanceTimersByTimeAsync(Math.max(0, resumeAt! - Date.now()));
await vi.waitFor(async () => { await flush(); expect(fetchReport).toHaveBeenCalledOnce(); });
expect(await report(call.id)).toMatchObject({ status: "available" });
await expect(db.transaction(async tx => { await session({}, tx as unknown as typeof db); throw new Error("rollback"); })).rejects.toThrow("rollback"); await expect(db.transaction(async tx => { await session({}, tx as unknown as typeof db); throw new Error("rollback"); })).rejects.toThrow("rollback");
await flush(); expect(fetchReport).toHaveBeenCalledOnce(); await quiet(); await flush(); expect(fetchReport).toHaveBeenCalledOnce(); await quiet();
}); });
@@ -151,8 +151,13 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu
}); });
it("keeps the first write during drain and runs it on resume", async () => { it("keeps the first write during drain and runs it on resume", async () => {
await start(); await flush(); enabled = false; await start(); await flush(); enabled = false;
const call = await admission(); await quiet(60_000); expect(await row(call.id)).toBeDefined(); const call = await admission(); await flush();
enabled = true; await flush(); expect(await row(call.id)).toBeUndefined(); await quiet(); const drained = idleWorkSnapshot();
await quiet(60_000); expect(idleWorkSnapshot()).toEqual(drained); expect(await row(call.id)).toBeDefined();
const resumeAt = coordinator!.nextWakeAt(); expect(resumeAt).not.toBeNull();
enabled = true; await vi.advanceTimersByTimeAsync(Math.max(0, resumeAt! - Date.now()));
await vi.waitFor(async () => { await flush(); expect(await row(call.id)).toBeUndefined(); });
expect(coordinator!.nextWakeAt()).toBeNull(); await quiet();
}); });
it("pages through more than one batch of history across companies", async () => { it("pages through more than one batch of history across companies", async () => {
for (let i = 0; i < 104; i++) await admission(); for (let i = 0; i < 104; i++) await admission();