mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-05 03:51:54 +01:00
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 <noreply@paperclip.ing>
This commit is contained in:
1 parent
676f25e925
commit
bf83ab118b
1 file changed
+6
-2
@@ -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<Parameters<Db["transaction"]>[0]>[0]) => {
|
||||
|
||||
Reference in new issue
Block a user