Skip to content

Fix the main tests the preview PRs broke, and three preview gaps behind them - #5629

Merged
max-sixty merged 4 commits into
mainfrom
key-scope-escape-tests
Nov 7, 2026
Merged

max-sixty merged 4 commits into
mainfrom
key-scope-escape-tests

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Five PRs landed on main without the full push suite: #5614 (the preview owner), #5615, #5616, #5618 and #5617. Main's push ci run at 4248d1f (42246533122) fails about 50 tests that the run at its parent 62cb54f (42203695127) passes, and they still fail at ef6c01e (42320062138). Run singly here, every one of them but three fails at 84d9186 and passes at 62cb54f; the three are at the end. This branch fixes the code where the PRs did something worse for a user than their own rules say, and updates the tests that asserted behaviour the PRs replaced on purpose.

Code: three gaps between #5614's rules and its code

  • A thread card previewed its own name. preview.js counted every element wearing data-lf-offer as a control, and Leaf writes an empty one on chrome that presses nothing. A pointer resting anywhere in a thread card showed "Thread, Keep this review note…" over the words it repeats, and a t walk landing on a card already on the page showed it too, which took the Escape that lets go of the thread. A control is now any native or ARIA press (PRESSES, control-selectors.js), ranges and selects included, or a custom control whose data-lf-offer names its press (PRESSABLE). Thread cards, messages, resolved groups, toolbars and status or layout chrome preview nothing of their own; an element's own lfPreview is read either way. test_a_range_and_a_select_preview_their_names_and_a_thread_card_none holds both halves in both engines. (The branch's first try at this used PRESSABLE alone, which also dropped the previews of Leaf's own ranges and selects, since they wear an empty data-lf-offer too.)
  • A reaction's disclosure took an extra Escape. Enter on a reaction's glyph puts the user on its revealed Undo with a move, which preview.js reads as the user's own move, so the Undo previewed and the first Escape only put that away. keyboard/AGENTS.md ("Escape") says focus a surface places as it opens costs no Escape. The disclosure now says it opened (layerOpened) before placing focus.
  • The command reference stopped running Resolve and Copy message. Pointing reads; pressing acts: one owner previews every control #5614 made r and Mod+C press the thread's Resolve and the message's Copy as their control, with no run. The reference's own reading of which rows it can run left that case out. It now runs what the row's key runs, the control's press included. On the PR walkthrough exactly those two rows change.

Tests: behaviour the PRs replaced on purpose

  • Titles became previews. Leaf's controls write no title on Leaf. Tests that read a held-news notice's label as its accessible description, or a title on an All pages row, a diff row's path, an On me choice or the joined notice, now read the element's preview declaration (expect_preview_words).
  • A focus preview is Escape's first step. Tests that expected one Escape to close the surface a focused control stands in now put the preview away first, with a new put_preview_away helper, then assert the step they protect. The inline sites Pointing reads; pressing acts: one owner previews every control #5614 and the key-scope commit wrote use the helper too.
  • test_key_scopes.py's two tests: the branch's first commit, as before.
  • test_an_age_previews_its_clock_time_in_the_reader_s_zone (Thread and age previews, and passage marks that follow their words as the page changes #5618) passed only through the thread-card name preview above. It now asserts the keyboard's clock-time preview stays visible, on the focus route, with its words, while the pointer rests on the message.
  • Four nightly journey tests read the same titles: test_render_anchors, test_render_threads and test_website_server now pass.

Still failing, and why

  • test_obligation_contextual_bindings_are_independent_of_widget_bindings: Pointing reads; pressing acts: one owner previews every control #5614 made a control's aria-keyshortcuts the union of every key that presses it (controlShortcuts in scopes.js, reflectElementShortcuts). It now names x and y on the obligation, where only 3 reaches the control, and x where a nearer dead declaration takes x from it. bindings.js still says the attribute describes the dispatcher's currently reachable routes, nearer reservations included, while control-keys.js says every key chip's key is in it. Which contract holds is a decision; the test is unchanged.
  • test_a_playground_opens_its_instruction_over_the_page: after the preview on the instruction's Copy is put away, the next Escape leaves the instruction popover open and only the one after closes it. The lost Escape reproduces in a probe at 84d9186, and is being fixed on a separate branch.
  • The three Leaf-fold tests in test_render_floating_panel.py, and test_threads_holds_a_row_that_joins_or_moves_behind_a_notice (since Thread and age previews, and passage marks that follow their words as the page changes #5618): each passes its assertions and errors at teardown, because the shift watch reports the preview's words moving without input as the preview rides its traveling target. The preview follows its target natively (position-anchor: auto, showPopover({source})), but the watch finds anchors only by name. Teaching the watch the implicit anchor didn't remove the finding.
  • tests/journeys/test_render_files.py::test_file_editor_saves_quietly_and_preserves_inflight_edits: passes its title step now, and since A chart says the value under the pointer, focus or a held finger #5617 fails earlier: the editor's gutter moves without input after an external file update. Not traced further.
  • A chart says the value under the pointer, focus or a held finger #5617's own push run (42343843769) hadn't finished, so its breakage beyond the file journey is unknown.

Two candidates are not from these PRs: test_a_changed_diff_file_keeps_its_sideways_reader and test_trace_tree_opened_by_the_browser_keeps_its_match each failed in one run only and pass singly at 84d9186, as does test_tab_at_a_control_scrolled_away_goes_on_in_the_column_the_pointer_is_in.

Checks

  • Each changed browser and journey test, singly, at the branch head: passes, both engines where a test takes one, except those listed above.
  • The preview, reference, key-scope and reaction tests near the code changes, singly: pass.
  • leaf-dev probe --base: the notification playground's slider previews "Concurrent release events" in Chromium and Firefox, and the motion playground's Time slider and speed select preview as at 84d9186.
  • pnpm run check and pre-commit run --files on every changed file: pass.

This was written by Claude Code on behalf of max-sixty

Two tests in test_key_scopes.py have failed on main since the preview
owner landed. Both expected Escape to let go of a focused element, and on
each element focus now shows a preview, which Escape puts away first.

- test_a_layer_is_left_the_same_way_however_it_was_reached has failed
  since 4248d1f (#5614). Focusing the On me toggle or a margin marker
  shows the control's preview: focus a script or a walk places is a
  `move`, and preview.js shows a focus preview for a `move` the browser
  shows as `:focus-visible` (`onCurrentLocation` in preview.js). A
  standing preview is Escape's first step and the press does nothing else
  (keyboard/AGENTS.md, "Escape"), so focus stayed on the control where the
  test expected the page.
- test_escape_passes_a_manual_popover_the_user_is_not_in has failed since
  1d5249c (#5616), which made a link into the page preview the place it
  names. The fixture's `<a href="#para">` now shows that preview on
  focus, so the first Escape put the preview away and the link stayed
  focused.

Both are behaviour #5614 chose: a preview standing over the page is
Escape's first step (WCAG 1.4.13), and #5614 updated its own tests'
Escape sequences the same way. So the tests change, not the code. Each
now asserts that the preview stands, that the first Escape puts it away
and leaves focus where it was, and that the second Escape takes the step
the test protects: letting go of Leaf's own controls onto the page, and
letting go of a link under a manual popover the user isn't in (#5582).

tab_onto's docstring said a script's focus shows no preview. It shows one
wherever the browser shows that focus, which these tests rely on, and the
docstring now says so.

> _This was written by Claude Code on behalf of max-sixty_
Three things #5614 (the preview owner) changed for users broke tests in main's push
suite. Each is a gap between the rule #5614 wrote and the code that carries it, so
the code changes and the tests that caught it stand as they were.

- A thread card previewed its own name. preview.js counted every element wearing
  `data-lf-offer` as a control, but an empty `data-lf-offer` marks Leaf chrome that
  presses nothing (widget-elements.js, `PRESSABLE`). A thread card's accessible name
  is "Thread, " and its first words, which differ from its face, so a pointer resting
  anywhere in a card showed "Thread, Keep this review note…" over the words it
  repeats, and a `t` walk landing on a card already on the page showed the same
  preview, which took the Escape that lets go of the thread.
  `test_the_pr_walkthrough_exercises_an_inline_diff_thread` caught the walk. A
  control is now what `PRESSABLE` names, with buttons, links and summaries, so a card
  previews nothing of its own and a message keeps its age preview.
  `test_an_age_previews_its_clock_time_in_the_reader_s_zone` passed only through
  this: a pointer moved onto the words of the message the keyboard was on showed the
  card's name in place of the keyboard's clock time. A pointer there now reads
  nothing, so the keyboard's reading stands, which the test now asserts by its route.
- A reaction's disclosure took one Escape more to fold. Enter on a reaction's glyph
  reveals its Undo and puts the user there with a `move`, which preview.js reads as
  the user's own move, so the Undo showed its preview and the first Escape only put
  that away. keyboard/AGENTS.md ("Escape") says focus a surface places as it opens
  costs no Escape. The disclosure now says it opened (`layerOpened`) before placing
  focus, as a layer does. `test_a_press_away_takes_back_a_reaction_s_offered_remove`
  and `test_a_token_press_marks_the_passage_and_its_revealed_remove_takes_it_back`
  caught it.
- The command reference stopped running Resolve and Copy message. #5614 made `r` and
  Mod+C name the thread's Resolve and the message's Copy as their control, with no
  `run` of their own, so the key presses the control (bindings.js, `commandRun`). The
  reference decided which rows it can run by a second reading of a row that left
  that case out, so both rows became explanations. It now runs what the row's key
  runs, the control's press included. On the PR walkthrough exactly those two rows
  change. `test_the_reference_runs_available_commands_and_explains_the_rest` and
  `test_the_reference_keeps_local_search_state_on_one_lit_surface` caught it.

held-news.js still said the notice's title carries each fact; its preview does now.

> _This was written by Claude Code on behalf of max-sixty_
… away first

These tests have failed on main since #5614 (the preview owner), each asserting
behaviour #5614 replaced on purpose. Run singly, each passes at 62cb54f, the parent
of #5614, and fails at 84d9186. The behaviour each protects stays asserted.

- Leaf's own controls write no `title` on Leaf; their words are their preview. A
  held-news notice's whole label ("1 new reply · 1 message edited"), an All pages
  row's account, a diff row's cut path, an On me choice's words and the joined notice
  in Threads were read as a title, or as the accessible description a title gave.
  They are now read off the element's preview declaration (`expect_preview_words`) in
  test_thread_surfaces, test_summaries, test_render_read_state, test_agent_replies,
  test_render_application_boundary, test_status_and_news, test_render_controls,
  test_render_floating_panel, test_diffs and test_on_panel. A screen reader now hears
  a notice's label as its description while its preview stands on focus, not at rest.
- Focus the user moves onto a control, by Tab, an arrow or a walk, shows its preview,
  and Escape's first step puts that away and does nothing else (keyboard/AGENTS.md,
  "Escape"). A script's `.focus()` stands in for such a move. Tests that expected one
  Escape to close the surface the control stands in now put the preview away first,
  with `put_preview_away`, a new helper in render_harness.py, and then assert the step
  they protect: test_live_samples, test_clusters, test_entries, test_render_reactions
  (three tests), test_rewrites, test_playgrounds and test_render_anchors. The sites
  #5614 and the key-scope commit wrote inline (test_command_routes,
  threads/test_navigation, test_key_scopes) use the helper too.

test_playgrounds still fails, now on the step it protects: once the preview on the
instruction's Copy is put away, the next Escape leaves the instruction popover open
and only the one after closes it. That is a lost Escape for the user, not the test.

Four journey tests, which run only nightly, read the same titles and descriptions:
test_render_anchors, test_render_threads and test_website_server now pass;
test_render_files passes the title step and fails earlier, where #5617 changed what an
external file update does to the editor's gutter. A failure at line 743 of
test_summaries.py, older than these PRs, hides the same notice description at line
769 in test_a_root_summary_keeps_thread_actions_outside_its_fold, which now reads the
preview too.

> _This was written by Claude Code on behalf of max-sixty_
…ncluded

6c78b62 made a control what `PRESSABLE` names, to stop a thread card previewing its
own name. But `data-lf-offer` is a press marker, not a classification of controls:
Leaf writes an empty one on its native ranges and selects too, as on thread cards. So
the notification playground's slider stopped previewing "Concurrent release events",
and the motion widget's Time slider and speed select stopped previewing at all.

A control is now what `PRESSES` (control-selectors.js) names, the native and ARIA
presses every gesture owner shares, ranges and selects among them, plus a custom
control whose `data-lf-offer` names its press. A thread card, a message, a resolved
group, a toolbar and status or layout chrome are none of these, so they still preview
nothing of their own; a field the user types in previews nothing, as before; and an
element's own `lfPreview` is read either way. On the two examples the previews match
84d9186 again in Chromium and Firefox.

test_a_range_and_a_select_preview_their_names_and_a_thread_card_none holds both
halves in both engines: under 6c78b62 the range shows no preview, and with the old
`[data-lf-offer]` member back the `t` walk's landing on a thread card shows "Thread,
Does the tray fit the north bracket?".

test_an_age_previews_its_clock_time_in_the_reader_s_zone now also asserts that the
keyboard's clock-time preview stays visible with its words while the pointer rests
on the message: a hidden preview keeps its `data-lf-route`, so the route alone passed
a preview that had gone.

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty
max-sixty merged commit d2abaa2 into main Nov 7, 2026
4 of 5 checks passed
@max-sixty
max-sixty deleted the key-scope-escape-tests branch November 7, 2026 09:04
max-sixty added a commit that referenced this pull request Nov 7, 2026
… wherever they show; the shift watch credits a preview riding its target (#5638)

This fixes the causes left on `main` after #5614 and #5617 that #5629
didn't cover, and two gaps review found in the preview's Escape step.
The
file editor's gutter finding was not caused by #5617 (see **Left
open**).

## Keys a control says

#5614 made a control's `aria-keyshortcuts` and its preview's key chips
name every key any row binds to it, wherever the user stood. A screen
reader announces the attribute with no context, so it promised keys that
did nothing. The Inspect button in
`test_obligation_contextual_bindings_are_independent_of_widget_bindings`
said `x y` while the user was on the suggestion, where only `3` presses
it, and kept `x` after a nearer, unavailable declaration took it.

Both now come from one reading: the dispatcher's reachable bindings from
where the user is (`availableCommandRoutes`), each under the control its
row or route names (`reachingNow`, `keyboard/control-keys.js`). The
preview reads it as it shows. `paintCoreControls` writes the attribute
each frame for the controls whose keys moved. The command hints read the
same reading for their faces, and their separate per-frame
`aria-keyshortcuts` projection is gone. Exports paint the attribute too.

Behaviour changes against `main`:

- Resolve says `r` only where `r` presses it, on its thread. With the
  caret in the reply, where `r` is typed, it says no key.
- A focused control's own Enter and Space, the platform's press of any
  control of its kind, draw no chip. Its attribute still names them.
- A close control says Escape only where a row says Escape presses it,
as
  the image viewer's does. The floating panel's ✕, a margin card's and
Page Map's say no key, since their Escape steps don't name the control,
though Escape from inside those surfaces closes them. The panel field's
  Close, added in #5630, keeps its own `esc`.

`test_a_control_previews_its_word_and_every_key_that_presses_it`
asserted
the old rule (a hover chip `r` with the caret in the reply). It now
expects no key there and `r` once Escape leaves the reply for the
thread.

## The preview's Escape step

While a preview stands, Escape's first step puts it away. Three gaps
broke that.

**Inside an open popover.** In
`test_a_playground_opens_its_instruction_over_the_page`, after Tab
showed
Copy's preview inside the instruction popover, the first Escape put the
preview away, the second did nothing, and the third closed the
instruction. While Escape has a step of Leaf's to take, the page holds a
CloseWatcher (`keyboard/close-requests.js`), which it reads in the
repaint
frame. A standing preview is such a step, so the frame after the Tab
made
a watcher above the popover's own. Putting the preview away asked for no
frame, so the stale watcher took the next Escape's close request and
found nothing to do. The preview now reads the watcher again at once
whenever its step comes or goes (`stepMoved` calls
`paintCloseRequests`).
That holds for a key and for Back alike, even with two presses inside
one
frame.

**Back.** An earlier version of this branch refreshed the watcher from
an
Escape keydown listener, which ran ahead of `back_gesture`'s blocker, so
the back-gesture tests got a refresh real Back never makes. That
listener
is gone.
`test_a_back_gesture_after_a_preview_put_away_closes_the_popover_under_it`
is the back gesture's form of the playground test. It and the playground
test fail with `stepMoved` disabled, and pass with it.

**Inside a modal dialog.** A preview of the image viewer's Close lost
its
first Escape, which closed the viewer and the preview together, in
Chromium and Firefox; `main` does the same. The preview shows inside the
topmost modal, but its scope had no root, so the modal's floor
(`keyboard/dispatch.js`, `stack`) dropped it. The scope is now rooted at
the preview itself.
`test_a_preview_inside_a_modal_takes_escape_before_the_modal`
fails in both engines without this.

Letting the browser take the preview's Escape, tried before, closed the
panel's thread view under the preview, so the preview keeps its step.

## A preview standing clear of news drawn beneath it

In `test_threads_holds_a_row_that_joins_or_moves_behind_a_notice`, the
landed row's focus preview stood where news then drew the notice of a
resolved thread, and the preview stood afresh clear of it, moving its
words 330 px, which the shift watch reported. That move is the preview's
deliberate answer to content arriving where it stood, as on `main`: a
notice arriving exactly under a preview is a rare path, which may move
the
preview rather than carry a hold of its own (SOUL.md, "Keep the
foundation
small and extensible"). The test now asserts that the rows hold still
behind the notice and that the preview stands clear of it, and consumes
that one move by its preview nodes, as other tests consume a deliberate
move; the watch itself is unchanged for everything else.

## The shift watch and a preview riding its target

Three tests that fold the panel with a focus preview on the Leaf button
errored at teardown. The browser carries the preview exactly with the
button (`position-anchor: auto`, `showPopover({source})`), but the watch
couldn't prove the preview anchored:

- it found anchors only by name; it now also reads the `source` of the
`showPopover` or `togglePopover` call that opened the popover, and only
  that call, since one made while the popover stands open leaves the
  browser's anchor as it was;
- it read insets only with pixel offsets; it now also reads an offset
  from a custom property, and a script changing that property still
  reports;
- it required every declaration that might be in force to be anchored.
The preview stands under the chrome guard's `all: revert-layer` and its
  own `inset: auto`, and the guard's rollback branch read that `auto`
  without asking Typed OM whether the inset is still `auto`. This third
  gap is why the implicit-anchor patch from triage passed its own tests,
  which had no guard, and left the finding in place.

The watch's anchor tests gain the preview's shape: a guarded popover on
its implicit anchor, carried by its source's translation and by its
source's scroll, clean and faulted, and one asked to show again with
another `source` while open, whose independent move must still report.
The clean cases fail on the old watch and on the triage patch alone, and
the re-shown case fails with a wrapper that records every call's source.

## Left open

- Escape steps other than the preview's still rely on the repaint frame
to
  bring the close watcher up to date. With an `lf-draft` in an auto
  popover, two quick Escapes swallow the second, on `main` too. The
watcher's sync belongs with any change to the step Escape has available,
  as the preview's now is (`stepMoved`).
- The journey
`test_file_editor_saves_quietly_and_preserves_inflight_edits`
  fails at line 142 intermittently, before #5617 as well as after:
  locally it reported the gutter in 2 of 4 runs at `ef6c01ed8` that
  reached that line, 0 of 2 at `84d918681`, 1 of 4 on `main` and 0 of 5
  on this branch. Right before the external write the gutter matches its
  lines. The watch sees the two frames after it, where CodeMirror draws
  the gutter rows 16 px tall beside 24 px lines before its measure
  corrects them. So #5617 has no hunk to bisect to, and the fix belongs
  in how the editor applies an external update, or in what the watch
  counts as content that update replaces.
-
`test_tab_at_a_control_scrolled_away_goes_on_in_the_column_the_pointer_is_in[firefox_browser-input]`
fails intermittently on `main` as on this branch, run alone 1 time in 4
  on `main` and 1 in 3 here.

## Checks

`pnpm run check`, pre-commit on the changed files, and each changed or
nearby browser test by node id in Chromium and Firefox where it runs in
both: every test asserting `aria-keyshortcuts`, the preview's placement,
focus, Escape, modal and back-gesture tests, the close-request tests,
the
playground, the fold tests, the Threads test and the watch's anchor
tests.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 9, 2026
#5629 made a control any native or ARIA press or a `data-lf-offer` that names
its press, so the file editor's status span, which wears an empty offer, is
now chrome rather than a control. Chrome previews no name of its own, so the
status's declared `detail` stands as the preview's first line instead of a
detail line under the accessible name. The test still asserts the status
previews why it can't save; it reads the preview's whole face rather than the
detail line that #5629 deliberately removed.

Closes #5704
leaf-agent added a commit that referenced this pull request Nov 9, 2026
…5730)

`test_sample_file_editor_resize_keeps_classic_scrollbars_inside_its_document`
has failed on main since #5629. That PR narrowed what `preview.js`
counts as a control to a native or ARIA press, or a `data-lf-offer` that
names its press, so chrome wearing an empty offer previews no name of
its own. The file editor's status span
(`packages/file-editor/widgets/lf-file-editor.js`) is such chrome. Its
`lfPreview` still declares `{detail: [failure.message]}`, but with no
accessible name above it, `lines()` puts that message first, as the
preview's name line, so the face has no `.lf-preview-detail`.

The status still previews why it can't save, which is what the test
protects; only the line the words sit on moved, as #5629 meant. The test
now reads the preview's whole face (`#lf-preview`) and expects exactly
"No file is bound as 'notes'.". No product code changes.

Verification: the test fails on main at `2f47830e4` with the issue's
error (`.lf-preview-detail` not found) and passes on this branch with
`uv run pytest --run-main` on that node id.

Closes #5704 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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