Merge recovery fixture settlement repairs into sleep-07-tool-review-projection

Propagate the verified foreground recovery and login cleanup fixture corrections while preserving this PR boundary.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-26 21:10:07 -05:00
commit fa93beba30
2 files changed
+24 -1

No files matched your search

+17
View File
@@ -95,3 +95,20 @@ cover the surrounding login contracts.
The fake-clock database fixture warms its connections and disables pool idle/lifetime
expiry so time jumps test the worker rather than racing socket connection timers.
Database suspension and reconnect behavior require separate qualification.
## CI fixture settlement across the migration stack
The setup-token consume fixture can finish its initial fake-clock jump while
cleanup is still performing database work. A write during that pass can request
another generation whose coalesced deadline lies beyond the jump. Waiting for
zero tracked work without advancing to that registered deadline then times out,
even though cleanup has a valid wake and can finish.
The existing fixture repair from `59f8c8b3e5` is now carried at the earliest stack
branch so every intermediate PR receives it. The helper advances to registered
deadlines only while work remains tracked, preserving its existing five-second
observation limit and all production behavior. All 16 login-cleanup cases passed
on this branch against a dedicated PostgreSQL database; the prior later-branch
verification and failed CI history remain documented in the GitHub review-check
migration audit. No runtime change or weakened quiet assertion is included.
Evidence: `/tmp/sleep-login-settlement-owning-tests.log` and its zero status file.
@@ -116,7 +116,13 @@ describe.skipIf(!support.supported)("durable login cleanup", () => {
});
async function settle(ms = 30_000) {
await vi.advanceTimersByTimeAsync(ms);
await vi.waitFor(() => expect(idleWorkSnapshot().active).toBe(0), { timeout: 5000 });
await vi.waitFor(async () => {
if (idleWorkSnapshot().active > 0) {
const deadlines = coordinators.flatMap(c => c.nextWakeAt() === null ? [] : [c.nextWakeAt()!]);
if (deadlines.length) await vi.advanceTimersByTimeAsync(Math.max(0, Math.min(...deadlines) - Date.now()));
}
expect(idleWorkSnapshot().active).toBe(0);
}, { timeout: 5000 });
await vi.advanceTimersByTimeAsync(1);
await vi.waitFor(() => expect(idleWorkSnapshot().active).toBe(0), { timeout: 5000 });
expect(errors).toEqual([]);