doc(tui): record rebuild cost, replay fixture, and the A2 fold interaction

Review follow-ups on b9b2e593f, all documentation precision.

The redundancy note on `isCompactCheckpoint` leaned on a reading its call
site does not state: `index.ts` reaches it for surface-eligible non-append
events, which is the same set as replacements only because the marker is
mandatory. Say that instead.

The Agent Note now owns three facts it was leaving to a future reader.
`rebuildTranscript` materializes a component per append-origin event and
runs on mount, color-scheme change, and every reasoning toggle — work
compaction used to bound for exactly the long sessions it serves, so the
cost now tracks session length rather than the surface. `Consequences`
names `surface-replayed-compaction` as the durable evidence for the
live/replay equivalence claim, so the two fixtures that must move together
are findable from the Note rather than the PR thread. `Deferred` records
that a page can now carry a checkpoint whose `surfaceOp.start` fell out of
the window: pagination no longer cuts on the checkpoint's provenance
group, `FoldAdapter` pads with a non-surface sentinel, and `nodes()`
degrades to `degradedSeqs()` — which is already close to the transcript
projection A2 should build deliberately.

Also corrects the definite-assignment comment in the snapshot scenario:
the assertion rests on the awaited setup invoking `beforeMount`, not on
that call being synchronous.
This commit is contained in:
Hypatia May
2026-07-29 17:43:05 +08:00
parent 035a99f922
commit b7bb4842df
5 changed files with 23 additions and 9 deletions

View File

@@ -110,9 +110,11 @@ export function transcriptToolCallIds(session: Session): Set<string> {
* `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, which already
* reached a replacement: it keeps the exported predicate true to its name for a
* third caller, rather than making that caller repeat the check.
* 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.
* @param event - event to test.
* @returns true when the event compacted a surface range.
*/

View File

@@ -749,8 +749,8 @@ describe('TUI terminal-state snapshots', () => {
// real-clock millisecond tick between the fixture appends and the render
// would flip `Tools 0.0s` in and out of the pinned header.
const nowSpy = vi.spyOn(Date, 'now').mockReturnValue(COMPACTION_FIXTURE_TIME)
// beforeMount runs synchronously inside setupSnapshot, so the range the
// checkpoint replaces is assigned before the first await below.
// The awaited setup always invokes beforeMount, so the range the checkpoint
// replaces is assigned by the time the appends below need it.
let compacted!: CompactionRange
const harness = await setupSnapshot({
tools: ADVANCED_CARD_TOOLS,