Repository navigation
Replace numbered go-to routes with generated hints - #336
Conversation
# Conflicts: # skills/leaf/assets/leaf.js # tests/test_render_projection.py
leaf-agent
left a comment
There was a problem hiding this comment.
One defect on the claimed path: a target that straddles the banner keeps a working hint with no face, and Enter after Tab announced it does nothing.
visibleCandidates admits a target using the banner-clamped box (top: Math.max(box.top, covered)), but the paint loop in paintAddresses re-checks exposed() against placement.visibleBox()'s unclamped box. visibleBox only rejects a member wholly behind the banner (box.bottom > covered), so for a member more than half hidden the unclamped vertical centre lands on the banner, elementFromPointAcross returns the banner, and the chip is skipped. The same pass then runs if (wasActive && activeCandidate && !drawn.has(activeCandidate)) hintActive = -1;, which disarms Enter for the target Tab just announced.
Reproduced on this head — a link scrolled so its first box straddles the banner (covered 42, top 29, bottom 48):
ANNOUNCE Go to — 1 visible targets; type a hint or press Tab to hear them. …
CHIPS []
HEARD Hint a: Link, Probe destination. Press Enter to go there.
Enter → URL unchanged
type a → #arrival
So the route exists and is announced, but has no face a sighted reader can read it off, and the one press the announcement promises is the one that fails. Clamping the paint reading the same way admits the chip and restores Enter (CHIPS [['a', 'probe']], Enter → #arrival); the inline suggestion is that change. This is the case hints.js singles out — "an opaque hint has no meaning once its face is hidden, so collisions are spread rather than removed" — so it looked worth closing rather than leaving to the drop. Happy to push the fix with a browser test pinning it if you'd like.
Nothing else held up. I checked the pageParts widening to pageQueryAll against its other consumer (pageOutline → headingFor, which assumes document order and would get a cross-tree list): no shipped shadow widget renders h1–h6 today, so it is latent rather than reachable. test_inflight_native_paging_hides_hints_until_the_scene_settles polls a state the page passes through, but deleting the scrolling early return makes it fail, so it is load-bearing rather than vacuous.
…t red (#339) `test_render_*` is nightly-marked, so the PR gate never ran the two files #336's hint migration rewrote; both went red on `main` the moment it landed. `tests/test_render_margin.py` rebinds `target` — a `page.locator("#jobs")` the test still uses seventy lines later — to the hint's phase id string, so the run dies at `expect(target).not_to_have_class(...)` with `ValueError: Unsupported type: <class 'str'>`; renaming the new binding to `phase` is the whole fix. `tests/test_render_anchors.py` reads the Ask option's key face while the go-to chord is armed, and the chord is a nearer keyboard layer that takes the Ask digit projection back while it stands, so the face is `display: none` and never becomes visible. Both were verified here against `main`: each failure reproduces on `a4eb323f` and passes on `b7703fb9`, the commit before the merge. <details><summary>The anchors repair, and one behavior worth confirming</summary> The test's new comment claims bare `g` "paints the page's generated target letters without replacing the Ask projection." Probed on the merged runtime, it replaces it: with focus in `#tq-one .lf-pick` the two `.lf-address` faces read `1:block`/`2:block`, and after `g` they read `:none`. That matches what `asks/view.js` says it intends — "A nearer keyboard layer suppresses the row and both projections … so a digit never stays promised after a chord, text box, or modal has taken it" — so this change follows the runtime and reads the option's face before arming the chord rather than during it. If the projection was meant to survive bare `g` instead, the repair belongs in `paintActionProjections` and this test should go back to one frame. The face reads are also now one task each. Resolving a locator handle in one round trip and measuring it in the next let the standing paint detach the element in between, and a detached element has no computed style at all — every property came back `''`. That reproduced on the chip, the key line, and the hint layer in turn, which is why `FACE` is applied through `document.querySelector` inside a single `page.evaluate` for every face compared. The `c` press before the focus stays: the Ask projection paints on a keyboard gesture, and opening the composer is the gesture the test already had. Bare `.focus()` with a 300ms settle paints nothing, before or after the migration. </details> <details><summary>Verification</summary> - `uv run pytest tests/test_render_anchors.py tests/test_render_margin.py` — 155 passed, on `83f69563`. - `uv run pytest tests` — 891 passed, 6 skipped. - `pre-commit run --files tests/test_render_anchors.py tests/test_render_margin.py` — passed. - The anchors case run five times in a row for stability — passed each time. </details> --------- Co-authored-by: leaf-agent <[email protected]>
The everyday suite `ci` runs on a pull request deselects every nightly-marked module, so a pull request whose whole diff is one of those modules goes green having exercised none of it. That is how #336 landed a rewrite of `tests/test_render_margin.py` and `tests/test_render_anchors.py` under a green gate and reddened `main` the moment it merged — #339 is the repair — and #338 is in the same position right now with `tests/test_render_margin.py` and `tests/test_render_navigation.py`. This names the touched modules back. A new pull-request step diffs the merge commit against its base parent, collects the `tests/test_*.py` files the diff touches, and runs them with `-m nightly`: `conftest.py` already runs what an explicit file selection names, `-m nightly` leaves a mixed module's everyday cases to the step above rather than running them twice, and pytest's exit 5 is what a pull request that touches no nightly case gets. The cost is the touched files, not the 22–41 minute nightly suite, and a pull request that touches no test module pays nothing. A change to the runtime those modules drive is still the nightly run's to catch; this reaches the modules themselves. <details><summary>Verification</summary> The step's shell was run locally against real commit ranges, with `uv run pytest` swapped for the same invocation: - `83f69563..d10463f` (#339's two nightly modules) — selects both, 155 nightly cases collected. - `ff580ecb..867c526` (touches `tests/test_render_mcp.py`, which carries no nightly mark) — selects it, `no tests ran`, exit 5 tolerated, step exits 0. - An empty range — `No test module touched.`, exit 0. - `d10463fd..83f6956` (the same diff reversed, so the range reads as deletions) — the `[ -f ]` filter drops what is not on disk and the step still selects correctly. End-to-end, `uv run pytest tests/test_render_drawing.py -m nightly -q` is 21 passed, so the invocation drives real browser cases rather than only collecting them. Suite and lint on this branch: - `uv run pytest tests` — 891 passed, 6 skipped. - `uv run pytest tests/test_interact_layer.py` — 157 passed, 6 skipped (this is the module that reads `ci.yaml`; the new step declares no `working-directory`, so the gate-naming test is unaffected). - `pre-commit run --files .github/workflows/ci.yaml CLAUDE.md tests/CLAUDE.md` — passed, including actionlint's shellcheck pass over the new `run:` block. `fetch-depth: 2` on the `test` job's checkout is what gives the merge commit its base parent; the default depth of 1 has no `HEAD^1` to diff against. </details> Co-authored-by: leaf-agent <[email protected]>
The everyday suite `ci` runs on a pull request deselects every nightly-marked module, so a pull request whose whole diff is one of those modules goes green having exercised none of it. That is how #336 landed a rewrite of `tests/test_render_margin.py` and `tests/test_render_anchors.py` under a green gate and reddened `main` the moment it merged — #339 is the repair — and #338 is in the same position right now with `tests/test_render_margin.py` and `tests/test_render_navigation.py`. This names the touched modules back. A new pull-request step diffs the merge commit against its base parent, collects the `tests/test_*.py` files the diff touches, and runs them with `-m nightly`: `conftest.py` already runs what an explicit file selection names, `-m nightly` leaves a mixed module's everyday cases to the step above rather than running them twice, and pytest's exit 5 is what a pull request that touches no nightly case gets. The cost is the touched files, not the 22–41 minute nightly suite, and a pull request that touches no test module pays nothing. A change to the runtime those modules drive is still the nightly run's to catch; this reaches the modules themselves. <details><summary>Verification</summary> The step's shell was run locally against real commit ranges, with `uv run pytest` swapped for the same invocation: - `83f69563..d10463f` (#339's two nightly modules) — selects both, 155 nightly cases collected. - `ff580ecb..867c526` (touches `tests/test_render_mcp.py`, which carries no nightly mark) — selects it, `no tests ran`, exit 5 tolerated, step exits 0. - An empty range — `No test module touched.`, exit 0. - `d10463fd..83f6956` (the same diff reversed, so the range reads as deletions) — the `[ -f ]` filter drops what is not on disk and the step still selects correctly. End-to-end, `uv run pytest tests/test_render_drawing.py -m nightly -q` is 21 passed, so the invocation drives real browser cases rather than only collecting them. Suite and lint on this branch: - `uv run pytest tests` — 891 passed, 6 skipped. - `uv run pytest tests/test_interact_layer.py` — 157 passed, 6 skipped (this is the module that reads `ci.yaml`; the new step declares no `working-directory`, so the gate-naming test is unaffected). - `pre-commit run --files .github/workflows/ci.yaml CLAUDE.md tests/CLAUDE.md` — passed, including actionlint's shellcheck pass over the new `run:` block. `fetch-depth: 2` on the `test` job's checkout is what gives the merge commit its base parent; the default depth of 1 has no `HEAD^1` to diff against. </details> Co-authored-by: leaf-agent <[email protected]>
Replace the category-specific
g m 3andg h 3routes with one generated, screen-order namespace over visible Page-map targets, tabs, links, and folds. Hints use letters, extend to prefix-free two-letter codes after 26, repaint after scrolling, and remain keyboard- and screen-reader-navigable through Tab, Shift-Tab, and Enter. Stable global routes and numbered Ask choices remain unchanged.The hyperlink path includes widget-generated contents-map anchors and moves focus from hidden fragment sentinels to visible headings while preserving native fragment URLs. Browser tests cover link reveal, prefix behavior, scroll remapping, collision-free placement, document replacement, and focus and announcement behavior.