Repository navigation
Stop composed tree walks at the document root - #1376
Merged
Merged
Conversation
leaf-agent
commented
Sep 28, 2026
leaf-agent
left a comment
Collaborator
Author
There was a problem hiding this comment.
The passage walk still treats root.host as a shadow host in walk(). When says(document) runs with a document host value, it passes that value into contextAt(), which reaches upFrom() and throws node?.getRootNode is not a function. The new shadowHost() reading needs to govern this entry point too. I reproduced the failure with a focused runtime test and will push the fix to this bot-authored branch.
A document host value sent says(document) into contextAt as if it were a node, reproducing the getRootNode crash. Read only ShadowRoot.host in passage and containment walks; the new regression test holds that boundary.
leaf-agent
force-pushed
the
fix/ci-36351351091-shadow-host
branch
from
September 28, 2026 00:14
5ceb779 to
bacca88
Compare
max-sixty
added a commit
that referenced
this pull request
Sep 28, 2026
…outlines` (#1385) A handoff page once shipped an `lf-shot` pair whose two sides matched in every part its prose described, under an `alt` claiming the thread card changed. Nothing on the page said so: a reader of one side of the divider, or an agent screenshotting the page, cannot tell where a pair differs, or that it differs nowhere. `lf-shot` now compares its two images and says so on its rail, and with `outlines` it also outlines each changed region on both frames. ## What the reader sees Every pair's rail reads "identical", "only slight changes" (no pixel moved far: a redrawn shadow, a small contrast shift, re-encoding), or "changed throughout" (strong changes over half the image or more, such as a photo turned black and white) when it has nothing to point at. The first two take the warning style, since they are what a handoff gets wrong. A pair with `outlines` also outlines each region that changed, over both frames at the same place, and the rail counts them ("3 changed areas"). The motivating pair now reads "only slight changes": its thread card differed only by a shadow redrawn by 1–9 levels. `outlines` is a boolean attribute, coded positively like `collapsed` and `multiple`; `packages.md` ("A widget") now states that rule for widget flags. `authoring-evidence.md` tells an author to add it and check an outline stands where the prose puts the change; to leave it off where most outlines would mark what the pair is not about, such as live data between captures that cannot be retaken; and, for a pair reading "only slight changes", to name the change in the prose. ## The rule and its one home `skills/leaf/assets/runtime/image-difference.js` owns what counts as a difference, with its measurements in the header: a pixel differs on any channel, alpha included; 8px squares where some pixel moved 48+ levels are strong, and strong squares within 3 squares join into one region; a slight square joins only as a strong region's edge. `differenceKind` and `describeDifference` give the reading its kind and its words. `leaf-dev stills` loads the same module into its browser and crops each changed state to the union of its regions, so the widget and the stills tool cannot disagree. Visual review sets `outlines` on the shots it builds, states the reading in its case line ("Case 1 of 3 · Changed · 4 changed areas (1 outside the focus)"), and hides the marks on its focus crop, whose coordinates they do not share. ## Fixed on the way - `media.js` read `node.matches` on anything in a click's path, and an element with `id="matches"` made `window.matches` a node without the method, so a click threw. - A composed-tree climb took a detached `<a>` subtree's root `host` (its URL's host name) for a node and threw on `getRootNode`. Main's `shadowHost(root)` (#1376) covers it; `tests/runtime/shadow-climb.test.mjs` pins the `<a>` case and `anchor-controls.js` now uses the same helper. ## Measured Guidance A/Bs, ×3 runs per arm, both arms run together: - `evals/shot-pair-outlined` (a header-only change, kept): against this branch's earlier wording, where every pair drew outlines unless it set `no-outlines`, 0 of 3 base runs wrote `outlines` and 3 of 3 candidate runs did; the judgment passed in both arms, so it measures that the guidance names the attribute a page now needs. `shot-pair-live-data` (a header restyle over live data that cannot be recaptured) ran as the guardrail: every run in both arms left the pair without outlines, the base with `no-outlines`, so it no longer told the wordings apart and was dropped. Two candidate runs failed its regex only by nesting the images inside `lf-shot`, since the eval's child cannot read the registry. $4.46. - The `no-outlines` wording, against the branch before it: `shot-pair-live-data` went from 0 of 3 to 3 of 3, every base run already pointing its prose at the header but having no attribute to set; `shot-pair-differs` and `shot-pair-matches` held, and no run put the flag on them. $6.75, plus $6.78 for a first draft named `unmarked` that also hid the "identical" reading (0 to 2 of 3). - Replacing `authoring-evidence.md`'s "a screenshot of the page cannot show that the two sides match" with the rail's reading: no change on `shot-pair-matches` (3 of 3 both arms) or `shot-pair-differs` (2 of 3 both), since the cold cases never render a page. $3.35. Main has since dropped both cases (#1382). The pixel rule, on the thread-card pair: redrawn shadows moved at most 20 levels (mostly 1), an 8% contrast change 17, palette quantization 35, the grown card 227. Text going from #333 to #555 moves 34 levels, so it reads "only slight changes" with no outline, and the guidance has the author name such a change in the prose. Node timings: 2880×1800 all changed 64ms, 2880×8000 192ms, one pair per frame after presentation. The everyday gate passes: 1426 of 1428 on the last full run, whose two `test_interact_contract.py` failures (a preview's contract, a revendoring race) pass on rerun, alone and as a file, and touch nothing here; 169 runtime tests. Two nightly render tests fail on this branch and on its merge base: `test_visual_review_gallery_gives_a_laptop_to_the_evidence` and `test_the_versions_menu_uses_the_banner_panel_and_its_doors_edge`. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Sep 28, 2026
#1398) A page holding `<form name="host">` (or an img, iframe, embed or object by that name) hung its tab when the thread panel opened. The document exposes that element as `document.host`, and `above` in `keyboard/dispatch.js` climbed with `up.parentNode ?? up.host`. Past the document it walked back into the page and round again, forever. #1376 added `shadowHost` and routed the passage and focus climbs through it. This finishes that cut-over, so every climb asks one primitive whether a root is a shadow root: - `above` steps with `shadowHost`, the same step `under` takes. - `shadowHost` tests the node type rather than `instanceof ShadowRoot`, whose class belongs to one window. An iframe's runtime climbs its parent document's elements in `frameBand`. - The `instanceof ShadowRoot ? root.host` copies call `shadowHost`. They were in anchor-controls, anchor-paint, composing/surface, margin-layout, margin-projection and target-references. - `documentFocused` and margin-layout's `anchorElement` climbed to the outermost host by hand. Both are now `hostIn(node, document)`, and both only receive connected nodes. Tests: - **`test_a_page_element_named_host_leaves_the_keyboard_climb_at_the_document`:** opens and closes the panel on a page with `<form name="host">`. With main's `dispatch.js` it hangs rather than fails, because the page's main thread is stuck. - **Runtime passage tests:** add a detached `<a href>` to `upFrom`, `closestAcross` and the reading watcher. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The main nightly run reports four browser-test teardown errors from
node?.getRootNode is not a function. A composed-tree climb reached the document and then treated itshostvalue as a shadow-root host. This change adds a typed shadow-root host reading and applies it to the failing climb and related passage and focus paths.A focused runtime regression reproduces the same exception before the passage-walk fix and passes after it. The four affected
test_render_controls.pycases pass locally, as do all 153 runtime tests. The nightly run contains other failure shapes; this PR addresses the reproduced DOM-walk error.