Skip to content

test(tui): capture flushed Mini scrollback output - #46505

Merged
kitlangton merged 1 commit into
v2from
scrollback-test-race
Sep 1, 2026
Merged

test(tui): capture flushed Mini scrollback output#46505
kitlangton merged 1 commit into
v2from
scrollback-test-race

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Why

The Mini monochrome scrollback test intermittently reports that its code block disappeared, receiving only Next block. This predates preview tabs on v2 and has blocked unrelated PRs including #46496 and #46497.

The test reads the renderer's private pending-output queue after asynchronous highlighting. A renderer frame can correctly flush the code block while completion is awaiting highlighting, leaving only the final paragraph in that queue. The output was emitted; the test inspected an incomplete observation of it.

What Changes

  • Read each output phase through the test renderer's existing externalOutput.takeText() recorder, which preserves emitted output independently of queue consumption.
  • Explicitly render between streaming steps to exercise the formerly failing schedule without sleeps.
  • Keep both monochrome directions and assertions for open-fence continuation, arrow conversion, no premature code output, and no repeated blocks or fence markers.

Scope

One test file only. No production rendering changes, retries, timeout increases, or skipped tests. Other tests retain their existing queue assertions.

Verification

cd packages/tui
bun run test test/mini/scrollback.surface.test.ts --rerun-each 20
bun run test
bun typecheck
  • Deterministic red/green: inserting a renderer frame before completion reproduced the exact CI failure in both existing variants; the same schedule passes with the output recorder.
  • Independent timing probe: a temporary 250 ms highlighter delay made the old test fail 10/10 runs. The fixed test passed 20/20 delayed runs. Instrumentation confirmed the code line was enqueued and flushed before the failing assertion. The probe is not part of this PR.
  • Focused file: 420 passed across 20 runs.
  • Full TUI suite: 1,183 passed, 4 skipped, 0 failures.
  • TUI typecheck, formatting, and git diff --check passed.

@kitlangton
kitlangton merged commit 54b00ec into v2 Sep 1, 2026
10 checks passed
@kitlangton
kitlangton deleted the scrollback-test-race branch September 1, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant