Skip to content

Let the opened layer place focus before the ring walk presses its next key - #155

Closed
leaf-agent wants to merge 1 commit into
mainfrom
fix/ci-33342819547
Closed

leaf-agent wants to merge 1 commit into
mainfrom
fix/ci-33342819547

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Problem

ci on 5e0f214 failed with 30 nightly tests red, the same 30 the parent commit already had — that commit added none of them. Twenty-nine have since been fixed on main (#137, #145, #148, #149, #150, #151, #152) or are carried by an open PR (#134's catalog digest). The thirtieth is test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus, which still fails on main at d98ed92, now at a later assertion than the one #148 cleared: 1 of the layer's 32 rings are painted nowhere the corpus can be walked to: version-diff (.lf-version-diff:is(:focus-visible, .lf-focus-visible)).

The ring walk enters the versions menu with v ArrowUp ArrowUp and presses them back to back. v shows the popover, and the reader's place inside it is set from the platform's toggle event, which is queued — so both arrows arrive while focus is still on the chooser button, outside the menu, where the menu's own scoped keys never see them. The walk then started on the row the open had landed on, v2, which is the last stop in the menu, so the very next Tab was the forward boundary and closed the menu. v1's Δ — the only place in the corpus that paints the version-diff ring — was never a stop, and the floor below the walk had nothing to say about that rule.

The window opened with #137, which made v focus the chooser before pressing it (the handback that puts a reader who pressed v then Escape back on the chooser). Before it, focus stayed on the body and the arrows still reached the menu's scope. It stayed hidden until #148 cleared the earlier unseen assertion in the same test.

Solution

Read each scope-entry press on a rendered frame, which is the discipline every Tab in the same walk already uses (RING_NEW_STOP awaits RENDERED). This states the ordering the sequence depends on — a key that opens a layer has handed the reader their place in it before the next key of the sequence is pressed — rather than repeating a gesture until it happens to hold.

It is in the walk driver rather than in the versions-menu row of RING_WALKS, because the dependency is every scope's: /, c, g Shift+L, ? ? and i all open a layer whose contents the following key is aimed at.

Testing

On this branch rebased onto d98ed92, with Playwright driving real Chromium:

  • uv run pytest tests/test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus --run-nightly -n0 — passes; stashing the one-line change makes it fail again on the same assertion, run back to back on the same checkout.
  • uv run pytest tests/test_render_controls.py --run-nightly -n4 — 63 passed, 1 failed before Retarget the seated-decision tests onto a widget that declares the seat #151 landed (test_a_seat_conversation_leaves_the_pick_it_is_about_live, that PR's), now merged.
  • uv run pytest tests — 740 passed, 6 skipped.
  • ruff format --check and ruff check on the changed file — clean. pre-commit is not on this runner.

The walk was traced through the fix to confirm it is the ordering that changed and not the timing: with the frame, v lands on v2, the first ArrowUp reaches v1, and the second clamps there — which is what the row's own comment in RING_WALKS claims it does. Without it, the two arrows moved nothing at all.


Automated fix for failed run

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Dispatched for ci run 33343012806 (d1cc3c5), which carries the same 30 as the run above. On main at c0a5b65 29 of them now pass; the one left is the catalog digest, which #156 carries. So this test is the last of that set still open, and the diagnosis here reproduces independently.

The new evidence is that the fault only appears under the suite's own -n 2 load, and that this branch's change holds there. Measured on c0a5b65 over the same 30 ids: unpatched, the ring assertion failed on 2 of 4 loaded runs; with this branch's diff applied, 0 of 6. The verification in the body above is -n0 stash/unstash, where a single pass does not distinguish a fix from a run that happened to win, so this is the half that was missing.

The focused element at the moment of failure

I read document.activeElement immediately after the v ArrowUp ArrowUp sequence, before the walk starts, on runs of the same 30 ids. The menu is open and the Δ stop exists in both cases; only where focus stands differs:

ring passed  {'open': True, 'active': 'lf-version-row|1|1', 'stops': ['lf-version-row:1', 'lf-version-diff:1', 'lf-version-row:2']}
ring FAILED  {'open': True, 'active': 'lf-version-row|2|2', 'stops': ['lf-version-row:1', 'lf-version-diff:1', 'lf-version-row:2']}

lf-version-row|2 is versionStops().at(-1), so the walk's first Tab meets atVersionBoundary(-1) and closeVersionMenu runs — one stop in the scope, no Δ, and version-diff unlit for the whole corpus. That is the arrows landing outside the menu, exactly as the body describes.

One wording note on the reasoning rather than the change: g Shift+L is a chord rather than a key aimed at an opened layer's contents, so the leaves tray is not a case the ordering covers. The versions menu is the only entry in RING_WALKS today whose sequence continues after the layer is up.

@max-sixty

Copy link
Copy Markdown
Owner

Folded into #161 at 5efdaf9: the ring walk now waits for a rendered frame after every scope-entry press. #161 passes the complete 1,574-test nightly suite.

Closing this duplicate in favor of #161.

This was written by Codex on behalf of max-sixty

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.

2 participants