Skip to content

Filter go-to targets by kind - #376

Merged
max-sixty merged 3 commits into
mainfrom
codex/filter-go-to-targets
Sep 7, 2026
Merged

max-sixty merged 3 commits into
mainfrom
codex/filter-go-to-targets

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

Go-to hints lost their kind-specific shortcuts when target addressing became one generated map. This restores g m, g t, g a, g h, and g f as filters over the current visible targets, assigning fresh shorter codes without reintroducing separate activation paths.

Inline target hints now show a muted ellipsis plus the remaining code instead of repeating g at every target. Escape backs out through a partial hint, the active filter, and then the chord.

The browser coverage exercises filtering, regenerated codes, empty filters, viewport refreshes, compact labels, Escape behavior, tab selection, link activation, crowded maps, and the updated reserved alphabet. The full 904-test suite and rendered light/dark browser checks pass.

The touched nightly module also updates the feature gallery's expected Ask count from 13 to 14, matching the swipe-interaction Ask already present in the authored fixture.

This was written by Codex on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filter is a good shape — one map, narrowed, rather than a second activation path. One state path missed the new argument, though, and it breaks the filter on the refresh route the module's own header documents.

paintAddresses refreshes the map without the active filter

Every other reader of visibleCandidates gained the argument — candidateIsCurrent, activateCandidate, filterTargets, and the Escape rung that deliberately clears it. The refresh inside paintAddresses (the if (refreshed) block, right after const detached = …) still calls it bare:

const refreshed =
  !prefix && !scrolling && (refreshCandidates || detached || !candidates.length);
if (refreshed) {
  candidates = visibleCandidates();

targetFilter stays set while candidates becomes the whole scene, so the chips that get painted are not the filter's and candidateIsCurrent — which does filter — rejects every one of them. refreshed requires !prefix, which is exactly the state a filter leaves the reader in, so nothing narrows it.

Two reachable triggers, both on the claimed path:

  • !candidates.length — a kind with no visible members. g t on a page with no tabs announces No visible tabs. and the next frame paints the complete unfiltered map.
  • refreshCandidates — set by every scroll settle and by resize. The header states "scrolling refreshes it once motion settles"; while filtered, that refresh silently drops the filter.
Reproduced at this head, on ADDRESSED_PAGE

g then t (no tabs on that page) — chips repaint as ['Link', 'Link', 'Fold', 'Page-map Button', 'Control', 'Control'] where the announcement just said there were none.

g then h (correctly 2 Link chips), then a 1280→1200 resize — the same six chips return, with targetFilter still Link.

Typing the fold's freshly painted code l in that state: live region reads That target is no longer visible. The hints are reset. and #dsc stays closed. Every non-Link chip on screen is dead.

candidates = visibleCandidates(targetFilter); is the whole fix. The line sits outside the diff, so I haven't put it inline — happy to push it as a commit if that's easier than reaching for it.

The new browser test is thorough on the states it visits, but neither of the two that break is among them: it never refreshes the scene while a filter stands, and never filters to a kind the page has no members of. Both are cheap to add on ADDRESSED_PAGE, which has no tabs.

Smaller

One inline suggestion on the key line's wording while a filter stands.

@max-sixty

Copy link
Copy Markdown
Owner Author

Fixed the refresh path in 52062a02: it now regenerates from the active target filter. The browser test covers both a populated filter across resize and a zero-member filter that remains empty until Escape restores the complete map.

This was written by Codex on behalf of max-sixty

@leaf-agent

Copy link
Copy Markdown
Collaborator

Confirmed resolved at 52062a02. Both triggers I named now hold, and the new assertions pin each one: g t on a page with no tabs stays empty across the resize refresh, and the Link filter keeps its two chips through a 1280→1180 resize instead of repainting the whole scene.

Verified locally at that head — tests/test_render_navigation.py -k target_mnemonics passes. The does/line functions match the pattern the layer already uses for state-dependent rows (page.js:362, return-stack.js:166), and every consumer reads them through word(), so the key line no longer advertises a filter to a reader who already applied one.

One unrelated failure, not a finding against this PR

A full tests/test_render_navigation.py run at this head had test_the_feature_gallery_exercises_core_reader_workflows fail on .lf-signoff reading ✓ Version approved where it expected Approve version — the undo hadn't landed when the assertion read. It passes in isolation (4 passed), and the PR touches only address.js, chrome.css, and the navigation tests, none of which reach the signoff path. That is running-tend's first class — a read that ran before the page said it was ready, surfacing under parallel load — so it belongs to that test, not to this change.

@max-sixty
max-sixty merged commit 6b77b0a into main Sep 7, 2026
10 checks passed
@max-sixty
max-sixty deleted the codex/filter-go-to-targets branch September 7, 2026 06:19
max-sixty pushed a commit that referenced this pull request Sep 7, 2026
…us and its exported copy (#383)

## Problem

The nightly leg of [`ci` on
`edd1c5a`](https://github.com/max-sixty/leaf/actions/runs/34083084673)
went red on 17 readings. All but two came from one cause, and every one
of them reproduces deterministically on that commit and on today's
`main`.

#354 gave the interaction gallery three contained frames, and each of
them runs a whole second Leaf page. A Leaf page arrives:
`restoreArrangements()` puts back the workspace this reader last had
open, and `letGo()` puts them on the page's own body. Both run inside
the frame, and a document has one focus — so `document.activeElement`
out on the gallery became the `<iframe>`, and whatever the reader was
holding was let go of. That is what closed the crowded margin cluster
mid-test, dropped every `.lf-target-hint` on the corpus, and took
`#bg-choice-ask` off its focus.

The export half is separate and had been masked by the reading in front
of it: the frame's `srcdoc` names the runtime, the theme, and the
gallery adapter on a server a standalone file has not got, so an
exported copy opened with four CORS failures. Its `<kbd>` chord caption
was authored hidden, so the copy also held words with no script left to
reveal them.

## Solution

`data-lf-contained` marks both sides of the boundary — the frame element
out in the gallery and the body of the page inside it. A contained page
arrives restoring no arrangement and placing no focus, and the bake
drops a contained frame with the scripts. The chord caption now lives
with its own visibility rather than in authored markup. On a page that
is not contained nothing changes: every guard reads a constant that is
false there.

Arrival is only half of it. The framed chrome still places focus once a
replay runs it — a shown `<dialog>` runs the browser's focusing steps
whatever the page around it wants. So the frame's body is written
`inert` beside the mark: an inert subject ends those steps before they
reach anything, so the focus never crosses the boundary and there is
nothing to hand back. The replays are unaffected, because they drive
that chrome through the adapter rather than by pointing at it. Measured
on the `Open and close Threads` tab: without the line the reader loses
the tab they just pressed the moment the framed panel opens, and `g T`
and `w` then reach a document they cannot see.

`inert` is the same one-line fix #393 carries, arrived at from the other
side. The two conflict textually — both write it into
`loadFrameDocument` on the line this branch marks the body on — and
resolving either way is taking one copy of the line.

`test_a_contained_replay_leaves_the_page_around_it_standing` pins both
halves: it fails on `main` with `assert 'IFRAME' != 'IFRAME'` at
arrival, and on the arrival fix alone at the replay, where the reader is
no longer standing on the tab they pressed.

Two readings are restated rather than repaired, because the gallery
really did change: its swipe specimen sits in an unselected tab, so one
margin row is withheld and the posture clear runs for it. (The Ask count
13 → 14 landed separately in #376.)

<details><summary>The 17 readings, and what each was</summary>

Focus taken by a frame — 14:
`test_the_feature_gallery_keeps_its_real_actions_reachable[1440/1200/700/390]`,
`test_ask_addresses_follow_the_feature_gallery_s_visible_margin_controls[1200/390]`,
`test_margin_target_hover_requires_pointer_movement`,
`test_a_workspace_lands_one_responsive_layout_and_carries_the_column_to_it[1440/1600]`,
`test_selection_hints_do_not_name_page_content_behind_a_covering_panel`,
`test_a_shipped_log_opens_its_example_on_a_live_thread`,
`test_other_responses_can_turn_the_compact_field_into_a_suggestion`, and
both `test_an_exported_page_fixture_stands_on_its_own` cases, which
failed on the caption before they could reach the CORS errors.

Restated:
`test_an_unchanged_heartbeat_restates_no_margin_name[gallery]`,
`test_the_feature_gallery_exercises_the_injected_core_surfaces`.

**Not this branch's**:
`test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`
fails the same way on `06daeef3`, one commit before #354 — `pageSettled`
never becomes true in the response bar of `ship-review`. It took [run
34079766897](https://github.com/max-sixty/leaf/actions/runs/34079766897)
down too, so it is a red `main` of its own and I am carrying it
separately.

</details>

## Testing

`uv run pytest tests` (899 passed), and the complete nightly modules the
change reaches: `test_render_margin.py`, `test_render_navigation.py`,
`test_render_export.py`, `test_render_semantic_selection.py`,
`test_render_pages.py`, `test_render_widgets.py`, `test_site.py` — all
green. The new test was checked against a tree with the two runtime
guards reverted, where it fails.

For the focus half added since: `test_site.py` (31 passed), and every
gallery, contained-frame, export, standalone, accessibility and drawing
reading in the suite (130 passed), plus `test_render_margin.py` whole
and the two readings elsewhere this branch clears (83 passed). With the
`inert` line alone removed, the contained-replay reading fails on the
tab losing focus.

## One flake carried too

`test_unchanged_margin_refresh_cost_is_bounded_by_refresh_count` took
this branch's first CI run down at `LayoutCount: 29` against a bound of
20, and it does the same on `6b77b0a9` with none of this branch on it —
once in six runs there, once in seven here. The corpus carries the
gallery's contained frames, and a frame still arriving lays itself out
in the measured page's own process, which counted against five
dispatches that touch nothing reads as the heartbeat forcing layout.
Both corpus cost measurements — that one and
`test_margin_layout_batches_the_composed_page_without_refolding_controls`,
which measures the same page the same way — now wait for the frames to
be ready before opening the CDP session: fourteen runs green after,
where it failed twice in thirteen before.

## What this does not clear

One reading on `main` is still red and is not this branch's:
`test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`,
which I re-ran on this tree after #385 landed. It is tracked in #396,
where the two possible repairs are written out — both are a product
decision rather than a mechanical one.

<details><summary>What it looks like</summary>

The walk hangs on `pageSettled` in the response bar of `ship-review`:
three transitions on one reaction chip's `.lf-margin-button-label` —
opacity, transform, visibility, the label reveal — restart before they
finish, indefinitely. `startTime` moves forward and `currentTime` goes
back to 0 between two samples a second apart. Last green on
[`934bfc4c`](https://github.com/max-sixty/leaf/actions/runs/34077249270);
red from `06daeef3` (#365), which is what made a reaction a margin
button with a label.

The other readings that were red beside it have since been repaired on
`main` and pass here: the three `test_render_reactions.py` cases went
with #385, and
`test_render_gate.py::test_a_reload_mid_flight_never_wedges_round_trip`
passes on this tree.

</details>

## Rebuilt on #378

#378 landed while this was open and rebuilt the contained page without
`srcdoc`. The mark and the `inert` write both go on the document
`loadFrameDocument` writes, and the frame element carries the mark
beside it. `main` is merged in and the branch is green: `uv run pytest
tests` (901 passed), and `test_site.py` and `test_render_margin.py`
complete under `--run-nightly` (112 passed).

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/34083084673)

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 7, 2026
…us and its exported copy (#383)

## Problem

The nightly leg of [`ci` on
`edd1c5a`](https://github.com/max-sixty/leaf/actions/runs/34083084673)
went red on 17 readings. All but two came from one cause, and every one
of them reproduces deterministically on that commit and on today's
`main`.

#354 gave the interaction gallery three contained frames, and each of
them runs a whole second Leaf page. A Leaf page arrives:
`restoreArrangements()` puts back the workspace this reader last had
open, and `letGo()` puts them on the page's own body. Both run inside
the frame, and a document has one focus — so `document.activeElement`
out on the gallery became the `<iframe>`, and whatever the reader was
holding was let go of. That is what closed the crowded margin cluster
mid-test, dropped every `.lf-target-hint` on the corpus, and took
`#bg-choice-ask` off its focus.

The export half is separate and had been masked by the reading in front
of it: the frame's `srcdoc` names the runtime, the theme, and the
gallery adapter on a server a standalone file has not got, so an
exported copy opened with four CORS failures. Its `<kbd>` chord caption
was authored hidden, so the copy also held words with no script left to
reveal them.

## Solution

`data-lf-contained` marks both sides of the boundary — the frame element
out in the gallery and the body of the page inside it. A contained page
arrives restoring no arrangement and placing no focus, and the bake
drops a contained frame with the scripts. The chord caption now lives
with its own visibility rather than in authored markup. On a page that
is not contained nothing changes: every guard reads a constant that is
false there.

Arrival is only half of it. The framed chrome still places focus once a
replay runs it — a shown `<dialog>` runs the browser's focusing steps
whatever the page around it wants. So the frame's body is written
`inert` beside the mark: an inert subject ends those steps before they
reach anything, so the focus never crosses the boundary and there is
nothing to hand back. The replays are unaffected, because they drive
that chrome through the adapter rather than by pointing at it. Measured
on the `Open and close Threads` tab: without the line the reader loses
the tab they just pressed the moment the framed panel opens, and `g T`
and `w` then reach a document they cannot see.

`inert` is the same one-line fix #393 carries, arrived at from the other
side. The two conflict textually — both write it into
`loadFrameDocument` on the line this branch marks the body on — and
resolving either way is taking one copy of the line.

`test_a_contained_replay_leaves_the_page_around_it_standing` pins both
halves: it fails on `main` with `assert 'IFRAME' != 'IFRAME'` at
arrival, and on the arrival fix alone at the replay, where the reader is
no longer standing on the tab they pressed.

Two readings are restated rather than repaired, because the gallery
really did change: its swipe specimen sits in an unselected tab, so one
margin row is withheld and the posture clear runs for it. (The Ask count
13 → 14 landed separately in #376.)

<details><summary>The 17 readings, and what each was</summary>

Focus taken by a frame — 14:
`test_the_feature_gallery_keeps_its_real_actions_reachable[1440/1200/700/390]`,
`test_ask_addresses_follow_the_feature_gallery_s_visible_margin_controls[1200/390]`,
`test_margin_target_hover_requires_pointer_movement`,
`test_a_workspace_lands_one_responsive_layout_and_carries_the_column_to_it[1440/1600]`,
`test_selection_hints_do_not_name_page_content_behind_a_covering_panel`,
`test_a_shipped_log_opens_its_example_on_a_live_thread`,
`test_other_responses_can_turn_the_compact_field_into_a_suggestion`, and
both `test_an_exported_page_fixture_stands_on_its_own` cases, which
failed on the caption before they could reach the CORS errors.

Restated:
`test_an_unchanged_heartbeat_restates_no_margin_name[gallery]`,
`test_the_feature_gallery_exercises_the_injected_core_surfaces`.

**Not this branch's**:
`test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`
fails the same way on `06daeef3`, one commit before #354 — `pageSettled`
never becomes true in the response bar of `ship-review`. It took [run
34079766897](https://github.com/max-sixty/leaf/actions/runs/34079766897)
down too, so it is a red `main` of its own and I am carrying it
separately.

</details>

## Testing

`uv run pytest tests` (899 passed), and the complete nightly modules the
change reaches: `test_render_margin.py`, `test_render_navigation.py`,
`test_render_export.py`, `test_render_semantic_selection.py`,
`test_render_pages.py`, `test_render_widgets.py`, `test_site.py` — all
green. The new test was checked against a tree with the two runtime
guards reverted, where it fails.

For the focus half added since: `test_site.py` (31 passed), and every
gallery, contained-frame, export, standalone, accessibility and drawing
reading in the suite (130 passed), plus `test_render_margin.py` whole
and the two readings elsewhere this branch clears (83 passed). With the
`inert` line alone removed, the contained-replay reading fails on the
tab losing focus.

## One flake carried too

`test_unchanged_margin_refresh_cost_is_bounded_by_refresh_count` took
this branch's first CI run down at `LayoutCount: 29` against a bound of
20, and it does the same on `6b77b0a9` with none of this branch on it —
once in six runs there, once in seven here. The corpus carries the
gallery's contained frames, and a frame still arriving lays itself out
in the measured page's own process, which counted against five
dispatches that touch nothing reads as the heartbeat forcing layout.
Both corpus cost measurements — that one and
`test_margin_layout_batches_the_composed_page_without_refolding_controls`,
which measures the same page the same way — now wait for the frames to
be ready before opening the CDP session: fourteen runs green after,
where it failed twice in thirteen before.

## What this does not clear

One reading on `main` is still red and is not this branch's:
`test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`,
which I re-ran on this tree after #385 landed. It is tracked in #396,
where the two possible repairs are written out — both are a product
decision rather than a mechanical one.

<details><summary>What it looks like</summary>

The walk hangs on `pageSettled` in the response bar of `ship-review`:
three transitions on one reaction chip's `.lf-margin-button-label` —
opacity, transform, visibility, the label reveal — restart before they
finish, indefinitely. `startTime` moves forward and `currentTime` goes
back to 0 between two samples a second apart. Last green on
[`934bfc4c`](https://github.com/max-sixty/leaf/actions/runs/34077249270);
red from `06daeef3` (#365), which is what made a reaction a margin
button with a label.

The other readings that were red beside it have since been repaired on
`main` and pass here: the three `test_render_reactions.py` cases went
with #385, and
`test_render_gate.py::test_a_reload_mid_flight_never_wedges_round_trip`
passes on this tree.

</details>

## Rebuilt on #378

#378 landed while this was open and rebuilt the contained page without
`srcdoc`. The mark and the `inert` write both go on the document
`loadFrameDocument` writes, and the frame element carries the mark
beside it. `main` is merged in and the branch is green: `uv run pytest
tests` (901 passed), and `test_site.py` and `test_render_margin.py`
complete under `--run-nightly` (112 passed).

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/34083084673)

---------

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