Repository navigation
Arrive at an ask on the words that explain it - #211
Conversation
The a/A ask walk landed every page ask with its own top edge under the banner. That is right for a widget declaring x-decision, which states a region beginning with a heading and carrying the context before the control. It is wrong for a suggestion, which is an edit to a phrase and can declare no such region: the reader arrived at Accept with the sentence and the heading scrolled away above it. arrivalRegion supplies a region from the document where the author has not declared one, in the shape the declared kind has. Candidates run widest first - the heading titling this part of the document, then the block the change stands in or the one before it - and the first whose start still leaves the ask's foot on screen wins, so the region never grows past one screen and an ask with nothing that fits keeps the landing it had. A page arrival the reader already has is left alone. The press moves the ring and the focus and leaves the page where it stands. TEXT_BLOCK moves to module scope in passages.js. The decision view is built before leaf.js destructures the passages object, and the existing answer to that ordering was textBlockSelector, a thunk for a string that never varies; version-diff.js now imports the constant directly. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_012UpYmdBrshRRKsPnHHdgTo
main folded version-activation, version-diff, and version-navigation into one version module. The branch's only change in version-diff was dropping the textBlockSelector thunk for the module constant; that lands on the new module instead, and version.js reads TEXT_BLOCK directly for both its diff block selector and the reading the decision walk starts from. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The nearest heading written before a change can be the previous ask's own, which two asks written one after another produces and which the shipped corpus does not. Arriving there puts a different question in front of the reader as this change's context, so a candidate block now has to share a container with the change. That is also what stops the search at the section the change is in rather than running back through the document. Three tests, each red with its own behaviour removed: the arrival on the words that explain the change, the container bound, and the press that leaves a page the reader can already see alone. The last of those was vacuous when first written. SCROLL_SETTLED keeps its last sample in a page variable between waits, so the wait after the third press was answered by state the nudge before it had left, and the assertion read a scroll position the press had not yet had a chance to change. It passed with the gate deleted from the runtime — the served module carrying the fault, checked by fetching it from inside the test. The absence now stands behind the press's own announcement, which goToDecision writes after it travels, and a seeded sentinel makes the settle probe take a fresh sample and hold. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Three defects in the arrival, all in code this branch wrote. Aiming the travel at the region dropped the pass that moves a scroller other than the page's, so a decision inside a card was never scrolled in its card and the ring and focus landed on a control the reader could not see. The decision's own box is revealed first now, and the region's start placed after it. A candidate block that paints nothing measured at the document's origin, which reads as a region at the top of the page: a hidden paragraph before the change won the fit and the press scrolled the page up by the banner's clearance instead of travelling. Candidates must paint a box, and blocks behind a shut disclosure leave with them, the reading blocksOnScreen already makes. The visibility gate compared one edge where readableDestination compares four through whatever clips them, so a half-cut ask read as fully visible. That reading is now published under a name that says what it answers rather than which caller first wanted it, and the walk asks it, adding only the region-start clause it cannot know. The containment test crosses declared shadow roots so a decision staged in one can still take the heading over its host. The sweep stays the document's own blocks: pageQueryAll concatenates each root's answer rather than composing one order, and the last heading it reported could come from another tree. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Two `for` headers in files this branch touches, neither of them lines it wrote. A bare `npx prettier --write` formats with whatever version npx resolves, which is not the one pre-commit pins, so it rewrote them and CI's lint refused the difference. `pre-commit run --all-files` is the formatter this repo has. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The arrival logic reads well and the three tests each pin a distinct behaviour. One finding, on the shadow-tree half of the container bound.
arrivalRegion's ordering filter is decision.compareDocumentPosition(block) & DOCUMENT_POSITION_PRECEDING. For a decision in the document tree that is exact. For one staged inside a shadow tree it is not: the two nodes are in different roots, so the spec returns DISCONNECTED | IMPLEMENTATION_SPECIFIC plus an arbitrary-but-consistent direction bit, and Chrome sets PRECEDING for every light-DOM block regardless of where the host stands. Measured just now under the repo's own Chrome — a <span> in a shadow root compared against an <h2> before its host and an <h2> after it both return 35 (DISCONNECTED|PRECEDING|IMPLEMENTATION_SPECIFIC), so beforePreceding and afterPreceding are both true.
So for such a decision before keeps every qualifying block in the host's container, including the ones after it, and findLast takes the last heading in that container rather than the last one over the host. fits has no lower bound — for a heading below the ask, shownBox(decision).bottom - start.top is negative and passes — so that heading wins and the travel puts it at the banner with the ask scrolled off the top. That is the failure the branch exists to remove, in the one shape the containment side was written to serve.
Nothing ships that reaches it: lf-diff is the only x-shadow entry in any package registry and it declares no x-awaits or x-request.decision. The cost is in the claim rather than in the page — skills/leaf/CLAUDE.md:2483 states the shadow behaviour as a fact a package author can build on, and the runtime comment reasons at length about it on the containment side while the ordering side silently cannot answer. Two ways out, and the choice is yours: climb the decision's ancestor chain (parentNode ?? host) to the node sharing block's root and compare that, which is the same crossing containsAcross and closestAcross already make; or drop the sentence and say the sweep orders within the document tree only.
Everything else read clean — the [hidden] skip beside the height > 0 test, the pre-reveal readableDestination reading, and TEXT_BLOCK at module scope with _sole_definition still finding exactly one runtime spelling.
The container bound crossed shadow roots and the ordering beside it did not. Two nodes in different roots are DISCONNECTED, and the direction bit that comes with it is arbitrary-but-consistent rather than positional: Chrome answers PRECEDING for every block in the document, whichever side of the host it stands. Measured — a span in a shadow root against an h2 before its host and an h2 after it both come back 35. So the filter kept the blocks after such a decision too and the last heading in the container won, which the travel then put at the banner with the decision scrolled off the top. That is the arrival this bound exists to remove, in the shape the crossing was written to serve. Order is now asked of the decision as each block's own tree sees it, climbing hosts until the two share a root, which is the crossing containsAcross and closestAcross already make. A region also has to begin at or above the change. Document order does not promise it — a preceding block can be painted lower — and the span such a region measures is negative, which fits every screen there is. Nothing shipping reaches either: the only x-shadow entry in any package registry declares no decision. The cost was in the claim, which skills/leaf/CLAUDE.md states as a fact a package author can build on. Found by the automated reviewer on #211. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Confirmed and fixed in 3f7745b. Reproduced your measurement under the repo's Chrome: a span in a shadow root against an Took the first of your two ways out. Order is now asked of the decision as each block's own tree sees it, climbing hosts until the two share a root, which is the crossing The lower bound on
|
|
Verified against the fix rather than reading it. Under the repo's Chrome, a What I ranfrom playwright.sync_api import sync_playwright
HTML = """
<section id="c">
<h2 id="above">Above</h2>
<p>text</p>
<div id="host"></div>
<h2 id="below">Below</h2>
</section>
<script>
const r = document.getElementById('host').attachShadow({mode: 'open'});
r.innerHTML = '<span id="d">ask</span>';
window.decision = r.getElementById('d');
</script>
"""
JS = """
() => {
const decision = window.decision;
const seenBy = (block) => {
const root = block.getRootNode();
let node = decision;
while (node && node.getRootNode() !== root) node = node.getRootNode().host ?? null;
return node;
};
const P = Node.DOCUMENT_POSITION_PRECEDING;
const out = {};
for (const id of ['above', 'below']) {
const block = document.getElementById(id);
out[id] = {
raw: decision.compareDocumentPosition(block),
rawPreceding: !!(decision.compareDocumentPosition(block) & P),
seenByIsHost: seenBy(block) === document.getElementById('host'),
fixedPreceding: !!(seenBy(block).compareDocumentPosition(block) & P),
};
}
return out;
}
"""
with sync_playwright() as p:
b = p.chromium.launch(executable_path="/usr/bin/google-chrome")
page = b.new_page()
page.set_content(HTML)
print(page.evaluate(JS))
b.close()That makes the CLAUDE.md sentence true as written — a shadow-staged decision takes the heading standing over its host, and The No remaining concerns from my side. |
Main's #211 lands `a` on the region that explains an ask rather than on the ask's own top edge, and this branch focuses the decision itself on arrival rather than its first control: the walk keeps `arriveAt` and takes main's travel, and #211's three arrival tests expect the suggestion focused, as this branch's own do, rather than its Accept. Main's 9a59df7 lets the comment field grow to its room; its sizing stands, with this branch's `--shade` shadow token on the focused control beside it. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…diff: ten pieces from a UI and UX review (#209) A UI and UX review of the layer, run as a Leaf page, and the ten pieces picked from it as "Now", each built with a test. The review page is the record of what was found and why each piece was picked; this description is the map to the diff. ## What changed **The banner folds instead of clipping.** Its addresses fold into one overflow menu in a stated order when the row runs out of width, and the status line is the one thing that gives up width; the newest-version chip is marked urgent so the menu's door says when it holds news (`runtime/banner-shelf.js`, `runtime/chrome-style.js`). The versions menu hangs from the button that opens it, and its two ways out say their direction (`runtime/version.js`). **Every control has a box a reader can hit.** One theme rule gives every pressable in the layer a floor of 24px on a fine pointer and 44px on a coarse one, and one marker, the `data-lf-offer` value, says what a reader can press, so the cursor and the outline come from the theme rather than from each widget (`chrome-style.js`, `packages/default/theme.css`). A receipt is a flat Button, not a press (`runtime/living-margin.js`). **The margin rail is reserved before the first gesture**, so the page no longer narrows when the reader's first mark lands (`runtime/margin-layout.js`). The inline thread card has a floor, and it follows its marker when the page reflows under it (`living-margin.js`). **A reader who lands is handed their place and their way in.** The skip link rests transparent and stands where an ask arrival lands, an ask arrival stands on the decision rather than below the fold, an empty Asks tray says what it is empty of, and the resting key line shows only presses that say something back, with the priority no row declared cut from the register (`runtime/keyboard/`, `runtime/decisions/`, `runtime/trays.js`). **Diff basics.** A file header that pins under the banner while its rows scroll, `]` `[` `}` `{` hunk and file keys — from the diff itself, with nothing focused inside it, `]` lands on the first hunk and `[` on the last — and a Soft wrap switch that paper always takes (`packages/diff/widgets/lf-diff.js`, `packages/diff/theme.css`). A page with only a manifest loads the renderer when it first draws lines. **A page loads only the widget modules it uses**, and a version or a reply that carries a new tag imports its module before insertion (`runtime/widget-loader.js`, `runtime/version.js`, `runtime/state-application.js`). **The agent's path answers in sentences** where leaf was silent, `leaf edit` included, with `--json` for the tests that parse it (`scripts/leaf/cli.py`). **Polish sweep**: a reacted passage has a visible mark, every elevation shadow is cast in the scheme's own ink, every word on a surface names one thing, a sheet prints what it can show and nothing it can press, a reader can take an approval back, the diff tools row is declared as a control archetype, and the small-screen map reads its seat from the row's one order. ## Reading the diff The branch merges main seven times; #205 (banner notices, persisted keys) was dispatched from this review and is already on main. The #207 merge takes its single `runtime/version.js` and `diff` package: this branch's hunks in the four modules it folded and the theme block it moved are ported there, and `readingBlock` replaces the `blocksOnScreen` export as the one reading the decision walk and the keyboard reference start from. The fifth takes 17ed171, which moves each file's "Mark reviewed" press out of its `<summary>` into a `.lf-diff-file` row beside it. Two of this branch's rules met that row and are fixed in the merge commit: the pinned summary's z-index covered the press on every file, so the press now shares that level and paints above as the later sibling; and the soft-wrap switch reached its rows through `~ details`, which the wrapper broke, so it names the file rows. A review of that merge found the third meeting: once a long file's header pinned, the press stayed absolute at the file's top and drifted off it, its reserved column empty and out of pointer reach for the rest of the file. The press is now a block in the flow ahead of the disclosure, which is pulled back up over it by a negative top margin, and sticks with the summary where it pins; the pull is the disclosure's rather than the press's because a sticky box is held inside its containing block by its margin box, and a negative margin on the press let it outlive its file by 32px at every boundary. The pinned-header test reads the press on the pinned line, reaches it with a pointer, and reads it leaving with its file. The seventh takes #212 (Button states, receipts, overflow), which answers the same question this branch's "Sew a receipt Button flat" answered: what the Button beside a move already made should promise. #212 keeps it a pressable disclosure wearing its phase as a corner mark and states that a settled outcome is receipt text beside Undo, never an inert Button-shaped status; this branch had made it a flat `status` with no press. The merge takes main's model and drops the flat receipt, its theme rule, and its test; the accessible-name test beside it stays. The choice is flagged in the review page, where the pick that led to the flat receipt stands. The sixth merge takes #211, which lands `a` on the region that explains an ask, and 9a59df7's growing comment field. This branch focuses the decision itself on arrival, its controls the next Tab stops, so the walk keeps `arriveAt` in front of main's region travel, and #211's three arrival tests expect the suggestion focused rather than its Accept, as this branch's own arrival tests do. The tend review on 1708469 read the whole diff and asked for three things, all in ec55abb: `[` with nothing focused inside the diff answered no hunk anywhere and walked the whole file list opening and fetching each one — `beyond` now answers true in both directions, so the backward walk opens the last file and lands on its last hunk, with a test on a collapsed manifest that counts fetches and open files and fails on the old answer; a comment in twice in `served_state/conversation.py`; and `taken_back(events)` rebuilt per event inside the `done` comprehension, now hoisted as every other reader does. <details><summary>Verification</summary> On the branch head before the #207 merge (2fe649e): ten render suites 590 passed with one failure, main's own WCAG nested-interactive red on the pr-walkthrough diff review button (since fixed on main by 17ed171); everyday suite 793 passed; `pre-commit` clean. After merging #207 and #208 (fbc02fe), on a machine at load average 200 shared with another session's suite: everyday suite 797 passed, 1 failed — a test this branch added whose page carries an `lf-diagram` that #207 moved into the `diagram` package, fixed in 03cd748 by selecting the package. CI's lint caught an unread console capture in one new test, fixed in the same commit. An independent review of the merge resolution found every branch hunk ported and no defects; its one design note, the widget import spent inside the activation transition, is 3dea60b. A fourth commit dropped two `.lf-margin-action` minimums as dead under the aim floor and 1b66f16 restores them: the floor's rule sits inside the `@scope (.lf-chrome)` block and margin items are hoisted into `main`, outside it, which a margin shape test pins. The thread-card fix carries a test that fails with its listener removed. The b89560d merge ("Asks (3/7)" while standing in an ask) keeps this branch's landing on the decision in the one test both sides touched and takes main's count; the 17 ask and decision tests pass. After the 17ed171 merge and the review fixes, the 19 diff, hunk and control-sweep tests across four render modules pass, the Python sign-off tests pass, and the everyday suite passed on ec55abb (798). After the #211 merge the 27 ask, decision, arrival and response-field tests pass and the everyday suite passed again on the merge (a56cdeb, 798) and on the pinned press (4bf1bb7, 798); CI's lint wrapped one assertion in that test, 7dd0d41. CI on this PR is the clean-machine gate. </details> > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
Pressing
awalked to the next ask and put its own top edge under the banner. That is right for a widget declaringx-decision, which states a region beginning with a heading and carrying its context before the control. It is wrong for a suggestion: an edit to a phrase can never satisfy "an ask must name itself without context outside the ask", so no region can be written round it, and the reader arrived at ✓ Accept with the sentence and the heading scrolled away above.Where the author has not declared a region, the document now supplies one in the shape a declared region has. Candidates run widest first — the heading over the change, then the block it stands in, or for a change that is its own block the block before it — and the first whose start still leaves the change's foot on screen wins, so a region never grows past one screen and a change with nothing that fits keeps the landing it had. That bound is what lets the widest candidate go first, rather than a rule about how far up is too far.
Two smaller things ride with it. A candidate has to share a container with the change, so the nearest heading written before it is not the previous ask's own — two asks in a row is the ordinary way to write two, and arriving there would put a different question in front of the reader as this change's context. And an ask the reader can already see is not travelled to at all: the press moves the ring and the focus and leaves the page where they left it.
Measured on the shipped release notes at 1200×900, the API suggestion now arrives with its heading exactly at the banner clearance and its explaining sentence above the change; before, the change sat at that clearance with the sentence off screen. A declared
lf-decisionpage is unchanged.TEXT_BLOCKmoves to module scope inpassages.js. The decision view is built beforeleaf.jsdestructures the passages object, and the existing answer to that ordering wastextBlockSelector, a thunk for a string that never varies.What the review changed, and one test that was measuring nothing
A review pass found three defects in the first draft, all in code this branch wrote.
Aiming the travel at the region dropped the pass that moves a scroller other than the page's, so an ask inside a card was never scrolled in its card and the ring and focus landed on a control the reader could not see. The ask's own box is revealed first now.
A candidate block that paints nothing measured at the document's origin, which reads as a region at the top of the page: a hidden paragraph before the change won the fit test and the press scrolled the page up by the banner's clearance instead of travelling.
The visibility gate compared one edge where
readableDestinationcompares four through whatever clips them, so a half-cut ask read as fully visible. That reading is now published under a name saying what it answers rather than which caller first wanted it, and the walk asks it, adding only the region-start clause it cannot know.Separately, the no-travel test was vacuous when first written and passed with the gate deleted from the runtime.
SCROLL_SETTLEDkeeps its last sample in a page variable between waits, so the wait after the press was answered by state the previous gesture had left, and the assertion read a scroll position the press had not yet had a chance to change. The absence now stands behind the press's own announcement, whichgoToDecisionwrites after it travels, and a seeded sentinel makes the settle probe take a fresh sample and hold. Confirmed the served module really did carry the planted fault by fetching it from inside the test.Each of the three behaviours is red with its own fault planted: the arrival puts the heading 45px too high, the container bound puts the previous ask's heading at the clearance, and the gate costs the reader the 40 pixels of adjustment they had made.
What the automated reviewer found, and the shadow-root ordering fix
The container bound crossed shadow roots and the ordering beside it did not. Two nodes in different roots are DISCONNECTED, and the direction bit that comes with it is arbitrary-but-consistent rather than positional: Chrome answers PRECEDING for every block in the document, whichever side of the host it stands. Measured under the repo's own Chrome — a span in a shadow root against an
<h2>before its host and an<h2>after it both come back35, and both read as preceding; climbing to the host separates them.So the filter kept the blocks after such a decision too, the last heading in the container won, and the travel put it at the banner with the decision scrolled off the top — the arrival this bound exists to remove, in the one shape the crossing was written to serve. Order is now asked of the decision as each block's own tree sees it, climbing hosts until the two share a root, which is the crossing
containsAcrossandclosestAcrossalready make.fitsalso gained a lower bound. A region has to begin at or above the change: document order does not promise that, since a preceding block can be painted lower, and the negative span such a region measures fits every screen there is. That one is reachable with no shadow tree at all.Nothing shipping reaches the shadow case — the only
x-shadowentry in any package registry declares no decision — so the cost was in the claim, whichskills/leaf/CLAUDE.mdstates as a fact a package author can build on. The claim is now true rather than softened.Two unrelated reds already on main
test_a_drag_released_mid_word_hugs_words_and_sentencesandtest_a_failed_fragment_hydration_waits_for_a_reader_retryintests/test_render_anchors.pyfail on this branch. Both reproduce identically on a cleanorigin/maincheckout containing none of this work, so they are not from here.Worth knowing separately: both browser suites are marked nightly, so
pytest testsdeselects them and reports green while they are red.tests/test_render_widgets.py(71 passed) and the everyday suite (796 passed) are green here.