Skip to content

test(tui): wait for diff base search focus - #46083

Merged
kitlangton merged 1 commit into
v2from
diff-viewer-flake
Aug 29, 2026
Merged

test(tui): wait for diff base search focus#46083
kitlangton merged 1 commit into
v2from
diff-viewer-flake

Conversation

@kitlangton

@kitlangton kitlangton commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Why

The diff-base selection test can type before the branch-search input receives
focus. DialogSelect schedules focus asynchronously; a rendered chooser is not
an input-readiness signal. When rendering wins that race, the input discards the
typed query and the later request assertion times out.

This failed in Windows CI on #46075 in the committed comparison, then in the
working comparison on an unchanged rerun. The same failure also blocked #46077.
The fixture was reproduced locally with fast rendering, independently of those
Session changes.

What Changes

Wait for the search editor to receive focus before typing. An already-focused
editor proceeds immediately; otherwise the test observes the renderer's existing
focus event. The test still exercises the real component and retains its search,
comparison, review-count, and reopening assertions.

Reproduction

Using a temporary maxFps: Number.POSITIVE_INFINITY fixture setting:

  • Before: the committed-comparison case failed 10/10 runs with the same
    frame state and stack location as Windows CI.
  • Targeted probes confirmed focus was absent before typing and the input text
    remained empty after the original debounce wait.
  • After the focus barrier: all three source variants passed 90/90 runs
    under that identical fast-render setting.

The fast-render override and diagnostic logs are not part of the final change.

Scope

Test synchronization only. No application focus changes, assertion weakening,
test retries, or timeout increases. Independent of both Session refactors.

Verification

# packages/tui
bun typecheck
bun run test test/cli/tui/diff-viewer.test.tsx --test-name-pattern 'choosing a base remembers it and refreshes only the affected' --rerun-each 100
bun run test test/cli/tui/diff-viewer.test.tsx --rerun-each 3
bun run test

Normal-speed focused stress: 300 passed, 0 failed, all three variants run
100 times, 4,400 assertions (195.02 seconds).
Normal-speed repeated diff-viewer suite: 273 passed, 0 failed, 2,376
assertions. Full TUI: 989 passed, 4 skipped, 0 failed, two snapshots and 4,371
assertions across 122 files. TUI typecheck and all 33 pre-push typecheck tasks
passed at d7bbe7a01d.

Three simplify reviews of the complete six-line diff found no actionable
changes. Prettier and diff checks passed. The final patch contains no diagnostic
logging or fast-render override.

@kitlangton
kitlangton merged commit 1719477 into v2 Aug 29, 2026
12 checks passed
@kitlangton
kitlangton deleted the diff-viewer-flake branch August 29, 2026 12:37
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