Skip to content

test(tui): scope two whole-screen scans to what they assert - #1556

Merged
1jehuang merged 1 commit into
1jehuang:masterfrom
Kenmege:test/tui-scope-screen-scans
Sep 29, 2026
Merged

1jehuang merged 1 commit into
1jehuang:masterfrom
Kenmege:test/tui-scope-screen-scans

Conversation

@Kenmege

@Kenmege Kenmege commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Closes #1555.

Problem

Two jcode-tui lib tests search the whole rendered screen, so text they do not control changes their result:

  1. test_file_activity_scroll_reproduces_trailing_ghost_after_native_scroll_like_mutation injects ZZZZ as a ghost marker and checks !clean.contains('Z') / scrolled.contains('Z') over the full screen. The status line and header render the cwd and the random session name. A Z in either fails the pre-injection check, and makes the post-scroll check pass whether or not the injected cells survived.
  2. widgets_render_detail_layer_without_repeating_status_line_facts treats every rounded box as widget text. That includes the Updates box, which lists the latest commit subjects embedded at build time. A subject containing main, OpenAI or another status-line fact fails the test.

Change

Test-only:

  1. The pre-injection check reads target_line (the file-activity row the marker is injected into). The post-scroll check reads the same row of the repainted screen.
  2. The Updates box is pinned empty around the draw with the existing set_unseen_changelog_entries_override_for_tests, then reset. onboarding_golden.rs and frame_flicker.rs already use the same override.

Verification (rustc 1.98.1, macOS arm64, COLORTERM=truecolor, --test-threads=1 as in CI)

(1) Before, master lib test binary run from a directory whose path contains Z:

panicked at crates/jcode-tui/src/tui/app/tests/scroll_copy_01/part_01.rs:707:
ghost marker must not be present before injection:
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 2437 filtered out

The same binary from a directory without Z: test result: ok. 1 passed.

After, from both directories: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2437 filtered out.

(2) Before, on master with the Updates box holding one subject ci: keep main green (set temporarily via the override to stand in for a real build changelog):

"main" is a status-line fact and must not repeat in widgets:
 ╭─────── Updates ───────╮
 │ • ci: keep main green │
test result: FAILED. 0 passed; 1 failed

After:

$ COLORTERM=truecolor cargo test -p jcode-tui --lib -- --test-threads=1 \
    test_file_activity_scroll_reproduces_trailing_ghost_after_native_scroll_like_mutation \
    widgets_render_detail_layer_without_repeating_status_line_facts
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 2436 filtered out

cargo fmt -p jcode-tui --check reports no diff in the changed lines. The file-level diffs it does report are already on master.

🤖 Generated with Claude Code

- test_file_activity_scroll_reproduces_trailing_ghost_after_native_scroll_like_mutation
  uses 'Z' as its ghost marker but searched the whole screen, whose
  status line and header show the cwd and the random session name. A
  checkout path or session name containing 'Z' failed the pre-injection
  check and made the post-scroll check vacuous. Both checks now read
  the injected row only.
- widgets_render_detail_layer_without_repeating_status_line_facts treats
  every rounded box as widget text, including the Updates box, which
  lists the build's latest commit subjects; a subject containing "main"
  (or another status-line fact) failed it. Pin the Updates box empty for
  the draw with set_unseen_changelog_entries_override_for_tests, as
  other UI tests do.

Closes 1jehuang#1555

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Low risk] Test scans narrowed to specific assertions.

Safe to merge; no blocking issue identified.

What we checked:

  • Verified the target_row behavior around the observed marker during the exercised TestBackend path, which refutes the proposed relocation regression and notes that this does not establish behavior for a separate native terminal scroll operation. T-Rex
  • Confirmed the test holds the shared render lock before setting the empty override and clears it after drawing, with no leak or lost widget detected in this run; a parallel-render experiment remains uncompleted and could be added for stronger race coverage. T-Rex
  • Collected and reviewed artifacts to support the relocation and render-lock validation, including shell/scripts, Rust excerpts, and tests logs. T-Rex
  • Identified coverage gaps: behavior for a separate native terminal scroll operation is not established by these proofs, and stronger race coverage would benefit from completing the parallel-render experiment. T-Rex

Summary

This test-only PR narrows the ghost-marker assertion to the injected screen row and excludes build-dependent Updates text from a widget assertion. No actionable issue was found.

Reviews (1) · Last reviewed commit: "test(tui): scope two whole-screen scans ..."

@1jehuang
1jehuang merged commit 4ef10ac into 1jehuang:master Sep 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Two TUI tests scan the whole screen and fail on the cwd, session name or build changelog

2 participants