Skip to content

Commit 8a32d3f

Browse files
authored
test(sessions): pin exactly one error session is stored
Round-2 review note: assertRunConfigPersisted read setSession.mock.calls.at(-1), which tolerates extra setSession calls. Assert the call count is exactly 1 so a future setup change that lets the auto-retry loop run can't slip an intermediate session past the last-call assertions. Generated-By: PostHog Code Task-Id: 88d22f31-54f1-4121-bd68-40c5958bb2cd
1 parent bfd25bb commit 8a32d3f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/core/src/sessions/sessionServiceRetryConfig.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ const CONNECT_PARAMS = {
108108
} as const;
109109

110110
function assertRunConfigPersisted(setSession: ReturnType<typeof vi.fn>): void {
111+
// Exactly one error session should be stored — pinning this stops a future
112+
// setup change (e.g. one that lets the auto-retry loop run) from slipping an
113+
// intermediate session past the last-call assertions below.
114+
expect(setSession.mock.calls.length).toBe(1);
111115
const stored = setSession.mock.calls.at(-1)?.[0] as AgentSession;
112116
expect(stored.status).toBe("error");
113117
expect(stored.model).toBe("claude-fable-5");

0 commit comments

Comments
 (0)