Repository navigation
Read the pointer where the browser dispatched the press from - #48
Conversation
|
Same test, same page, same pair of items, and the rest of the suite green (1 failed, 1243 passed) — consistent with the seam diagnosis in the PR body rather than anything the design-mode move touched. That makes five consecutive red commits on No action needed here; recording the recurrence so the run isn't diagnosed a second time. |
|
Two further commits carry the same single failure — run 32992750676 on 442677a and run 32992796142 on e897769 — each Worth recording because those commits are the runtime refactor moving code out of |
|
A fifth commit carries it — run 32993716700 on 1444a2f ("Move the selection composer into its runtime owner"), again The reason for saying so rather than just adding a tally row: the four commits since this PR's base are a refactor series moving code out of |
leaf-agent
left a comment
There was a problem hiding this comment.
Reviewed the diff and the pointer path around it. The fix reads correct to me: every consumer of the pointer record asks a hit-test question — aimedItem's elementFromPoint, design mode's designTarget(document.elementFromPoint(...)), refreshHover's markAt — so fixing the recorder rather than the press is the right depth, and it leaves an ⌥-press taking the same item an ordinary click at that spot would. ci is green on this head including --run-nightly, so the corpus assertion that has been red on main passes here. Commenting rather than approving because GitHub rejects self-approval.
On the drift the tally comments above raise: the refactor series has not reached either hunk. main's current head 8c7ee7b still has both recorders where this patch edits them — document.addEventListener("mousemove", ...) in leaf.js and in runtime/anchors.js — and GitHub reports the PR MERGEABLE, so the patch still lands on the live listeners rather than on a copy left behind.
One behaviour the description doesn't name: pointermove fires in gestures where mousemove was suppressed. Cancelling a pointerdown takes the compatibility mouse events with it, and the panel-edge resize handle does exactly that on purpose (event.preventDefault() then setPointerCapture, under "Refusing the press stops the compatibility mouse events") — so the recorder and refreshHover were silent for the length of an edge drag and now run on every move of one, as they now also do for touch and pen. I could not build a defect out of it: the handle keeps the boundary under the grab point, so markAt lands on the handle rather than on prose, and refreshHover is rAF-coalesced and returns early where the page has no marks. The one place it opens is past the width clamp, where the handle stops tracking while the pointer keeps going and a mark under it would light up mid-resize. If that ever shows, a data-lf-sizing guard in refreshHover is the cheap answer; worth a look during a sweep rather than a change here.
Two small things, neither worth a CI round on its own — happy to push both together if you want them:
AIM_SEAMstraddles the seam as advertised only while the seam's fractional part is under 0.5.y = (hi + Math.floor(hi) + 0.5) / 2sits above the seam in that case, but at 0.5 or above it sits below it, so the two readings come back swapped rather than equal — and the guard's message ("the aim point and the whole pixel it rounds to are on the same item") describes the other failure. The fixture'stop: 300.3pxpins the fraction near .297 and the comment is right that it holds there on every machine, so this is about what a drift would print, not about the fixture.test_a_scroll_under_a_held_aim_moves_the_promise_with_the_page's docstring still opens "Only the mousemove used to re-ask the aim". That is the same history-sentence shape aspassages.js's "rebuilt per candidate ancestor per mousemove", which this diff did update to "per pointer move". Outside the diff, so no inline suggestion.
leaf-agent
left a comment
There was a problem hiding this comment.
The generalisation holds. AIM_SEAM's point is the midpoint of the seam and the whole-pixel boundary rounding turns at, so it is on the opposite side of the seam from its rounded twin in both directions, and reading the promised item off at rather than naming it is the right shape. I checked the swap the commit message claims rather than taking it: at top: 300.3px the reading is {at: seam-lower, rounded: seam-upper}, at top: 300.7px it is {at: seam-upper, rounded: seam-lower}, and both pass the new assertion where the old one would have failed the second on readings that were still disagreeing. The docstring's other repair is right too — test_a_scroll_under_a_held_aim_moves_the_promise_with_the_page no longer says mousemove.
Two numbers the prose states, though, and neither is what the fixture produces. Both are inline suggestions; neither is worth holding this behind, given main has now carried the failing assertion for six commits — apply them at merge or drop them.
Measured in a headless Chromium on this fixture, the browser's hit test stops answering seam-upper at 319.3125, which is 0.98px above that box's own bottom edge (320.296875) — the AIM_SEAM comment already anticipates that ("a box's hit region is not always its border box"), so nothing is wrong there. But it means the point the search returns is y = 319.40625: 0.094px past the seam, sitting at .41 of its pixel. So "a third of a pixel from a seam" overstates the gap by four times, and "resting in the first third of that pixel" names a region that is mostly over the upper item, not the lower one. The construction bounds the gap at a quarter pixel in general — y is the midpoint of the seam and a boundary at most 0.5 away — so no fixture fraction makes "a third" reachable.
How the numbers were taken
Standalone Chromium (chromium.launch()), the fixture's own markup and stylesheet, running AIM_SEAM's search verbatim:
top |
box bottom | hit-test seam | fraction | y |
at |
rounded |
|---|---|---|---|---|---|---|
300.3px |
320.296875 | 319.3125 | .3125 | 319.40625 | seam-lower |
seam-upper |
300.7px |
320.6875 | 319.7031 | .7031 | 319.60156 | seam-upper |
seam-lower |
Stable across device_scale_factor 1 / 1.5 / 2 / 3 and across serif, sans-serif and monospace at 11/13/16/20px — so the fixture comment's claim that the fraction does not come from the fonts holds, and the .31 is the stylesheet's number to within a LayoutUnit.
Commenting rather than approving because GitHub rejects self-approval. lint is green on this head; test is still running.
|
This run's failure is already fixed on Run 32997377871 on 0acb4de is the same assertion again ( What that leaves for this PR is the narrower half of its own diagnosis rather than the CI fix: Verificationat |
|
Answering the question the last comment left open — whether the recorder half is worth a change on its own now that a2318a1 has closed red That is the shape of what a2318a1 left. Taking the press from The two changes compose rather than compete: on that merge, The two review nits are in as 2fd1d62: The probeA worktree at Recorders restored, same tree: Not pushed — the branch is left based on 0ec78ba. |
The aim's outline and the press it promises are two readings of one question, and they came from different doors: the outline hit-tests the pointer record the runtime keeps, while the press takes the target the browser resolved for it. That record was kept from `mousemove`, whose clientX and clientY are rounded to whole pixels — so within a pixel of a seam the two name different items, and the reader is shown an outline on one item and gets a composer anchored to the next. It surfaced on design-decision.html, where a wider address column moved the choose group's centre point 0.8px inside a cell boundary: ⌥ over the group outlined opt-jwt and the press commented on opt-redis. The pointer events carry the position they were rounded from, so the record comes off `pointermove` and every consumer of it — the aim, the cursor's half of the same promise, the hover reading, design mode's target — asks about where the pointer is. The corpus case reaches this only while a seam happens to lie under a group's centre. test_the_aim_reads_the_pointer_where_the_press_is_dispatched_from holds a seam there on purpose: a fixed box puts one between two whole pixels, and the aim lands a third of a pixel past it, where the true point and its rounded twin name different items. Both are asserted before the gesture, so a seam that drifted onto a whole pixel fails the test rather than leaving it proving that two agreeing readings agree.
AIM_SEAM's point straddles the seam in both directions — it is halfway
between the seam and the whole pixel rounding turns at, so under a
fraction of .5 the true point is over the lower item and its rounded twin
over the upper one, and from .5 up the two swap. The test named the first
of those, so a fixture that drifted past .5 would have failed on readings
that were still disagreeing, under a message reporting the opposite
("on the same item"). It reads the promised item off the point instead
and requires the pair to differ, which is the property the test is for;
the guard message names the one thing that would end it, a seam landing
on a whole pixel.
Verified both directions: with the fixture at top: 300.7px the reading
comes back {at: seam-upper, rounded: seam-lower} and the test passes,
where the old assertion would have failed. Bug-back with the recorder
reverted to mousemove still fails at the promise.
Also updates a history sentence in the scroll test's docstring that
still said mousemove, the same shape as the passages.js comment the
first commit updated.
The seam test's two prose numbers describe a fixture that does not produce them. Measured in headless Chromium on this fixture, the browser's hit test stops answering the upper item at 319.3125 — .31 of the pixel, and 0.98px above that box's own bottom edge, which is the hit-region slack `AIM_SEAM` is searched rather than computed for. The point the search returns is 319.40625, 0.094px past the seam. So "a third of a pixel from a seam" overstates the gap four times, and the construction bounds it at a quarter pixel for any fixture: the point is the midpoint of the seam and a whole-pixel boundary at most 0.5 away. And "resting in the first third of that pixel" names a region mostly over the upper item, since the seam falls past it at .31.
2fd1d62 to
a0c44fc
Compare
leaf-agent
left a comment
There was a problem hiding this comment.
Re-reviewed in full after the rebase — the force-push moved the branch onto 67e3c78, so LAST_REVIEW_SHA names a commit that no longer exists. The two nits from the last round are in as applied, verbatim on the second one, and I've resolved both threads. The premise measures out independently: on this box a pointermove at 100.5, 200.3125 arrives with those numbers and the mousemove beside it arrives at 100, 200, so fixing the recorder rather than each reader is the right depth and the test is holding the right thing.
Two things the change opens that aren't in the body, both outside the diff — neither is worth holding this behind, and I'm happy to push either or both if you want them.
The click's markAt is still asking at the rounded point. refreshHover now reads the true point (markAt(pointer.x, pointer.y)), but the document click listener in leaf.js — the one under if (designOn), const threadId = markAt(ev.clientX, ev.clientY) — takes the event's own coordinates, and a click is a legacy mouse event, so those are the rounded ones. markAt compares against getClientRects(), whose top/bottom are floats, so the two readings can now differ by up to half a pixel at a mark's rect edge where before this change they were both rounded and could not. That is the same disagreement this PR removes from the aim, newly opened one surface over: lf-over-mark is described at its own line as "the promise that a press here opens something", and paintHover lights the reciprocal card in the panel, so the shape is a quote that lights up under the hand and a click on it that opens nothing. It isn't a one-line swap — that handler has no ev.detail guard, so a keyboard-synthesized click arrives with clientX === 0, and reading pointer there would open the thread under a parked pointer on an Enter press.
A stationary tap fires mousemove but no pointermove. Measured rather than reasoned from the spec: a touch tap in Chromium is pointerdown → mousemove → mousedown → click, with no pointermove anywhere in it. So on a touchscreen the record a tap used to update is now not updated at all. It is not a regression for the ⌥ press — the compat mousemove lands after pointerdown, so aimedItem() at claimPress was already reading a stale record there — but the refreshHover() and refreshAim() that tap used to drive are gone with it: design mode's outline no longer follows a tap onto the element it is about to open on (the press itself still lands, through designTarget(ev.target)), and the hover paint stops answering. Nothing in the suite covers touch — PHONE in test_site.py is a viewport with no has_touch — so this is invisible either way. If it is worth closing, pointerdown is the door, and the same probe says it carries the true fractional point on touch (150.5, 170.5 for a tap dispatched there), so recording from it would be right about the position as well as present for the gesture.
Commenting rather than approving because GitHub rejects self-approval. lint is green on this head; test is still running.
How the two sequences were taken
Playwright's pinned headless Chromium, listeners at document, printing type clientX,clientY:
context(has_touch=True, is_mobile=True); touchscreen.tap(150.5, 170.5)
['pointerdown 150.5,170.5', 'mousemove 151,171', 'mousedown 151,171', 'click 151,171']
mouse.move(100.5, 200.3125)
['pointermove 100.5,200.3125', 'mousemove 100,200']
The first line is the one that matters for the touch note — pointerdown carries the fraction, the compat mousemove rounds it and arrives after, and no pointermove is dispatched for a tap that doesn't move. The second is the PR's own premise, re-measured.
refreshHover now reads the pointer record at the true point, but the document click listener still asked markAt with its own clientX and clientY. A click is a legacy mouse event, so those arrive rounded to a whole pixel, while markAt measures against getClientRects, whose edges are floats — so within a pixel of a mark's edge the hover lit one thread's quote and the press on it opened its neighbour's conversation. That is the disagreement this branch removes from the aim, left standing one surface over. The click reads the record instead. A click carrying no press — offer's click() supplying the keys a span doesn't come with — carries 0,0 rather than a position, and the record would answer for wherever the pointer is parked, so that one keeps reading the event. The test reuses the seam fixture with a comment on each item either side of it, so the disagreement is a pair of cards rather than a hit and a miss: it asserts which thread the press opened against the one the hover had just promised. Without the fix it fails with the hover on seam-lower and the press opening the seam-upper thread.
|
Actioned the first of the two things the last review raised, since both are opened by this change rather than merely near it. The click surface is in as 3192ce5 with a gate; the touch one I'd leave, and the reason is a correction to what that review said the door was. The click's The touch door is narrower than that review claimed. VerificationWith the
|
leaf-agent
left a comment
There was a problem hiding this comment.
The click surface is the right place to close this, and the new test holds the right pair — the hover's promise and the press asserted against each other, with the expected card read off the point rather than named. I checked the claim rather than taking it: with the leaf.js hunk reverted and the test kept, it fails with the hover on seam-lower and the press opening the seam-upper thread.
One finding on this commit, and it is the touch door — but not the one the comment above argues about. Reading the record instead of the event's own coordinates makes a tap on a quote open no thread at all.
Measured in Playwright's Chromium, listeners at document:
tap pointerdown 150.5,170.5 detail=0 | mousemove 151,171 detail=0 | mousedown 151,171 detail=1 | mouseup detail=1 | click 151,171 detail=1
mouse pointermove 100.5,200.3125 | mousemove 100,200 | pointerdown 100.5,200.3125 | mousedown 100,200 | click 100,200 detail=1
A tap's click carries detail=1, so it takes the markAt(pointer.x, pointer.y) branch — and no pointermove is dispatched anywhere in a tap, so the record it reads is still { x: -1, y: -1 } unless a mouse moved earlier in the session. markAt(-1, -1) asks elementFromPoint, gets null, and pageWords(null) is Boolean(null) && … — so the handler falls through to the visual/fab path and nothing opens.
End-to-end on this head: AIM_SEAM_PAGE with a comment on each item, opened in a has_touch=True context, tapped at the seam.
AssertionError: tap at {'x': 150.5, 'y': 319.40624237061365, 'at': 'seam-lower', 'rounded': 'seam-upper'} opened no thread
assert None
With this commit's leaf.js hunk reverted, the same tap opens a thread (seam-upper — the rounded reading, but a conversation rather than silence). So before this commit a tap on a quote opened its conversation; after it, a tap on a quote does nothing, and opening a thread from its own quote is the tap's only route to it from the page side. That is wider than "the hover paint under a stationary tap, on a surface with no hover".
It also looks like a depth question rather than a reader-side one. Every other consumer of the record either guards the stale value — aimedItem's if (pointer.x < 0) return null, aimTarget's designIsOn() && pointer.x >= 0 — or has null as its right answer (refreshHover paints no hover). The click has neither: there, null means "no thread here" while a thread is under the finger. And a pointer.x >= 0 guard on the reader would not close it, because on a hybrid device the record is a live mouse position, so a tap would open whatever the mouse was last parked over — a wrong thread instead of none.
The recorder is where it closes. Adding pointerdown to the anchors recorder passes both the touch probe above and this commit's own new test, in that tree:
for (const type of ["pointermove", "pointerdown"])
document.addEventListener(type, (ev) => {
pointer.x = ev.clientX;
pointer.y = ev.clientY;
refreshHover();
});pointerdown carries the true fractional point on touch (150.5,170.5 above), so it is right about the position as well as present for the gesture, and the capture-order objection doesn't reach this surface: claimPress returns at if (!aimedPress) return; before any stopPropagation when it claims nothing, so an unclaimed tap reaches a bubble listener whenever it registers. The presses it does claim are ⌥ and design mode, and the design branch of this handler reads ev.target rather than the record. The one judgement call in it is whether refreshHover() should run on pointerdown on a surface with no hover; recording without it for that event is the narrower version, and it still fixes the tap.
Happy to push it, with a has_touch gate for the tap so the suite holds the case — the corpus has no touch context today, which is why this is invisible to ci either way.
Commenting rather than approving because GitHub rejects self-approval. lint is green on this head; test is still running.
How the two probes were taken
Event sequences, standalone Chromium (chromium.launch()), capture listeners on document printing type clientX,clientY detail:
context(has_touch=True, is_mobile=True); touchscreen.tap(150.5, 170.5)
['pointerdown 150.5,170.5 detail=0', 'mousemove 151,171 detail=0', 'mousedown 151,171 detail=1', 'mouseup 151,171 detail=1', 'click 151,171 detail=1']
mouse.move(100.5, 200.3125); mouse.click(100.5, 200.3125)
['pointermove 100.5,200.3125 detail=0', 'mousemove 100,200 detail=0', 'pointerdown 100.5,200.3125 detail=0', 'mousedown 100,200 detail=1', 'mouseup 100,200 detail=1', 'click 100,200 detail=1']
The end-to-end probe is this commit's own fixture and comments, driven through the repo's serve/open_page harness with browser.new_context(has_touch=True) and page.touchscreen.tap(seam["x"], seam["y"]), asserting document.activeElement?.closest('.lf-thread'). On this head it fails as quoted; with the leaf.js hunk reverted it passes; with the hunk kept and pointerdown added to the anchors recorder, it passes alongside test_a_press_on_a_mark_opens_the_thread_the_hover_promised (2 passed).
Nothing else in the incremental drew a finding: showThread focuses synchronously inside the click handler, so reading document.activeElement straight after mouse.click is an ordering the page has already made rather than a race, and the !ev.detail guard matches the idiom claimPress already uses for the same synthesized-click case.
|
One case, A |
The click reads the pointer record now, and a tap dispatches no
pointermove: pointerdown, then the compatibility mouse events and a click
carrying detail=1. So under a finger the record was still {-1, -1}, the
click's markAt asked elementFromPoint about a point off the page, and a
tap on a quote opened no thread at all where before it opened one.
The recorder is where that closes rather than the reader. Every other
consumer either guards the start value (aimedItem, aimTarget) or has null
as its right answer (refreshHover paints no hover); the click has
neither, and null there means "no thread here" while a thread is under
the finger. A pointer.x >= 0 guard on the reader would not close it
either — on a hybrid device the record is a live mouse position, so a tap
would open whatever the mouse was last parked over.
A tap's pointerdown carries the true fractional point, so the finger gets
the reading the mouse gets rather than the rounded one its own click
would have given. No hover refresh on that event: a mouse has already
moved to the point and refreshed there, and there is no hover to paint
under a finger.
The test taps the seam fixture in a has_touch context — the only way to
get a gesture with no pointermove in it — with a comment on each item, so
a wrong reading is a visible thread rather than a miss. Without the
recorder it fails with the tap opening nothing.
main moved the aim and the click surface out of leaf.js into runtime/composing/aim.js and runtime/composing/surface.js while this branch was changing both. The two hunks move with them: the aim's recorder reads `pointermove` in aim.js, and the click asks markAt at the record in surface.js, which takes `pointerAt` for it the way createAim already does.
|
The touch door is in, at the recorder the last review named, and the branch is merged with The tap. I reproduced the finding before changing anything: the review's probe, written as this PR's own test, fails on 3192ce5 with The test taps the seam fixture in a The merge. One thing on this head is not mine: VerificationBoth hunks reverted one at a time on the merged tree, to check each is load-bearing: On the merged tree as pushed: That one is The one failure is main's |
leaf-agent
left a comment
There was a problem hiding this comment.
The recorder is the right depth and the test holds the right thing. I checked the commit's own claim rather than taking it: with the anchors.js hunk reverted and the test kept, test_a_tap_on_a_quote_opens_its_thread fails with a tap on the quote for seam-lower opened: None, and the whole of test_render_anchors.py is green with the hunk in (53 passed, under xdist).
One finding, and it is about the sentence that justifies leaving refreshHover() off this event rather than about leaving it off. The record still reaches the hover reader — one gesture later, through pageShifted. refreshHover reads pointer.x/y, and pageShifted calls it on every scroll, resize and paintAnchors. Measured on LONG_PAGE in a has_touch context: tap 200px below a marked passage, then scroll that passage under the point the finger touched, and body.lf-over-mark is true with lf-mark-hover at size 1 — a quote lit as indicated, and its card lit in the panel, with nothing resting on either. With this hunk reverted the same sequence leaves both empty.
It is not a regression, though, and that is what decides how much it is worth. A touch drag already painted the same wash before this commit, because a drag does dispatch pointermove until the browser cancels it — I put a finger down on the mark and moved it four pixels, and the wash came up on the reverted tree exactly as it does here. So pointerdown is the only statement of the pointer's place for a tap, not on touch generally, and "there is no hover to paint under a finger" is a description of the finger rather than of what the layer paints. The hole predates the recorder; what this commit changes is that a tap reaches it too.
That splits into two things, and only the first is this PR's:
- The two claims in the comment, which the inline suggestion corrects.
- A hover that paints where no pointer rests, which is its own change: the record answers "where the pointer is resting" for
refreshHoverandaimTargetand "where the press landed" for the click, and on touch those have come apart. Carrying whether the recorded point is one a pointer is over — set by both recorders offev.pointerType— and havingrefreshHoverclear rather than paint when it is not, closes it for the drag as well as the tap. Happy to push that separately; it wants its own test and shouldn't ride on the red-mainfix.
Commenting rather than approving because GitHub rejects self-approval. lint is green on this head; test is still running, and the comment above expects it to carry main's test_the_ancestor_exclusions_ask_for_a_marker_and_not_a_tag — #51 is closed unmerged, and main's own ci on dc0d949 and b68ce37 hasn't finished, so I can't confirm that from here either way.
How the two probes were taken
Both through the repo's own serve/open_page harness on this head, LONG_PAGE, one comment anchored to p30, browser.new_context(..., has_touch=True), reading document.body.classList.contains('lf-over-mark') and CSS.highlights.get('lf-mark-hover')?.size.
Tap, then scroll the mark under it. p30 scrolled to centre, mark at 279.7, 460.7; page.touchscreen.tap(279.7, 660.7); document.body.scrollBy({top: -200, behavior: 'instant'}).
| tree | after tap | after scroll |
|---|---|---|
| this head | {over: false, hover: 0} |
{over: true, hover: 1} |
pointerdown recorder removed |
{over: false, hover: 0} |
{over: false, hover: 0} |
Touch drag onto the mark, via CDP Input.dispatchTouchEvent (Playwright's touchscreen has only tap): touchStart at the mark, four touchMoves 1–4px below it. Capture listeners on document saw
pointerdown 279.7,520.7 | pointermove 279.7,505.7 | pointermove 279.7,490.7 | pointercancel
for the longer drag — the pointermoves are why this path needs no pointerdown recorder — and the short drag onto the mark reported {over: true, hover: 1} mid-drag and after the lift on both trees.
Nothing else in the incremental drew a finding. claimPress is at capture on document and stopPropagations only a press it claims, so the ⌥ and design presses never reach this bubble listener — and they don't need to, reading aimedItem() and ev.target at capture instead. Nothing else in the layer stops pointerdown propagation. The test's read of document.activeElement straight after the tap held over eight consecutive runs and one full-file xdist run.
|
Correction to my last comment: |
The comment claimed `pointerdown` is the only statement of the pointer's place on touch, and that there is no hover to paint under a finger. A drag dispatches `pointermove` until the browser cancels it, so the first holds for a tap rather than for touch; and `refreshHover` reads the record on every `pageShifted`, so the layer does paint a hover from it — a hole the drag already reached before this recorder existed. Comment only.
…rt (#2531) A widget bound to a data source no longer fails a second time when it leaves the page and comes back. Before this change, a bound lf-diff, lf-text-document or lf-visual-review whose source had failed to render failed again on every return and logged a second console error. This is review item #48 from the Lit survey follow-up, numbered in that review rather than as a GitHub issue. ## Behaviour that changed - **`watchData` (data.js).** Previously, when a subscriber returned, it was sent the newest snapshot even when that snapshot was the one already painted. Now it is sent one only when the source reading changed while it was away, or when it left while its paint's promise was still running. The resend existed because widgets drop unfinished paints when they leave: lf-text-document and bound lf-diff both bump a rendering counter on departure. That one case is now stated exactly. A paint that finished, including one that failed, stays as it is. - **`clocked` (presence.js) gains `resume()`.** When a widget leaves, data.js stops its paint's clock subscription. With no repaint on return, nothing would put that subscription back, so `resume()` returns the kept painting's time readings to the shared clock. The next tick repaints any reading that has aged, such as "2h ago". - **Two examples depended on the old resend:** - lf-pr-brief built a new `clocked` paint on every connection, and only the data callback ever painted it. After a return, its "Observed …" age stopped updating. It now keeps one paint for its lifetime, stopped when it leaves and resumed when it returns. - lf-atlas-tree re-armed its held reading only through the resend. When it returns holding a newer reading, it now arms that reading itself. - **`module-authoring.md`** now states the return rule and the stop/resume pairing for `clocked`. Because data.js learns that a paint is unfinished only from the promise its callback returns, the guide tells authors to return the promise of any paint that finishes later. It also says that a `whileConnected` start must restore whatever its cleanup cleared, since a return no longer repaints unchanged data. No current bound widget defers its content paint without returning that promise. lf-visual-review and lf-trace defer only layout, which their size observers schedule again when they return. ## Kept lf-diff's inline-patch `settled` guard from #2503 stays. It applies only to an inline patch, which is not a data delivery, so data.js never sees it. It is the same rule enforced at a second boundary, not a copy of data.js's. The other bound widgets have no local guard against the resend. The cleanup in lf-text-document and lf-diff that drops a paint on departure is what the new rule depends on. lf-trace's redraw on return is for its own closed picture. ## Measured | Item | Hand-written source (excl. tests, Markdown, generated corpus copies) | Tests | |---|---|---| | #48 | +36 / −13 (net +23) | +77 / −13 (net +64) | ## Validation - **Bound diff.** The #2503 lf-diff return test is now parametrized over inline and bound patches. Its bound case reported the error twice on `main` and passes here. - **New data.js test.** `test_a_returning_subscriber_is_repainted_only_where_its_departure_cut_the_paint` checks that a widget is repainted after leaving mid-paint and not after leaving with a finished paint. It fails on `main`. - **Owner-lifecycle test.** It now expects no resend of an unchanged reading, and a clock tick after the widget returns. With `resume()` removed, the tick assertion fails. - **PR brief clock test.** It now also runs after the brief leaves and returns. With the old example widget, that case fails. - **Focused runs, all passing:** diff controls; the data-subscription startup tests; visual review; text document; call-diff; atlas; PR brief; live widget subscription; four trace lifecycle tests. Pre-commit passes on the changed files. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
An attribute that names one of the layer's words, such as `lf-column`'s
`tone` or `lf-code`'s `language`, now carries those words as a standard
JSON Schema `enum` in the vocabulary a page composes. Before this, its
schema said only `{"type": "string"}`. The words lived under `$tones`
and `$languages`, so an agent reading the entry went looking for them.
Claude Code reads `page/registry.json` directly, never `page
instructions`, and spent a model call on that lookup in most replies.
Composing the vocabulary (`registry.layer.stamp_composition`, at `page
init` and over a page's own declarations) now writes each list into the
attribute's `enum`. That is `registry.contract.stamp_words`, beside
`$decisions` and `$states`. Source registries still declare only
`x-tone` or `x-language`, so a new tag that takes a tone still needs
only that key, and the lists stay the one home of the words.
That leaves one mechanism where there were three:
- **Validation** reads the `enum` through the attribute schema it
already checks. The separate `DECLARED_WORDS` pass and its
`unknown-word` finding are deleted. An unknown tone now reads `'success'
is not one of ['ok', 'warn', 'danger']`.
- **`page instructions --use`** lists the words of every attribute whose
schema has an `enum`, read from the schema. That replaces #3690's
listing from the layer's lists.
- **Composition** stamps before it validates the examples, so examples
are checked against the vocabulary as pages read it.
This bumps the page protocol from 21 to 22. No page runtime reads the
property schemas, but a page vendored before this change carries a
registry without the `enum`. A Leaf at the same number would then stop
checking that page's tones and languages. The bump has the session
holding such a page re-vendor it on its first command, and the stamped
registry checks again.
Measured with Claude Code waiting journeys, side by side on this
branch's base `7c0aa359f` and on the change, 7 completed runs per arm:
| | Before | After |
|---|---|---|
| Registry lookup calls per reply, mean | 2.14 | 0.43 |
| Replies that looked up the tones | 6 of 7 | 2 of 7 |
| Model calls per reply, mean | 5.43 | 3.86 |
| Whole reply, median | 26.4 s | 18.9 s |
| Generation, median | 17.9 s | 13.0 s |
The whole-reply drop is within the run-to-run spread at this sample
size. The lookup is gone from most replies, and removing that lookup was
the point. One Codex App Server journey and one Pi journey were also run
to spot-check that both still see the words.
This is the coordinator's #48 follow-up to Max's decision #40 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]>
Problem
The runtime keeps one record of where the pointer is, and every consumer of it asks a hit-test question: what a press would take (
aimedItem), whether a mark is under the hand (refreshHover'smarkAt), design mode's target. That record was kept frommousemove, and Chromium rounds a legacy mouse event'sclientX/clientYto whole pixels while carrying the true position on the pointer events. Measured on the page that first showed this:pointerdownreports400.5, 2301.2734375,mousedownreports400, 2301. So the record is an answer about a place the pointer is not, and within a pixel of a seam that place is a different item.It surfaced as red
ci: ondesign-decision.htmlthe sweep aims at a choose group's centre,y = 474.2734, while the browser puts the cell boundary at474.109— so an ⌥-press landed onopt-rediswhile the outline, asked at the rounded474, was drawn onopt-jwt. f72029b widened--lf-address-colfrom 30px to 36px, which reflowed the options and moved that centre 0.8px inside the boundary. Nothing about the aim changed; the seam moved under it.That half is already closed on
main. a2318a1 takes the press fromaimedItem()rather than the pointerdown target, so the outline and the press can no longer disagree — they are one reading asked twice. What it does not do is make that reading the browser's own: both now answer at the rounded point, so within a pixel of a seam the reader is shown the wrong item and the press faithfully takes the wrong item.markAtand design mode's target have no second reading to be made to agree with at all.Solution
Record the pointer from
pointermoverather thanmousemove, in both writers of that record (runtime/anchors.jsandleaf.js), so the position every hit test is asked at is the position the browser hit-tests with. The two comments that named the old event are updated with it.The alternative — having the press ask
elementFromPointtoo — was rejected here because it would make an ⌥-press take a different item than an ordinary click at the same spot; a2318a1 solved that side differently, and the two changes compose.Testing
test_the_aim_reads_the_pointer_where_the_press_is_dispatched_fromholds a seam under the aim on purpose, rather than relying on the corpus landing near one. A fixed box puts a boundary between two whole pixels,AIM_SEAMbinary-searches the browser's own hit test for it, and the aim lands within a quarter pixel of it — the point is the midpoint of the seam and the whole-pixel boundary rounding turns at, so the true point and its rounded twin are on opposite sides. Which of the two is over which item follows where in the pixel the seam fell, so the item the aim is held to is read off the point rather than named; the disagreement itself is asserted first, so a seam that drifted onto a whole pixel fails the test rather than leaving it proving that two agreeing readings agree.Bug-back, measurements and runs
Reverting the two recorders to
mousemove— with a2318a1 in the tree — still fails the new test, and fails it at the promise:The fixture's numbers, taken in a headless Chromium running
AIM_SEAM's search verbatim: the hit test stops answeringseam-upperat319.3125— .31 of the pixel, and 0.98px above that box's own bottom edge (320.296875), which is the hit-region slack the seam is searched for rather than computed from. The point the search returns is319.40625,0.094pxpast the seam,at: seam-lower/rounded: seam-upper.Rebased onto
mainat 5d1d383, so this is verified against the tree that contains a2318a1:tests/test_render_controls.py -k aim— 19 passed at-n0, includingtest_an_aimed_press_does_only_what_the_outline_promisedover all ten corpus pagespre-commit— passedThe full
--run-nightlysuite runs on this PR.