From fc5ec84965ebc33b15ea3287426b266ba194bf56 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Thu, 6 Aug 2026 16:28:02 -0700 Subject: [PATCH] test(native-chat): make composition frames carry isComposing, not just inputType MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This suite's comment claimed "Gating onChange on `isComposing` breaks here." It did not. composeFrame() fired `input` with `inputType` but never set `isComposing`, so a gate on `isComposing` passed all four tests untouched — the suite asserted a discriminator it did not exercise. Composition frames now carry both, so neither gate is exempt. Verified by pointing the mutant at it: with an `isComposing` gate on the composer's onChange, this suite now fails 3 of 4 (it passed 4 of 4 before), and the ordinary-English arm correctly survives, since a composition gate should not touch it. Production code is unchanged and stays gate-free; the mutation was applied, measured, and reverted. Found while excluding NativeChatView's question-card remount as the owner of #12118 / STA-3219: the remount is real, but the preedit survives it precisely because this write path has no composition gate. --- ...hat-question-card-composition-survival.test.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/components/native-chat/native-chat-question-card-composition-survival.test.tsx b/src/renderer/src/components/native-chat/native-chat-question-card-composition-survival.test.tsx index fa44e2aee1b..7544b56ab29 100644 --- a/src/renderer/src/components/native-chat/native-chat-question-card-composition-survival.test.tsx +++ b/src/renderer/src/components/native-chat/native-chat-question-card-composition-survival.test.tsx @@ -190,7 +190,14 @@ function setInteractivePrompt(prompt: string | null, rendered: ReturnType { @@ -257,7 +264,10 @@ describe('native chat question card vs an in-flight composition', () => { // The mechanism, pinned directly: onChange fires on composition `input` // frames, so the draft cache — not the unmounted DOM node — is what carries - // the preedit across the swap. Gating onChange on `isComposing` breaks here. + // the preedit across the swap. Gating onChange on either `isComposing` or + // `inputType` breaks here — the frames now carry both, so neither gate is + // exempt. Previously only `inputType` was set, so an `isComposing` gate + // passed this suite untouched despite the claim. setInteractivePrompt(ASK_USER_QUESTION, rendered) expect(readNativeChatDraftCache(PANE_KEY)).toBe('가') })