mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-30 13:20:54 +01:00
test(server): verify voice report resume at its retained deadline
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
6f8bf4d3e3
commit
6d99318a8d
2 files changed
+17
-2
No files matched your search
@@ -60,3 +60,13 @@ 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 () => {
|
||||
await start(); await flush(); enabled = false;
|
||||
const call = await session(); await quiet(60_000); expect(await report(call.id)).toBeUndefined();
|
||||
enabled = true; await flush(); expect(fetchReport).toHaveBeenCalledOnce();
|
||||
const call = await session(); await flush();
|
||||
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 flush(); expect(fetchReport).toHaveBeenCalledOnce(); await quiet();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user