Skip to content

Declare scroll surfaces instead of inspecting every rendered element - #3673

Merged
max-sixty merged 8 commits into
mainfrom
codex/lit-preact-tracking
Oct 23, 2026
Merged

max-sixty merged 8 commits into
mainfrom
codex/lit-preact-tracking

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Leaf's shared scroll discovery read visibility and computed styles from every rendered element, including syntax-highlight spans. A 4,000-row diff incurred 65,865 style reads in that pass. Scroll owners now declare their viewport with the public scroll class; reading-region registration and native prose handling supply it centrally where appropriate. The same diagnostic now uses 83 style reads.

reach.js measures those surfaces and their query-container ancestors, replacing the whole-content walk and its quiet/playing rescan scheduler. The existing arrival mechanism discovers newly declared surfaces, including code blocks inserted into thread messages, and releases borrowed state when a declaration leaves. Sticky owners declare their focus inset in CSS. Bundled widgets and chrome use the shared primitive, and nested declared shadow stages remain covered. Regressions cover nested stages, late arrivals and avoiding style reads from ordinary content spans.

This removes roughly 130 lines from reach discovery and scheduling. It does not enable diff virtualization or native offscreen rendering: the complete large-diff operation still needs further work.

Validation: browser build/type checks, runtime/framework/Worker suites, focused browser checks for keyboard reach, hidden scrollers, table containment and responsive reading regions, plus desktop/phone interaction review and Firefox keyboard scrolling. Startup uses the same 58 code requests through upgrade and 59 through presentation.

This was written by Codex on behalf of max-sixty

leaf-agent
leaf-agent previously approved these changes Oct 23, 2026

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

The margin thread’s sticky message header still depends on the removed focus inset. reach.js no longer marks sticky boxes, but .lf-margin-thread .lf-thread-transcript .lf-msg-head in browser/runtime/annotation-overlay/annotation-chrome.css has position: sticky; inset-block-start: 0 without a local --lf-head-inset. Its focusable header controls now use the ordinary landing margin, so keyboard arrival can scroll a stuck header and move the thread under the reader. Set the inset beside that sticky declaration, as the other sticky headers do.

Declare the remaining margin-thread header inset after removing inferred sticky marks. Check diff containment at its actual scrolling code viewport, rather than the non-scrolling pre wrapper.
leaf-agent
leaf-agent previously approved these changes Oct 23, 2026
@max-sixty
max-sixty merged commit 0ecba83 into main Oct 23, 2026
3 checks passed
@max-sixty
max-sixty deleted the codex/lit-preact-tracking branch October 23, 2026 03:40
leaf-agent added a commit that referenced this pull request Oct 23, 2026
Two browser checks made assumptions that changed with #3673's declared
`scroll` surfaces. This updates the synthetic scrolling boxes in the
sticky diff-header test to declare the surface, and checks for
`lf-rendered` as a class token because source widgets can now also carry
`scroll`. The header-position and fallback-face assertions remain in
place. Both tests failed on current `main` before the change and pass
together after it (`uv run pytest -q -n0` with the two node IDs).

The [failed main
run](https://github.com/max-sixty/leaf/actions/runs/39901745205) also
has other browser failures. Refs #3695; this PR fixes only these two
checks. In particular, the tab-panel sticky-header test remains red: its
`lf-tab` cannot declare the `scroll` class because the schema rejects
`class`, and moving the scroll box inside the tab would change that
test's coverage.

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 23, 2026
Two scrolling surfaces still lacked the `scroll` declaration introduced
by #3673. The file editor's long filename could no longer receive a
keyboard stop on a phone, and a synthetic bounded selection box no
longer took native focus when a drag began. This adds the declaration at
the file-editor widget and in the selection test page; the existing
editing and comment assertions remain in place.

Both focused tests failed on the merged tree before the change and pass
together afterward. `pnpm run build:browser` and the 533 runtime tests
also pass. Refs #3695; other failures in [main run
39901745205](https://github.com/max-sixty/leaf/actions/runs/39901745205)
remain outside this repair.

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
`test_a_box_that_starts_scrolling_after_it_arrives_takes_a_stop` authored
plain divs with `overflow-x: auto` and expected Leaf to find them. Since
#3673 reach measures only boxes that declare `class="scroll"`, as
page-authoring.md now tells authors to, so the window, container, script
and inserted boxes never took a stop. Each now declares the class, as an
author following the reference does.

The table a disclosure draws has been read as `data-lf-scrolls="across"`
since #3217 marked boxes that scroll only sideways, and the theme scrolls
a table only sideways; the test now expects that value.

The behavior protected is unchanged: a declared surface that comes to
scroll after arrival takes a stop, its edge mark and the sticky slot, and
gives them back when it stops scrolling.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
#3939)

Adds a nightly macOS run of every test tier, and fixes every test that
failed in its first run or in the Linux nightly beside it: 89 tests in
[run
40156291557](https://github.com/max-sixty/leaf/actions/runs/40156291557),
60 of them only on macOS.

## The macOS nightly

`ci.yaml` gains a `test-macos` job: every tier on `macos-15`, `-n 2` on
its three cores, in the daily schedule and a dispatch. It belongs to
`ci`, so a failure turns that run red and reaches tend through the
existing `workflow_run` trigger, with no tend configuration change.
GitHub doesn't bill hosted runners for public repositories; the job
holds one of the account's macOS slots for about three hours. The test
step names `shell: bash`, without which a step runs without `pipefail`
and piping pytest through `tee` reported the first run's failures as a
green job. The setup action's Ubuntu mirror step now runs only on Linux.

`tests/AGENTS.md` counts `test-macos` among what tend repairs and leaves
only failures no CI run shows to local sessions. It drops the
instruction to confirm a macOS-only failure at normal priority because
`taskpolicy -b` slows headless Chrome: a test that fails on a slower
host depends on timing, and the fix is to the test. `running-tend` tells
the session fixing a red run, which has only a Linux runner, to verify a
macOS-only fix by dispatching `ci` on its branch.

## The fixes, by cause

Product fixes:

- A drafted margin card rose against the window's foot and never came
back as the draft shrank (#3524). It now holds the top it opened at and
drops back.
- A tapped pin reseated 11px lower as it unfolded, because the
hold-to-read toggle was pressed before the browser focused it (#3341).
- A page's first thread card could cover its passage, because the
placement that makes room was dropped while Floating UI loaded (since
#1526).
- A heading's "Copy link to section" stayed at the heading's far end
after the window narrowed and widened, since every engine keeps its last
`position-try` fallback (#3836). It now picks its place from the current
width.
- Putting the response bar away moved focus off the button the press had
just focused, so the next `e` found nothing (#3756).
- A trace's image-tools status shared a class with the image's loading
notice, whose rules hid it (#3707).
- WebKit scrolled the outer page 1,386px when a sample editor took focus
(#3634).
- In draw mode a press left the previous press's release timer pending,
so a fast second click reached the page.
- Hint refreshes read the geometry of every target inside a closed
disclosure, forcing layout of skipped content.
- A sidebar page's sticky track clipped focus rings (#3918). A stuck
track body now keeps the ring's room inside its edges, so its blocks
stand 5px in from each side.
- Tab revealed a block's Copy flush with its scroller, cutting its ring
(#3916).
- The hidden "my change" word inside a choose group took a cell's
padding and read as clipped content (exposed by #3837's check).
- Visual review case buttons kept their wide padding after the first
breakpoint crossing, a Chromium restyle bug avoided by making the case
list a plain container.
- A held shot's scrolling stage didn't declare that it holds its height
(#3703/#3704).
- When the log refused a reply, the floating panel's head moved down
69px and the restored draft pushed its controls up 21px (#3400). Through
a refusal the panel now holds its head and the field its height, on the
holds a press already takes; the refused turn's room goes at the user's
next turn.
- A reply box's ↑ (edit your last message) appeared only after an
unrelated repaint once its last message became editable (#3855). Every
message draw, by any thread reader, now recomputes that row's keys.
- A trace's images took the page's scroll anchor, so a lane change in
the timeline scrolled the page 62px under an arrow key; they no longer
anchor scroll. The trace overview wrote its window's new start before
reading its size, so for one layout the window ran past its strip and
Chromium scrolled the page up to 838px; it now reads before it writes.
The image tools' status keeps its line when its text clears.
- Web Awesome's radio group moves focus on an arrow with a bare
`focus()`, which Leaf's ring scroll margin turned into a page scroll.
The vendored bundle is patched (`build/vendor.mjs`) so both calls pass
`preventScroll`.
- A Leaf page inside an iframe took focus from the page around it when
it finished arriving. Its arrival recovery now runs only at top level or
in a frame that holds focus.
- The margin rail's one Tab stop stayed on whichever row last held it,
so a resize could leave it below a row the user sees first. It is now
the highest row in view; a focused row keeps it.
- A resize that moved a sidebar page's track into the page, with neither
place made by the reader, took the track's place over the page's:
live-progress jumped 1861px (#3918). On a tie the page's own place wins.
- The whole-page rule read a shut disclosure whose children are all
generated as showing what it holds (#3908); it now skips only `.lf-ui`
apparatus.
- The gallery revealed its stamped frame at the centre, carrying the
pressed button 45px; it now scrolls only as far as needed.

Test fixes:

- The Codex fixture copies the running interpreter as `codex`; on a
framework Python, as on the runner, the copy fails its code signature
and macOS kills it at launch. That broke 39 tests. The copy is now
re-signed ad hoc, and the fixture no longer leaks `PYTHONHOME` into the
command it runs.
- The plain-HTTP copy test missed Chromium's lower-cased host; the
event-door refusal test read its answer after the server's reset; the
stale-keys sweep raced the browser entering fullscreen; the words watch
didn't credit a blur from a press elsewhere.
- Several tests read state before it settled (a shown gesture's arm, a
side list's smooth scroll, a sample's focus returning, a held reply's
menu), and now wait for it. Assertions predating #3830, #3916, #3670,
#3673 and #3217 now read the current behavior.
- Three waits fixed their own deadline instead of the suite's, among
them the async-probe test's 500ms.
- The command hub's record now sticks in view, so the Atlas journey
opens its news before reading each row; the region-capture journey drags
over the unreadable image it means to fail on (#3861 draws only the
element that alone paints the crop).
- The touch-capture removal test, which fails intermittently on main,
now reads the shelf right after the tap and names the elements the tap
reached, so its next failure says whether the tap missed or the image
came back.
- The feature-gallery scroll pass allows a third of its steps to write
the contents' `aria-current`, as gestures already do, since the count
depends on where sections fall under the platform's fonts.

The branch also merges the four open `grind/f-main-tests-*` pull
requests, whose fixes cover five more of the run's tests: #3871, #3882,
#3887 and #3906. This pull request lands them.

Each fix was reproduced failing and then passing by node id, on this Mac
or, for a Linux- or runner-only failure, against a run's log, except
where its commit says otherwise. Dispatched full runs on this branch
([40156291557](https://github.com/max-sixty/leaf/actions/runs/40156291557),
[40186545420](https://github.com/max-sixty/leaf/actions/runs/40186545420),
[40196342887](https://github.com/max-sixty/leaf/actions/runs/40196342887))
check both platforms; the second took the macOS job from 86 failures to
38, most of the rest fixed since. A few macOS-only failures pass on
every local attempt (two reading-place tests, a scroll repaint, Back
from a thread, opening a line under the last, the Android composer's
Return, margin-entry order, a card paging on, a turn arriving out of
view) and have no fix here; once this lands, the macOS nightly reports
them to tend.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
Tend now tracks each test failure it leaves unfixed in an issue of its
own, one per test node id, instead of adding rows to whichever `ci-fix:`
issue a run touched first. The rule goes in `running-tend`'s **Fix every
failure in a red run**, the repo overlay that `/tend-ci-runner:ci-fix`
loads. The overlay replaces that skill's tracker per failure shape for
Leaf.

**Why.** #3695 was opened for the declared-scroll-surface regressions
from #3673. Those were repaired by #3697, #3698, #3699, #3705, #3706,
#3724, #3746 and #3758, and the issue then became a per-nightly
umbrella. Its Oct 24 table lists 24 failures from one nightly that share
no cause with its title. Across the Oct 21–24 nightly logs, ten of those
rows failed on every nightly since they first appeared, three to five
nights in a row. They are deterministic regressions in `journeys` tests,
which run only nightly, so the pull requests that caused them passed
their own CI. Inside the umbrella a row had no owner and could stay red
for five nights while the issue looked worked on.

**What the rule says.**

- One `ci-fix:` issue per failing test node id (or per failing check
outside the suite), with the node id in its title. Tend searches open
and closed issues for that id, reuses the one it finds, and reopens it
if closed. Another test's failure never joins it; a fix for a shared
cause closes each test's issue. A failure an open PR covers is that PR's
and needs no issue, as `tests/AGENTS.md`'s ownership rule (from #3939)
already reads. A `test-macos` failure follows the same rule under the
same node id, so one issue holds a test's failures on both jobs, with a
table row per job.
- The body records the first `ci` run on main the test failed in, with
its commit, since that brackets the change that broke it.
- Below that, the failure/status table from #3695's thread: one row per
failure the test reports (its assertion, a watch finding at teardown),
with the status, the PR or run behind that status, and what remains.
Tend edits the body as the status changes and comments only to say what
changed. The run summary uses the same table, one row per failing test
with its issue or PR, and it marks a failure nobody investigated.
- A watch finding that fails on CI and passes locally is reproduced on a
slower CPU, not by reruns. **Reading a red suite** points to
`tests/AGENTS.md` "Races", which owns the `--cpu-throttle` recipe from
#3858.

**Scope.** The triage proposed this for nightly failures. The rule
covers any failing test a session leaves unfixed, push runs included. An
umbrella costs the same whichever run produced it, and a push-run
failure without a fix needs a tracker under the same key. Where a
session fixes a failure in the same run, it files no issue.

This supersedes #3768, the bot's open PR that adds the status table as a
general reporting rule. The table here is the body of each per-test
issue and of the run summary, so #3768 can be closed unmerged. The
**Leave outage trackers** line now says `ci-fix` trackers "name no
stranded trigger" rather than "have no rows", since a `ci-fix` issue now
has table rows.

The edit has no eval. It was checked by reading it against the bundled
`ci-fix` skill's tracker steps (2 and 4b), which it overrides only on
the key and the body.

Changes to agent instructions need the control-plane owner's approval
(**Landing**); Max authorized this PR in the triage brief.

Refs #3695

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

---------

Co-authored-by: Claude Opus 5.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