Repository navigation
Fix the rail-j/k App.test flake: wait for Home's key listener, not just the rail - #11
Merged
Merged
Conversation
…st the rail App.test.tsx "moves only the rail on the rail's j/k — Home's cursor stays where it was" failed intermittently on CI (node 18.17.1: expected '#/run/r_2f91c4a8' to be '#/run/r_a03d51e7'). mountShell waits for the RAIL's rows, then the test sends `j` to HOME, whose readiness nothing awaited: - Home's table is a separate poll from the rail's, and can commit a beat later. - Even once it has, Home answers keys through a window listener that React re-subscribes in a passive effect, after the commit that painted the rows. A `j` that lands in either gap runs against `runs = []`, Home's cursor stays on row 0, and the final Enter opens RUNS[0] (r_2f91c4a8) — CI's exact failure. The test now waits for the listener itself before pressing `j`: Home claims (preventDefault) `Home` only when it holds rows, and `Home` leaves the cursor on row 0, where it starts anyway. Every assertion is unchanged. Reproduced by holding Home's listing 30 ms behind the rail's: the old test failed 25/25 on Node 18.17.1 and 25/25 on 24 (CI's message when Home's rows land between `j` and Enter, `#/` when they land after Enter); the fixed one passes 25/25 on both. Deferring React's passive effects instead also reproduces CI's message. The fixed test still fails, with the same message, when Home is made to answer the rail's keys again (the regression it guards). Unmodified, it passes 50/50 on 18.17.1 and on 24, and 50/50 on 18.17.1 under CPU contention; full viewer suite green on 18.17.1.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the intermittent viewer failure seen on run 37967628995 (attempt 1,
viewer suite · node 18.17.1, PR #7 — which touches no viewer code):The race
mountShell()waits for the rail's rows. The test then sendsjto Home, and nothing waited for Home to be ready:windowlistener that React re-subscribes in a passive effect, which runs after the commit that painted the rows.A
jthat lands in either gap runs againstruns = [], so Home's cursor stays on row 0, and the finalEnteropensRUNS[0](r_2f91c4a8). That's CI's exact failure.The fix
One test-only change. Before pressing
j, the test waits for Home's listener itself:Home claims
Home(callspreventDefault) only when it holds rows. No other window listener handles that key.Homealso leaves the cursor on row 0, where it starts anyway. All of the test's assertions are unchanged. The table is virtualized in the shell, so Home's cursor can't be read from the DOM there, and waiting for Home's rows to render wouldn't close the second gap.Verification
jandEnter,#/when they land afterEnter)vitest run, minus the local-only e2e) +typecheckstopPropagation, and Home'sdefaultPreventedandownsShortcutchecks. Both the old and the fixed test fail with the same message.No CHANGELOG entry, since this is a test-only fix (same as the two test fixes in #8).