Skip to content

Give copying, thread names, label words, tree order and style writes one owner each - #5295

Merged
max-sixty merged 7 commits into
mainfrom
agent-a6eeb2af4979bb4fd
Nov 4, 2026
Merged

max-sixty merged 7 commits into
mainfrom
agent-a6eeb2af4979bb4fd

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Part of the 2026-11-03 sweep for duplicate implementations (#5291 changes how review and Tend look for them). The browser runtime answered several questions in more than one place, and the copies had drifted. Each question now has one owner that every caller asks, and browser/AGENTS.md's "One answer for each question" names it.

  • Whether the page can copy. copy-control.js exports canCopy: the Clipboard API, or, on a top-level page, the selection command the control already fell back to. The control's click guard and the leaf's menu both ask it. The fallback's helper field is now read-only at 16px and selected with setSelectionRange, as clipboard.js and copy-text-to-clipboard do, since iOS Safari raises the keyboard for an editable field, zooms into one under 16px, and can select nothing on select().
  • Thread names. threadNames in thread/model.js also indexes each thread's key (its root's attempt, else its id), and the linear scans in thread/destination.js, held-news.js, focus.js, actions.js, surfaces.js, queue-title.js and the floating panel's threadByKey ask threadNamed. A key can't name another thread: an attempt is 32 hex digits or one of the server's prefixed names, and a logged id is 8. allThreads selects effective.thread.all, so a renderer asking threadNamed doesn't repaint when only the tab's gestured threads change.
  • A drawn thread's id. Seven readers spelled data-lf-thread beside drawnThreadId; those reading one element's id call it, and those finding the page threads drawn with an id call the new drawnThreadsWithId beside it in thread/selectors.js.
  • Tree order and hosts. obligations/view.js and margin-projection.js ask renderedOrder instead of climbing to a host and calling compareDocumentPosition. The margin cluster's arrival counts a node that has left the page as coming from before, since renderedOrder between a connected and a detached node means nothing. hostIn moves to shadow-tree.js, and focused(tree) calls it.
  • Words. words.js gains counted and capitalized, and labelWords replaces the whitespace collapses in visual-parts.js, obligations/answer.js, anchor-resolution.js, keyboard/command-reference.js and composing/dictation.js. Every caller says the same words as before, at zero too. dom-children.js keeps its own collapse, since it is a runtime primitive and may import no owner.
  • Layout parts. passages.js exports layoutParts beside layoutBox, both reading one selector, and content-layout.js's title marking calls it instead of re-deriving body > main, the --lf-layout-box test and the parts selector.
  • Small owners. The floating panel reads coarsePointer from pointer.js, history.js races aborted from abort.js, composing/page-image.js uses overlaps from rect.js, passages.js exports HEADING, which heading-links.js, reading-place.js, addressable-names.js and thread/placement.js each wrote, and GENERATED for annotation-inventory.js, and box-motion.js and scroll-containers.js ask geometry.js's userScrollport.
  • Style writes. Setting an inline style property to the value and priority it holds, or removing one that is absent, produces no mutation record and leaves the style attribute as it was in Chromium 156, Firefox 157 and WebKit 27.2, measured with a Playwright page observing setProperty, removeProperty and assignment. The guards that read a property before setting it are gone from heading-links.js, block-controls.js, thread/reply-continuity.js, prepaint.js, keyboard/key-badge-placement.js, keyboard/chip-seats.js, annotation-overlay/surface-grip.js and the lf-tabs, lf-text-document, lf-trace and timeline widgets, and the keeps.js header states the measured rule.

What changes for the user:

  • The leaf's menu asked only for the Clipboard API, so a page read over plain HTTP from another machine, as an iPhone reaches leaf --host on a tailnet name, hid Copy link although the control could copy there. The menu now offers it, and the press copies the link. The iOS simulator couldn't confirm a tap there: it serves a secure page, and its WebDriver taps deliver no click.
  • A secure page without a Clipboard API copies through the selection, where the control used to let Web Awesome fail.
  • A check that matched one spelling of a thread's name, such as the reply carry's check that its thread still stands, now finds the thread under any of its names, including across the log's answer to a thread this tab started.

Tests: test_copy_link_is_one_press_over_plain_http replaces the test that asserted the menu hides Copy link without a Clipboard API, and fails on the previous runtime. over_plain_http in render_harness.py replaces the loopback route that the About and code-block plain-HTTP copy tests each set up.

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

The browser runtime answered several questions in more than one place, and
the copies had drifted. Each question now has one owner that every caller
asks.

Whether the page can copy. copy-control.js exports `canCopy`: the Clipboard
API, or, on a top-level page, the selection command the control already falls
back to. The control's click guard and the leaf's menu both ask it. Before,
the menu asked only for the Clipboard API, so a page read over plain HTTP from
another machine (`leaf --host` on a tailnet name) hid Copy link although the
control could copy there. The menu now offers it. A secure page without a
Clipboard API also copies through the selection now, where the control used to
let Web Awesome fail.

Thread names. `threadNames` in thread/model.js also indexes each thread's key
(its root's attempt, else its id). A raw attempt is 32 hex digits or one of
the server's prefixed names, and a logged id is 8 hex digits, so a key can't
name another thread. The linear scans in thread/destination.js,
thread/held-news.js, thread/focus.js, thread/actions.js, thread/surfaces.js,
queue-title.js and the floating panel's `threadByKey` now ask `threadNamed`.
Those that read only the discussed threads keep that filter with `discussed`.
`allThreads` now selects `effective.thread.all` rather than the whole thread
state, so a renderer that asks `threadNamed` doesn't repaint when only the
tab's list of gestured threads changes. Behaviour change: a check that matched
one spelling of a thread's name, such as the reply carry's check that its
thread still stands, now finds the thread under any of its names, including
across the log's answer to a thread this tab started.

Tree order and hosts. obligations/view.js and
annotation-overlay/margin-projection.js ask `renderedOrder` instead of
climbing to a host and calling compareDocumentPosition, which removes the
comment explaining Chrome's order for disconnected nodes. `hostIn` moves from
shadow.js to shadow-tree.js, shadow.js re-exports it, and `focused(tree)`
calls it.

Words. words.js gains `counted` and `capitalized`. `labelWords` replaces the
whitespace collapses in visual-parts.js, obligations/answer.js,
anchor-resolution.js, keyboard/command-reference.js and composing/dictation.js;
JavaScript's \s is the kernel's collapse class, so their words don't change.
The count helpers in semantic-news.js, thread/held-news.js and the floating
panel, their inline copies, and the `capital` helpers and inline
capitalizations call the owners. Every caller says the same words as before,
at zero too. dom-children.js keeps its own collapse, since it is a runtime
primitive and may import no owner.

Small owners. The floating panel reads `coarsePointer` from pointer.js,
history.js races `aborted` from abort.js, composing/page-image.js uses
`overlaps` from rect.js, and passages.js exports `HEADING` for the heading
selectors in heading-links.js, reading-place.js, addressable-names.js and
thread/placement.js, and `GENERATED` for annotation-inventory.js.

Style writes. Setting an inline style property to the value and priority it
holds, or removing one that is absent, produces no mutation record and leaves
the style attribute as it was in Chromium 156, Firefox 157 and WebKit 27.2,
measured with a Playwright page that observed setProperty, removeProperty and
property assignment. The guards that read a property before setting it are
deleted from heading-links.js, block-controls.js, thread/reply-continuity.js,
prepaint.js and the lf-tabs, lf-text-document, lf-trace and timeline widgets.
The keeps.js header states the measured rule, and the question index in
browser/AGENTS.md points to it beside the new owners' rows.

keyboard/layer-stack.js keeps `closest(".lf-chrome")`. It asks whether the
chrome's light-tree rules style a dialog where the dialog stands, and a shadow
boundary does stop those rules, so `inChrome` would answer a different
question.

Tests. test_the_share_link_shows_where_it_can_be_selected_without_a_clipboard
asserted that the menu hides Copy link without a Clipboard API.
test_copy_link_is_one_press_over_plain_http replaces it: over plain HTTP the
menu offers Copy link and the press copies the link. It fails on the previous
runtime. `over_plain_http` in render_harness.py replaces the loopback route
that the About and code-block plain-HTTP copy tests each set up.
…n the page

The menu now sends Copy link over plain HTTP through the copy control's
selection fallback, which is how an iPhone reaches `leaf --host` on a tailnet
name. Its helper field was editable, at the default font size, and selected
with `select()`. iOS Safari raises the keyboard for an editable field, zooms
into one smaller than 16px, and can select nothing on `select()`, after which
the copy fails and the menu opens About. The field is now read-only at 16px
and selected with `setSelectionRange`, as clipboard.js and
copy-text-to-clipboard do. The iOS simulator probe can't confirm a tap there:
it serves a secure page, and its WebDriver taps deliver no click.

The margin cluster's arrival asks whether the user came from after it. The
node they left may already be out of the page, and `renderedOrder` between a
connected and a detached node has no meaning, so a departed node now counts as
coming from before, as the old host climb answered.

The removeProperty and visibility guards left in thread/reply-continuity.js,
keyboard/key-badge-placement.js, keyboard/chip-seats.js and
annotation-overlay/surface-grip.js go, by the measured rule the keeps.js
header states.
# Conflicts:
#	browser/runtime/copy-control.js
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-content-layout.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-errors.js
#	dist/kernel/runtime/bundle-page-layout.js
#	dist/kernel/runtime/bundle-passages.js
#	dist/kernel/runtime/bundle-portable.js
#	dist/kernel/runtime/passages.js
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-page-layout.js
#	packages/playwright/widgets/timeline.js
#	tests/browser/test_render_floating_panel.py
…heir owners

#5244 and #5242 have landed, so three questions they held open now have one
owner that every caller asks.

A drawn thread's id. Seven readers spelled `data-lf-thread` themselves beside
`drawnThreadId` in thread/selectors.js: thread/held-news.js,
thread/reply-continuity.js, thread/surfaces.js twice,
annotation-overlay/thread-preview.js, and annotation-overlay/margin-projection.js
twice. Those that read one element's id now call `drawnThreadId`. Those that
looked up the page threads drawn with an id call the new `drawnThreadsWithId`
beside it, which queries `.lf-page-thread` by the escaped id as they did. The
floating panel's `.lf-fp-asked` outlets keep their own `data-lf-thread`: it
holds a thread's key on an outlet, not the id of a drawn thread.

A page of parts' views. content-layout.js found the parts container itself:
`body > main`, the `--lf-layout-box` test and the `[data-lf-views="parts"]`
selector, all of which passages.js's `layoutBox` already reads. passages.js
now exports `layoutParts` beside `layoutBox`, both read one selector constant,
and content-layout.js's title marking calls it.

Whether the user can scroll a box. box-motion.js tested `auto|scroll` against
either axis and against overflowY, and scroll-containers.js tested it against
overflowY. Each now asks geometry.js's `userScrollport`, which answers the same
for every overflow value. Neither module crosses a boundary by importing
geometry.js: dependency-cruiser finds no cycle and no closure rule against it.

browser/AGENTS.md's question index names `drawnThreadsWithId` and
`layoutParts` in their rows. No behaviour changes, so no test changed.
leaf-agent
leaf-agent previously approved these changes Nov 4, 2026
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-annotation-overlay.js
#	dist/kernel/runtime/bundle-box-motion.js
#	dist/kernel/runtime/bundle-content-layout.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-dictation.js
#	dist/kernel/runtime/bundle-errors.js
#	dist/kernel/runtime/bundle-page-image.js
#	dist/kernel/runtime/bundle-page-inspection.js
#	dist/kernel/runtime/bundle-page-layout.js
#	dist/kernel/runtime/bundle-passages.js
#	dist/kernel/runtime/bundle-portable.js
#	dist/kernel/runtime/check-api.js
#	dist/kernel/runtime/passages.js
#	dist/kernel/runtime/widget-api.js
@max-sixty
max-sixty merged commit 66b63ff into main Nov 4, 2026
4 checks passed
@max-sixty
max-sixty deleted the agent-a6eeb2af4979bb4fd branch November 4, 2026 07:43
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