From bf83ab118b2c19b56e841db6e3b7f02df3cc5164 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 2 Nov 2026 17:23:49 -0600 Subject: [PATCH] test: capture unexpected native presentation idle reads Keep the zero-read idle assertion and original observation window while including at most five call-through database read stacks on failure. The initiating CI read remains unreproduced; this diagnostic does not claim a production fix. Co-Authored-By: Paperclip --- server/src/__tests__/chat-channels.integration.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/__tests__/chat-channels.integration.test.ts b/server/src/__tests__/chat-channels.integration.test.ts index 70d228f7345..4657f828989 100644 --- a/server/src/__tests__/chat-channels.integration.test.ts +++ b/server/src/__tests__/chat-channels.integration.test.ts @@ -4175,10 +4175,14 @@ describeEmbeddedPostgres("chat channel control-plane integration", () => { .toEqual({ next: null, active: 0 }); expect(f.responseWrites).toHaveLength(baseline); vi.useFakeTimers({ toFake: ["Date", "setTimeout", "clearTimeout"], shouldAdvanceTime: true }); - const reads = vi.spyOn(db, "select"), writes = vi.spyOn(db, "transaction"); + const readStacks: string[] = [], select = db.select; + const reads = vi.spyOn(db, "select").mockImplementation((...args) => { + if (readStacks.length < 5) readStacks.push(new Error("Unexpected idle database read").stack ?? "Stack unavailable"); + return Reflect.apply(select, db, args); + }), writes = vi.spyOn(db, "transaction"); try { await vi.advanceTimersByTimeAsync(120_000); - expect(reads).not.toHaveBeenCalled(); expect(writes).not.toHaveBeenCalled(); + expect(reads, readStacks.join("\n\n")).not.toHaveBeenCalled(); expect(writes).not.toHaveBeenCalled(); expect(f.responseWrites).toHaveLength(baseline); } finally { reads.mockRestore(); writes.mockRestore(); vi.useRealTimers(); } const settlePresentation = async (tx: Parameters[0]>[0]) => {