From fc5e2632d6349f04009f2eb6cfcbcdeaade0a428 Mon Sep 17 00:00:00 2001 From: Hypatia May Date: Wed, 29 Jul 2026 18:16:31 +0800 Subject: [PATCH] doc(tui): drop a stale justification and clarify the fixture's tool text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two comment-only corrections from the final review round. The `isCompactCheckpoint` redundancy note appealed to the mandatory-marker invariant to explain something the enclosing branch now states outright: after e029ffb88 both call sites are literally inside an `isReplacementSurfaceEvent` branch, so the appeal became retained reasoning. Say the call sites test it directly. `appendPreCompactionLog` implied its tool-result content is what survives compaction, but `bash`'s presenter is static, so the string never reaches a fixture — the fixtures pin that the shadowed step's card survives. Neutral text plus a note on where the card body comes from, so a later reader does not "fix" a fixture to make the sentence true. Verified by the absence of fixture drift from changing the string. --- packages/ui/tui/src/chat/helpers.ts | 8 +++----- packages/ui/tui/tests/tui.snapshot.ts | 7 +++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/ui/tui/src/chat/helpers.ts b/packages/ui/tui/src/chat/helpers.ts index e411ce27c9..08e6fa050f 100644 --- a/packages/ui/tui/src/chat/helpers.ts +++ b/packages/ui/tui/src/chat/helpers.ts @@ -110,11 +110,9 @@ export function transcriptToolCallIds(session: Session): Set { * `tool/result`, a regenerated `assistant/message`) rewrite one node for the * model and mark no boundary in the conversation. * - * The replacement check is redundant at both current call sites, because a - * surface-eligible non-append event is a replacement: the marker is mandatory, - * so `Session.append` and the replay fold reject an event that carries none. - * The check keeps the exported predicate true to its name for a third caller, - * rather than making that caller repeat it. + * Both current call sites already test the replacement themselves. The check + * keeps the exported predicate true to its name for a third caller, rather than + * making that caller repeat it. * @param event - event to test. * @returns true when the event compacted a surface range. */ diff --git a/packages/ui/tui/tests/tui.snapshot.ts b/packages/ui/tui/tests/tui.snapshot.ts index f563c88b16..09ff6ba26e 100644 --- a/packages/ui/tui/tests/tui.snapshot.ts +++ b/packages/ui/tui/tests/tui.snapshot.ts @@ -195,7 +195,10 @@ interface CompactionRange { /** * Append one prompt / tool-call / tool-result step, the history a compaction - * shadows on the model surface and the transcript must keep showing. + * shadows on the model surface and the transcript must keep showing. The prompt + * text is rendered verbatim; the tool card's body comes from `bash`'s static + * presenter, so the fixtures pin that the shadowed step's card survives rather + * than the result content below. */ function appendPreCompactionLog(session: Session): CompactionRange { const user = session.append('user/message', createUserMessage({ @@ -220,7 +223,7 @@ function appendPreCompactionLog(session: Session): CompactionRange { step: 1, message: createToolResultMessage({ callId: CallId('old-tool'), - content: [{ type: 'text', text: 'tool output that stays readable after compaction' }], + content: [{ type: 'text', text: 'shadowed step tool output' }], isError: false, }), }, { surfaceOp: 'append' })