Skip to content

Sweep the examples nightly for stale keys, and hold the open tab in a signal - #3456

Merged
max-sixty merged 4 commits into
mainfrom
stale-keys-sweep
Oct 21, 2026
Merged

max-sixty merged 4 commits into
mainfrom
stale-keys-sweep

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

A new nightly test, test_presses_and_fills_leave_no_element_naming_stale_keys in tests/journeys/test_render_navigation.py, holds the rule keyboard/scopes.js states: a module's own state that a row's when reads must be a signal. Before this change nothing enforced it, and #3342 found four rows that read plain variables and left aria-keyshortcuts or aria-disabled stale.

The test runs the probe #3342 used. For each public example and developer page, it makes 40 random presses and fills on visible controls, in an order seeded by the example's name. After each step it waits for the page's readiness, for every send to come back, and for rendering. It then reads every element's aria-keyshortcuts and aria-disabled, forces a full key repaint (paintKeys()), and reads them again. It fails on any attribute the repaint changed, naming the step, the control pressed and the element. The keys themselves still work when a row is stale, since a press reads the rows afresh, so no other test catches this.

The stale row it found

On this PR's first CI run the sweep failed on code-comparison. After a press on a closed tab, the tab strip still named Enter and Space. The strip's "open the tab" row read aria-selected on the focused tab, which no signal tracks. A person's press focuses the tab on mousedown and opens it on click, a few frames later. So the strip read the focused tab while it was still closed, and nothing told it to read again once the tab opened. lf-tabs now holds the open panel in a signal (#active), and the row compares the focused tab with the open one. A new browser-tier test, test_a_pressed_tab_stops_naming_the_key_that_opens_it, holds the mouse down for a frame before releasing. It fails on the previous lf-tabs and passes now.

I also put #3342's diff-filter fix back (lf-diff.js asking :focus-within directly), and the sweep failed on diff-thread-gallery, naming the diff whose aria-keyshortcuts kept or lost Escape.

Waits instead of the probe's fixed delay

The probe waited a fixed 400 ms. Two of its findings were readings taken mid-operation rather than stale rows. A live sample's Reset is aria-disabled while its child loads, and the child finished loading between the two readings. A playground's Build query was aria-disabled until its send came back. The test waits for page readiness, which counts each sample's arrival, and for round_trip, so neither reads as stale.

Write-watch findings on the sweep's path

The random presses also met three findings from the write watch, which this change fixes so the test passes:

  • The merge film (examples/wt-merge.page/film.js) removed every annotation note and drew it again on each paint. The painter dropped unseen parts before #paintNotes marked the notes as seen; it now drops them after every layer has painted. The corpus copy is regenerated.
  • The playground's Copy button wrote the same data-copy-state again when pressed twice within two seconds. It now writes through keeps.
  • Sortable sets a card's draggable to false on every release of its grip, whether or not the press became a drag. It is vendored, so write_watch.js lists that write in EXPECTED.

Cost

Locally, under load from other sessions, the 28 cases take 202–306 worker-seconds in total over eight runs (about 3.5–5 worker-minutes), and 66–78 s of wall time on 4 workers. The slowest are wt-merge and pr-walkthrough, each up to about 40 s. On this PR's CI run, the 23 cases among the job's 25 slowest tests took 510 worker-seconds, file-tree the longest at 85 s, so the sweep costs about 9 worker-minutes there. It runs one seed; the decision estimated about 6 worker-minutes per seed.

This is Max's decision #31 (option C) on the overnight report.

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

max-sixty and others added 2 commits October 21, 2026 00:14
A new nightly test, `test_presses_and_fills_leave_no_element_naming_stale_keys` in `tests/journeys/test_render_navigation.py`, holds the rule `keyboard/scopes.js` states: a module's own state that a row's `when` reads must be a signal. Before this change nothing enforced it, and #3342 found four rows that read plain variables and left `aria-keyshortcuts` or `aria-disabled` stale.

The test runs the probe #3342 used. For each public example and developer page, it makes 40 random presses and fills on visible controls, in an order seeded by the example's name. After each step it waits for the page's readiness and rendering, reads every element's `aria-keyshortcuts` and `aria-disabled`, forces a full key repaint (`paintKeys()`), and reads them again. It fails on any attribute the repaint changed, naming the step, the control pressed and the element. The keys themselves still work when a row is stale, since a press reads the rows afresh, so no other test catches this.

It found no stale row on main. To check that it would catch one, I put #3342's diff-filter fix back (`lf-diff.js` asking `:focus-within` directly) and the test failed on `diff-thread-gallery`, naming the diff whose `aria-keyshortcuts` kept or lost `Escape`.

The probe's own wait was a fixed 400 ms. The test waits for page readiness instead, which counts each live sample's arrival. Without that wait, a sample's Reset read as stale: `lf-sample` keeps it `aria-disabled` while the child loads, and the child often finished loading between the two readings.

The sweep's random presses also met three write-watch findings, which this change fixes so the test passes:

- **The merge film** (`examples/wt-merge.page/film.js`) removed every annotation note and drew it again on each paint. The painter dropped unseen parts before `#paintNotes` marked the notes as seen; it now drops them after every layer has painted. The corpus copy is regenerated.
- **The playground's Copy button** wrote the same `data-copy-state` again when pressed twice within two seconds. It now writes through `keeps`.
- **Sortable** sets a card's `draggable` to false on every release of its grip, whether or not the press became a drag. It is vendored, so `write_watch.js` lists that write in `EXPECTED`.

Locally, under load from other sessions, the 28 cases take 250–306 worker-seconds in total (about 4–5 worker-minutes), and 72–78 s of wall time on 4 workers. The slowest are `pr-walkthrough` (27–41 s) and `wt-merge` (27–29 s). It runs one seed; the decision estimated about 6 worker-minutes per seed.

This is Max's decision #31 (option C) on the overnight report.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	tests/journeys/test_render_navigation.py
leaf-agent
leaf-agent previously approved these changes Oct 21, 2026
A new nightly test, `test_presses_and_fills_leave_no_element_naming_stale_keys` in `tests/journeys/test_render_navigation.py`, holds the rule `keyboard/scopes.js` states: a module's own state that a row's `when` reads must be a signal. Before this change nothing enforced it, and #3342 found four rows that read plain variables and left `aria-keyshortcuts` or `aria-disabled` stale.

The test runs the probe #3342 used. For each public example and developer page, it makes 40 random presses and fills on visible controls, in an order seeded by the example's name. After each step it waits for the page's readiness, for every send to come back, and for rendering. It then reads every element's `aria-keyshortcuts` and `aria-disabled`, forces a full key repaint (`paintKeys()`), and reads them again. It fails on any attribute the repaint changed, naming the step, the control pressed and the element. The keys themselves still work when a row is stale, since a press reads the rows afresh, so no other test catches this.

## The stale row it found

On this PR's first CI run the sweep failed on `code-comparison`. After a press on a closed tab, the tab strip still named Enter and Space. The strip's "open the tab" row read `aria-selected` on the focused tab, which no signal tracks. A person's press focuses the tab on mousedown and opens it on click, a few frames later. So the strip read the focused tab while it was still closed, and nothing told it to read again once the tab opened. `lf-tabs` now holds the open panel in a signal (`#active`), and the row compares the focused tab with the open one. A new browser-tier test, `test_a_pressed_tab_stops_naming_the_key_that_opens_it`, holds the mouse down for a frame before releasing. It fails on the previous `lf-tabs` and passes now.

I also put #3342's diff-filter fix back (`lf-diff.js` asking `:focus-within` directly), and the sweep failed on `diff-thread-gallery`, naming the diff whose `aria-keyshortcuts` kept or lost `Escape`.

## Waits instead of the probe's fixed delay

The probe waited a fixed 400 ms. Two of its findings were readings taken mid-operation rather than stale rows. A live sample's Reset is `aria-disabled` while its child loads, and the child finished loading between the two readings. A playground's Build query was `aria-disabled` until its send came back. The test waits for page readiness, which counts each sample's arrival, and for `round_trip`, so neither reads as stale.

## Write-watch findings on the sweep's path

The random presses also met three findings from the write watch, which this change fixes so the test passes:

- **The merge film** (`examples/wt-merge.page/film.js`) removed every annotation note and drew it again on each paint. The painter dropped unseen parts before `#paintNotes` marked the notes as seen; it now drops them after every layer has painted. The corpus copy is regenerated.
- **The playground's Copy button** wrote the same `data-copy-state` again when pressed twice within two seconds. It now writes through `keeps`.
- **Sortable** sets a card's `draggable` to false on every release of its grip, whether or not the press became a drag. It is vendored, so `write_watch.js` lists that write in `EXPECTED`.

## Cost

Locally, under load from other sessions, the 28 cases take 202–306 worker-seconds in total over seven runs (about 3.5–5 worker-minutes), and 70–78 s of wall time on 4 workers. The slowest are `wt-merge` and `pr-walkthrough`, each up to about 40 s. It runs one seed; the decision estimated about 6 worker-minutes per seed.

This is Max's decision #31 (option C) on the overnight report.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty max-sixty changed the title Sweep the examples nightly for elements naming stale keys Sweep the examples nightly for stale keys, and hold the open tab in a signal Oct 21, 2026
leaf-agent
leaf-agent previously approved these changes Oct 21, 2026
# Conflicts:
#	skills/leaf/packages/default/widgets/lf-tabs.js
@max-sixty
max-sixty merged commit ef39fd9 into main Oct 21, 2026
3 checks passed
@max-sixty
max-sixty deleted the stale-keys-sweep branch October 21, 2026 08:04
leaf-agent added a commit that referenced this pull request Oct 28, 2026
Page Map's search reads its shortcut availability from the rendered
rows. Refresh its scoped keys after rendering, so filtering away every
entry removes ArrowDown and Enter and clearing the query restores them.
The phone and desktop regression assertions both fail before the refresh
and pass afterward.

The sweep introduced in #3456 also compared hidden controls. The
reported step activates a Page Map contribution, which closes the native
dialog before its deferred close handler refreshes the search field.
Restrict the snapshot to visible elements: the sweep still checks the
shortcuts a reader can use, including a reopened dialog, without
demanding current metadata on a hidden field. No visible layout or
styling changes.

Validation: four focused browser cases passed (dynamic-widgets sweep,
both filtering viewports, and Page Map keyboard navigation), 695 runtime
tests passed, and `pnpm run check` passed. The kernel is rebuilt.

<details><summary>CI evidence and reproduction limits</summary>

The JUnit records from scheduled runs 40492069054 and 40675368197 both
report the search field retaining `ArrowDown Enter` after a Page Map
contribution closes the dialog; the later run calls the contribution
“Open queued.” The action's close path is in `activateSheetControl` in
`browser/runtime/page-map-dialog.js`, and the search scope's predicates
inspect visible rows.

Both the current sweep and the older handle-based input driver passed on
current main before this change. An attempt to run the original revision
could not start because its pinned Chromium headless shell (build 1243)
is absent here. The deterministic before/after reproduction is the open
dialog's empty-filter failure; the hidden-field diagnosis rests on the
CI diagnostic and the close path, rather than a locally reproduced
historical sweep failure.

</details>

Closes #4474 — 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