11/**
2- * The full retained transcript (bounded by `MAX_RETAINED_STREAM_ROWS`) has
3- * to stay reachable by scrolling, and appending a new row must not rebuild
4- * the whole paint tree to do it.
2+ * The full retained transcript must stay reachable by scrolling, and one
3+ * append must not rebuild the whole paint tree.
54 */
65import { describe , expect , test } from "bun:test" ;
76import { withTestRenderer } from "./harness" ;
@@ -11,8 +10,8 @@ import { streamRowCount } from "./shell/transcript";
1110import { MAX_RETAINED_STREAM_ROWS } from "./long-log" ;
1211
1312async function settle ( h : { renderOnce : ( ) => Promise < void > } ) : Promise < void > {
14- // Markdown highlighting and viewport culling both settle a frame or two
15- // after the triggering mutation, not within it.
13+ // Markdown highlighting and viewport culling settle a frame or two after
14+ // the mutation, not within it.
1615 for ( let i = 0 ; i < 5 ; i ++ ) {
1716 await new Promise ( ( resolve ) => setTimeout ( resolve , 10 ) ) ;
1817 await h . renderOnce ( ) ;
@@ -38,15 +37,15 @@ describe("long-log transcript scrolling", () => {
3837 await settle ( h ) ;
3938 const frame = h . captureCharFrame ( ) ;
4039
41- // Rows 0-49 were evicted by the retention cap — gone by design, not
42- // a scrolling bug. Row 50 is the oldest still- retained row and sits
43- // 450 rows above the old 200-row paint window; it must be reachable
44- // in one scroll rather than staying stranded behind a collapsed marker.
40+ // Rows 0-49 were evicted by the cap — gone by design, not a scroll
41+ // bug. Row 50 is the oldest retained row, 450 rows above the old
42+ // 200-row paint window; one scroll must reach it, not leave it
43+ // stranded behind a collapsed marker.
4544 expect ( frame ) . toContain ( "row-50" ) ;
4645 expect ( frame ) . not . toContain ( "row-49" ) ;
47- // The boundary says rows were dropped rather than reading as the
48- // true start of history — eviction is permanent, unlike the old
49- // collapse marker, so scrolling further will never reveal row 0.
46+ // The boundary says rows were dropped, not the true start of
47+ // history — eviction is permanent, unlike the collapse marker, so
48+ // scrolling never reveals row 0.
5049 expect ( frame ) . toContain ( "50 earlier rows dropped" ) ;
5150 } finally {
5251 shell . dispose ( ) ;
@@ -80,10 +79,10 @@ describe("long-log transcript scrolling", () => {
8079 appendStreamRow ( shell , { role : "assistant" , text : "one-more" } ) ;
8180 await settle ( h ) ;
8281
83- // Before this fix, repaintTranscriptWindow ran on every append once
84- // the log passed LONG_LOG_COLLAPSE_THRESHOLD (500): it tore down every
85- // existing child and repainted windowSlice's LONG_LOG_WINDOW (200) rows
86- // from scratch — 200 removals for this one append, every append after .
82+ // Before this fix, repaintTranscriptWindow ran on every append
83+ // past LONG_LOG_COLLAPSE_THRESHOLD (500): it tore down every child
84+ // and repainted windowSlice's LONG_LOG_WINDOW (200) rows from
85+ // scratch — 200 removals per append.
8786 expect ( removed ) . toBe ( 1 ) ;
8887 } finally {
8988 shell . dispose ( ) ;
@@ -143,8 +142,8 @@ describe("long-log transcript scrolling", () => {
143142 } ;
144143
145144 // Streaming token updates hit this path on every delta; past the
146- // retention cap it must still touch one node, not the eviction
147- // notice's presence forcing a full repaintTranscriptWindow.
145+ // cap it must still touch one node, not the eviction notice forcing
146+ // a full repaintTranscriptWindow.
148147 const lastIndex = streamRowCount ( shell ) - 1 ;
149148 replaceStreamRowAt ( shell , lastIndex , {
150149 role : "assistant" ,
0 commit comments