Skip to content

Give both generated-hint maps one machine - #794

Merged
max-sixty merged 4 commits into
mainfrom
unify-hint-machines
Sep 18, 2026
Merged

max-sixty merged 4 commits into
mainfrom
unify-hint-machines

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

g's map of visible page targets and s's map of addressable elements were one interaction implemented twice: arming, opaque prefix-free codes, a typed prefix that narrows, an audible Tab walk, Enter to take the one just heard, Escape to give a letter back, a scroll freeze, and a keyed chip layer — written out in full in each owner, sharing only three helpers from keyboard/hints.js before rebuilding everything above them. hints.js now owns that interaction as createHintSession, and each owner declares what its scene holds, what a chip says, what taking one does, and the words it speaks. This is TODO #26.

The session separates the two readings the old copies mixed. read answers which members the map holds and what codes name them, and is held until something invalidates it. layout answers where those members are, and runs every paint over the whole standing set from one scene reading — because a chip's place among its neighbours and its own box are the same measurement, and derived from different readings they put the chip where neither reading said.

What changes for the reader

The target chooser gains a scroll settle. scrollend does not arrive for a programmatic scroll written a frame at a time, nor for the scroll a replaced scene restores, which is why Go-to carried an 80ms timer and why the dependency survey rejects scrollend alone. The chooser had only the event, so a scroll that never ended left its hint membership frozen until the next resize.

A letter naming no hint leaves the chooser's typed prefix standing, rather than throwing away the letters the reader had already got right. Go-to has always reported the miss and kept them. Two smaller unifications come with it: the chooser now revalidates a candidate against a fresh reading before taking it, and an invalid letter no longer clears the audible walk position.

The chooser's codes survive a page change. It used to re-read the whole scene on every paint, which reassigns codes: a page change under a standing map moved a from one target to another, so the letter the reader had just read took them somewhere else. Membership is now held until something invalidates it, which is how the Go-to map has always behaved.

The geometry underneath

What the reader can see of a target, net of fixed chrome, was answered twice. clippedRect meant two different things in two files, overlaps had four copies, and fixedChromeBoxes was a second name for bottomChromeBoxes — which is why the chooser could not use keyBadgePlacement and rebuilt everything above it. That reading now has one owner, with the two answers that genuinely differ named beside each other: badgeBox starts at a member's corner and clamps it to the banner, visibleBounds cuts the bottom chrome's lanes out of its whole box.

So Go-to and the chooser still disagree about a target the shortcut bar's lane covers: Go-to keeps its route and spreads the chip clear, the chooser drops it. That is a product question about what "visible" promises rather than a difference in the geometry, and it is now one edit rather than two.

Evidence

The first two changes above are fixes to shipped behaviour, and their tests fail on the merge base.

Two further tests guard the extraction rather than fixing anything on main. Review of the session found that the first commit had broken both and the third repairs them: an open page search's mark stopped following the page when slash was pressed from the page rather than from the map, because the map's door had become the only one and a direct slash arms no map; and a chip's step past an enclosing box was measured a paint apart from the box it starts from. Both were reproduced by comparison with the merge base, where the mark tracks and the step is re-derived. Every new and changed behaviour is pinned by a test that fails when its own fix is reverted.

Complete suite green at 2721. Baseline (d2fefc94) and candidate previews of examples/ship-review.html at 1280×900, g and s armed: identical chip counts, codes, pixel seats and live-region text, and no console errors on either side.

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

max-sixty and others added 4 commits September 18, 2026 02:53
`g`'s map of visible page targets and `s`'s map of addressable elements were one
interaction implemented twice — arming, codes, a typed prefix, an audible walk, a
scroll freeze and a keyed chip layer, written out in full in each owner and sharing
only three helpers. `keyboard/hints.js` now owns that interaction as a session, and
each owner declares what its scene holds, what a chip says, what taking one does, and
the words it speaks.

Two defects the duplication kept apart:

- The target chooser had no scroll settle. `scrollend` does not arrive for a
  programmatic scroll written a frame at a time, nor for the scroll a replaced scene
  restores, which is why Go-to carried an 80ms timer and why the dependency survey
  rejects `scrollend` alone. The chooser had only the event, so a scroll that never
  ended left its hint membership frozen until the next resize.
- A letter naming no hint reset the chooser's typed prefix, throwing away the letters
  the reader had already got right. Go-to reports the miss and keeps them.

Underneath both, what the reader can see of a target net of fixed chrome was answered
twice. `clippedRect` meant two different things in two files, `overlaps` three, and
`fixedChromeBoxes` was a second name for `bottomChromeBoxes` — which is why the chooser
could not use `keyBadgePlacement` and rebuilt everything above it. That reading now has
one owner, with the two answers that genuinely differ named beside each other:
`badgeBox` starts at a member's corner and clamps it to the banner, `visibleBounds`
cuts the bottom chrome's lanes out of its whole box.

So Go-to and the chooser still disagree about a target the shortcut bar's lane covers:
Go-to keeps its route and spreads the chip clear, the chooser drops it. That is a
product question about what "visible" promises, and it is now one edit rather than two.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Review of the session extraction found two defects in it.

A chip enclosed by another steps right once per box around it, and that step was
derived when the map's membership was read while the box it starts from was measured
at paint. Between the two the page can move: the enclosing box stops enclosing, and
the chip lands where neither reading said. The session now asks the caller to lay out
the whole standing set once per paint from one reading, so membership answers which
members the map holds and what names them, and layout answers where they are. The
arm-time re-read this replaces is gone with it.

An open page search's mark repainted on scroll only while a target map was armed.
The map's own door was the only one left, and a slash pressed from the page arms no
map, so the mark sat over unrelated words until any other key asked for a frame.
Search now asks for its own.

Also from the review: replacing the map no longer ends a scroll the page has not
ended, which is arming and disarming's answer to give; `invalidate` replaces
`refresh` where the caller has nothing to say about the result and was discarding an
expensive reading; a fourth copy of `overlaps` in `chrome-layout.js` is gone; and
`followsScroll` states the cost that decides it rather than that its caller said so.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@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.

test_an_open_search_mark_follows_the_page_it_marks passes on the merge base, so the search-mark defect the Evidence section reports as reproduced there is one this branch introduced and then fixed within itself.

On f249da60, target-chooser.js's own scroll listener gated on chooserOpen, and openPageSearch sets that true through setTargetChooser(true, false, false) before opening search — so a slash pressed from the page already repainted the mark on scroll. The first commit replaced that listener with the hint session's, which gates on armed, and a direct slash arms no session; the third commit restores the behaviour as followMatch. The nesting, no-scrollend and missed-letter tests do fail on the base, so only this one of the four is affected.

Worth correcting because the description is main's commit message for this change: as written, history records a within-PR regression as a pre-existing bug the PR fixes.

How this was checked

The four new and changed test functions were applied to a worktree at f249da60 and run there:

FAILED test_a_scroll_with_no_scrollend_still_refreshes_the_target_map
FAILED test_a_nested_target_restates_its_indent_when_the_nesting_changes
FAILED test_a_letter_naming_no_target_leaves_the_hints_standing
1 failed, 1 passed  (test_an_open_search_mark_follows_the_page_it_marks passed)

Everything else in the review selection is green on this head: test_render_semantic_selection.py (33), test_render_navigation.py and test_render_controls.py (229), test_render_options.py and test_render_margin.py (157 passed, 1 failed). That one failure, test_a_reflow_that_moves_a_marker_carries_its_open_card[1920], fails the same way on f249da60 and is unrelated to this diff.

@max-sixty

Copy link
Copy Markdown
Owner Author

Correct, and the description is fixed. Both defects the review pass found — the search mark's door and the seat measured a paint apart from its box — are regressions this branch's first commit introduced and its third repairs; neither exists on main. The description now says so, and separates them from the two changes that are fixes to shipped behaviour.

Checking your nesting observation turned up a third shipped behaviour change I had not declared, so thank you for it. test_a_nested_target_restates_its_indent_when_the_nesting_changes does fail on the base, but not because the base has the seat defect — the base re-reads the whole scene on every paint, which reassigns codes. Measured on the same fixture, a page change under a standing map moves a from the outer target to the inner one on f249da60 and leaves it where it was on this branch. So the base renamed the routes under the reader, and holding membership until something invalidates it is what stops that. It is now in the description as its own change.

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

@max-sixty
max-sixty merged commit fb5d9ee into main Sep 18, 2026
5 checks passed
@max-sixty
max-sixty deleted the unify-hint-machines branch September 18, 2026 11:07
max-sixty added a commit that referenced this pull request Sep 18, 2026
…or a page in motion (#805)

`g`'s map of visible page targets and `s`'s map of addressable elements
run over one session since #794, but each still answered two questions
for itself, and on both the two disagreed. This gives each question one
answer. The Stage note that landed on main today — that the suite is
overfit and a test is part of a code change — is what this is: three
tests moved, and the behaviour each was holding is named below.

## What the reader can see

The chooser reserved each piece of bottom chrome's whole lane, from the
blocker's top down to the window's foot, before admitting a member. That
took the letter off anything standing in the strip of page below the
shortcut bar. A blocker is its own rectangle now, so the strip is page
again.

Read the other way, the chooser asked only whether *chrome* stood at a
member's corner, so an ordinary page box covering a member whole still
left it holding a letter. Measured on a paragraph behind an opaque
sheet: the chooser offered a route to a block the reader could not see,
and taking it would have opened a comment on it. Go-to has always
required the member itself to answer. That hit test has one owner now,
`exposes`, and both maps ask it.

What the two readings are for is the difference that remains, and it is
about what the measured thing can do when chrome lands on it rather than
about which map asks. A member's box keeps the chrome at the foot in it,
deliberately: that chrome is raised by the very interaction whose
membership it would be deciding — the bar states the armed map's own
keys and changes width as the reader filters them — so a map that read
it would lose members as it armed and swap codes under the reader as its
own legend grew.
`test_a_transient_notice_does_not_move_generated_address_hints` is where
that lands, and it caught the first attempt at this. A chip that would
land on the bar is moved clear instead, which keeps the route where
dropping the member loses it. A search mark is drawn where it stands and
cannot be moved somewhere legible, so `clearPart` alone subtracts that
chrome and hands back the largest part left.

`exposes` asks in the middle of a box the member actually paints rather
than the middle of its bounds, because those are not the same box for a
`display: contents` member: its bounds are the union of its children's,
and the space between two of them belongs to whatever stands behind.

## A page in motion

The two maps also behaved differently while the page moved, under a flag
whose stated reason — that the Go-to map is too big to lay out per frame
— was never measured and is not true. The map is bounded by one
viewport: 18 members on a page of 120 links, and following costs some
three hundred hit tests across a whole smooth scroll.

Both maps now paint through a scroll once they have stood still long
enough to be read, so the codes the reader is reading stay on the things
they name — to the pixel, every frame of the way — and stay pressable.
Membership still waits for the scene to settle, so withholding bought
nothing — the codes are just as frozen either way, and blanking them
only takes them off the screen they are being read from. Measured per
frame: withholding blanks every chip after two frames and leaves them
gone for ninety; following keeps them riding, draining one by one as
their members leave the screen.

A map armed into a page already in flight keeps its own answer: it has
stood still for nobody, so it shows nothing until the scene settles
rather than putting codes on a scene that is leaving
(`test_inflight_native_paging_hides_hints_until_the_scene_settles`).
Arming cannot see that the page is moving, a scroll being heard only
while armed, so the map waits out one settle before it counts as stood.
Both behaviours now fall out of that one piece of state.

## Evidence

Three new tests, each verified to go red when its own fix is reverted.
Two of them fail on `fb5d9ee0`; the third — a `display: contents` member
read where it paints — passes there and guards the extraction instead,
`main` getting that case right by probing the corner where a unified
centre probe would not, so it was verified against the intermediate that
broke it.

Complete suite green at 2726 before integrating main, and both hint
files green at 176 after. Note that the `test` check does not cover any
of the three: all live in `pytest.mark.nightly` modules, which `ci.yaml`
skips on pull requests, so main's push run is the first CI to reach
them.

Two review passes each caught a comment stating something the code does
not do. The first claimed the hit test catches the shortcut bar; the bar
is `pointer-events: none` and can never answer one, which is what moved
the design from deleting the chrome subtraction to correcting the lane.
The second claimed a chip only roughly tracks its target through a
scroll, on the strength of a probe that read inside a
`requestAnimationFrame` callback registered a frame earlier and so ran
ahead of the runtime's repaint, comparing the last frame's chip against
this frame's target. The deviation was one frame's travel of
measurement, and the tolerance built to absorb it made the test red on
CI's headless shell, where a smooth scroll peaks at 62px per frame. Read
after the frame's own callbacks, the chip holds its resting offset
exactly.

Matched previews of `examples/ship-review.html` at 1280×900 with `g` and
`s` armed: same members, same codes, no chip fouling the bar, none
piled, none off screen, no console errors either side. The `s` chips
move, because a parent whose box the lane used to cut short now measures
whole and so genuinely encloses its children. That exposed a weakness
this does not fix: the indent step is half a chip wide, so one level of
nesting does not clear the parent's chip and the placement pass then
drops it onto the member's own first line. Widening the step only trades
the row's state icon for its first word — measured, not assumed. There
is a TODO at `enclosedBy` proposing the left margin, where a top-level
member's chip already sits.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <[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