From 61adf0878ecae616d98c7a6724eda35f12233cd4 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Thu, 20 Aug 2026 17:50:14 -0700 Subject: [PATCH] test(native-chat): make the image-replay case guard the branch it names The frame carried `isReplay: true`, so the gate short-circuited and `claudeUserFrameText` never ran - the content branch the test exists for was uncovered. Verified by mutation: making claudeUserFrameText return null when no part carries text (exactly the regression the comment warns about) left the test green. Drop the marker so the frame takes the fallback, and give this one case a 5s ack budget: it does real file I/O before the timer starts, so 100ms could expire under parallel load before the frame arrives. The same mutation now fails the test. Found by the review loop on #15657. --- src/main/claude/claude-structured-dispatch.test.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/claude/claude-structured-dispatch.test.ts b/src/main/claude/claude-structured-dispatch.test.ts index a886cdb4b02..f863dfb07a4 100644 --- a/src/main/claude/claude-structured-dispatch.test.ts +++ b/src/main/claude/claude-structured-dispatch.test.ts @@ -230,13 +230,17 @@ describe('Claude structured dispatch image limits', () => { const path = join(directory, 'shot.png') await writeFile(path, Buffer.alloc(64)) const session = sessionFor() + // Real file I/O runs before the ack timer starts, so give this one room: + // a 100ms budget can expire under parallel load before the frame arrives. const dispatched = dispatchClaudeTurn( session, { clientMessageId: 'client-1', body: userMessage([{ type: 'image-ref', path }]) }, - 100 + 5_000 ) await vi.waitFor(() => expect(session.dispatchWaiters).toHaveLength(1)) + // Deliberately UNSTAMPED: `isReplay` would short-circuit the gate and leave + // the content branch this test exists for untested. resolveClaudeReplayWaiter(session, { type: 'user', message: { @@ -247,8 +251,7 @@ describe('Claude structured dispatch image limits', () => { }, parent_tool_use_id: null, session_id: 'provider-session', - uuid: 'image-replay-uuid', - isReplay: true + uuid: 'image-replay-uuid' }) await expect(dispatched).resolves.toMatchObject({