Skip to content

Run every tier on macOS nightly, and fix the tests main and macOS fail - #3939

Merged
max-sixty merged 72 commits into
mainfrom
main-failure-owner
Oct 25, 2026
Merged

max-sixty merged 72 commits into
mainfrom
main-failure-owner

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

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, 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:

Test fixes:

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, 40186545420, 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

max-sixty and others added 30 commits October 24, 2026 19:55
Nothing ran the suite on macOS, so a failure only the Mac shows reached no
one unless a local session happened to run that test, and the guidance sent
it to a local session that nothing tracked. A `test-macos` job now runs every
tier on `macos-15` in the daily schedule and a dispatch. It belongs to `ci`,
so its failure turns that run red and reaches tend through the existing
workflow_run trigger, with no tend config change. The setup action's Ubuntu
mirror step now runs only on Linux.

tests/AGENTS.md now counts `test-macos` among what tend-ci-fix repairs and
leaves only failures that no CI run shows to local sessions. It no longer
says 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 the fix's branch.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`test_workspace_root_scrollbar_appears_only_when_page_overflows` failed on
every macOS run and passed on Linux CI. It reads a root scrollbar as
`clientWidth < innerWidth`, which holds only for a classic track. On macOS the
headless shell draws the root's scrollbar as an overlay, which takes no width,
so at 1200x420 the root overflowed (scrollHeight 1458 > clientHeight 420) with
`clientWidth === innerWidth === 1200`. The same overlay made the 1200x900 half
pass whatever the root's overflow was, so the test never guarded #3616's idle
track on a Mac.

The test now adopts `html::-webkit-scrollbar { width: 15px }` before the page
loads, which gives the root a classic track on every host, as
`test_shot_controls_have_disjoint_targets_and_labels_stay_passive` does for
`lf-shot`'s stage (the `scrollbar_browser` fixture's docstring names that
approach). No product code changes: the behavior #3628 fixed is the idle
track Linux and Windows draw, and a styled track reproduces it.

On macOS at load about 30: the test failed on main and passes with the
change. With the pre-#3628 rule added back to the same sheet
(`html[data-lf-live] { overflow-y: scroll !important }`) it fails at the
1200x900 assertion, so it still catches the permanent track.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`test_a_reopening_in_a_folded_diff_thread_waits_in_its_summary` errored at teardown on every macOS run. The shift watch reported the paragraphs after `LONG_LINE_DIFF_PAGE`'s diff, and a line-comment button inside the diff, as moving up about 18-33px without input. Linux CI passes the test (the nightly of 2026-10-24 and main's runs).

## Cause

The shift is the resolve's own fold. Pressing Resolve folds the thread card with `foldBlock` (`motion.js`): a 200ms block-size animation, and the content below follows it up. That is the reflow the Stability contract allows for a change the user asked for (`browser/AGENTS.md`). The press owns its rendering only until the page adopts the server's reading. After that, the watch credits the rest of the fold through `animation_reflow`, which covers a later box only where `sizeReaches` finds the size change on the layout path to it. On this Mac the reading landed about 55ms after the press, mid-fold, and `sizeReaches` missed both boxes:

- The card is in `lf-diff`'s shadow root and the paragraphs are in the document. `animationMotion` skipped any target whose root node differs from the moved box's, and `sizeReaches` climbed `parentElement`, which stops at the shadow root.
- The comment button is `position: absolute` in its relatively positioned `div.lf-diff-line`. `sizeReaches` refused any out-of-flow box between the moved node and the following sibling, even one whose containing block is that line.

Delaying the resolve's POST by 400ms, so the reading lands after the fold ends, makes the test pass on unchanged main. I infer that Linux CI passes the same way, because its server answers after the fold has finished. I haven't confirmed that on Linux.

## Change

`sizeReaches` now climbs the rendered tree (`up`, the runtime's `renderedParent`, which the watch already uses), skipping elements that generate no box (`display: contents`, such as a slot), so a size change inside a widget's shadow root reaches the boxes after its host. It orders the moved box after the size change only where both stand in one tree, since the DOM gives no order across trees. An absolutely positioned box counts as carried when a positioned box between it and the following sibling holds it, since its containing block is that box or one nearer. A fixed or floated box still is not carried. The root-node filters in front of `sizeReaches` (the size-animation path and the `<details>` closing path) are gone. The rule still requires every box on the path to change by the animation's change, the moved box to move by exactly that much, and a block flow.

New test `test_press_owned_size_flow_crosses_a_shadow_boundary`: a press-owned fold inside a shadow root, advanced after the press's rendering has ended.

- `in-its-line`: the reading after the host and an absolute button in a later relative line are credited. It fails on main's watch.
- `in-the-window`: a button positioned against the window, which a script moves by the fold's travel, still fails. It also fails when the containing-block check is removed, so that check carries the case.

## Evidence

At a load of about 25-40 on macOS:

- `test_a_reopening_in_a_folded_diff_thread_waits_in_its_summary`, both cases, `-n 0`: errors on main, passes on four runs with the change.
- `test_render_shift_watch.py -k "size or details or news or fold or flow or disclosure or closing or native"`: 160 passed.
- `tests/browser/threads/test_resolving.py` and `tests/journeys/test_render_read_state.py`, `-k "fold or resolv or diff"`: 29 passed.

Not run: the whole browser suite, Linux, `VERIFY = 1`. The change mostly adds credit. The one place it can remove some is a size change and a moved box that share a flow from different trees, which the old `parentElement` climb could order and the new one doesn't credit. The larger risk is that a real passive shift becomes credited. The reflow rule's existing negatives (`test_absolute_size_animation_cannot_credit_an_independent_control_move`, the flex-row, inline-sibling and width cases) still fail as they should.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`tests/journeys/test_render_navigation.py::test_inner_state_is_left_before_the_surface_around_it` has failed every nightly since 2026-10-21, on Linux CI ([run 40087560199](https://github.com/max-sixty/leaf/actions/runs/40087560199)) and on macOS. Its second half expected `m`, pressed from a heading on `ship-review` with Threads open, to focus the thread's `lf-ask` in the panel's thread view. The test waited 120s for that and failed.

A bisect over the nightlies' range (`b0f5b4f79` passing, `1290dc35d` failing) names #3417, "Draw a reply's widgets in its margin card". That change sends a route to a message where a thread route goes: the panel declines a thread about a passage, so the thread's margin card opens and holds the reply's `lf-ask`. It updated `test_obligation_walk.py`, which already asserts that `m` with Threads open on `ship-review` focuses the Ask in the card. It missed this journeys test, which runs only nightly.

The product behaves as #3417 intends, so the test changes, not the runtime. It still holds what its name says, that each Escape leaves the innermost layer first. With Threads open, `m` focuses the Ask in the card. The first Escape steps back to its passage (`#off-t-resync`), the second puts the card away with Threads still open, and the third puts Threads away and leaves focus on the body. A probe of the current main showed that sequence before the test was rewritten to it.

Evidence (macOS, load about 32, `-n 0`): the test fails on main after its 120s wait and passes with the change in 7s. The bisect ran this test at each step and reported its first failure at #3417.

The first half of the test, On me over a page obligation, is unchanged and passed throughout.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Review of the first push found `sizeReaches` re-climbing the moved box's
ancestry with `getComputedStyle` at each step of the branch climb, and
the cheap order prefilter before the layout reads gone. On a 700-paragraph
page with a fold in a shadow root, `protectedMotion` per frame went from
12.8 ms on main to 16.1 ms at 4x CPU throttle.

`sizeReaches` now reads the moved box's path once per call. `mayFollow`
orders the two nodes through their trees' hosts, with no style or layout
read, ahead of the layout lookups in both the size-animation and the
`<details>` paths. The style values the layout path reads, and each
effect's geometry properties, are kept for the task that reads them
(`forTask`). Per frame at 4x throttle: main 12.8 ms, first push 16.1 ms,
this push 12.1 ms; at full speed 2.70, 3.50 and 2.55 ms.

The order comment now names the named-slot limit: within one tree, a
slot can render a host's children in another order than the DOM's, so
a scripted move there is credited, as on main.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`test_suggestion_controls_stay_out_of_the_column` failed on macOS at
820px: it counted `sug-refill`'s pin as covering two words the user
can't see. A pending suggestion's `lf-new` starts with a
`.lf-quiet` "proposed insertion" label, clipped to 1px for a screen
reader, whose text node still reports a 138px line box (x 627–765) past
the clip. The test's own word reader took that box as words, so the pin
the runtime seated at x 734, right after "Refill a", read as covering
it. The runtime was right: `coverIn` (`margin-layout.js`) cuts each run
to what its boxes show, as its header says of `.lf-quiet`. Main's Linux
CI passes it (run 40161379471), presumably because its fonts break the
line elsewhere, so the pin seats away from the label.

The suite had three copies of this word reader, in `test_suggestions.py`
and twice in `margin/test_pins.py`; one skipped `.lf-quiet` by name, the
other two didn't. The render gate already owns the reading of where
words paint: `coveredWords` (`render-checks/words.js`) skips quiet and
hidden text and cuts each run to its clipping ancestors. Its run
collection is now `paintedRuns(root)`, which `coveredWords` calls on the
body and a new probe, `paintedWords(selector)`, exposes for a subtree.
`render_harness.painted_words` calls it, and the three readers are gone:
each test asks the probe for the words and keeps only its reading of the
pin's entries and the target's parts.

The tests still measure the page independently of the runtime's seat
logic; they share the gate's definition of a painted word, not the
runtime's cover reading. The runtime's `coverIn`/`clippedBand` and the
gate's `painted` remain two readings of the same fact.

Evidence, on this Mac (macOS, Chromium):

- before: `uv run pytest tests/browser/widgets/test_suggestions.py -n0
  -k test_suggestion_controls_stay_out_of_the_column` fails both
  parametrizations with `{'covers': 2, ...}`; a probe of the word boxes
  showed the two covered boxes were the quiet label (627–765) beside the
  entries (734–790).
- after: the same command passes, as do the pin tests whose reader
  moved, the `coveredWords` tests in `test_charts.py`,
  `test_render_gate.py`, `journeys/test_render_commands.py` and
  `journeys/test_render_projection.py` (15 tests).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A step without an explicit shell runs `bash -e`, without pipefail, so piping
pytest through `tee` turned the dispatched run's 51 failures and 37 errors
into a green job (run 40156291557). Naming `bash` adds pipefail.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Every test that runs a command under `under_codex` failed on the hosted
macos-15 runner: the fake `codex` died with SIGKILL as it started, so a held
command never touched its `finished` file ("the held Codex command did not
finish"), a waited one returned -9, and a later write to its stdin raised
BrokenPipeError.

`codex_program` copies the running interpreter's binary. On a framework
Python, which the runner's toolcache 3.12 and python.org's builds are, that
binary is Python.app's main executable, whose signature seals its bundle's
Info.plist; copied alone, `codesign -v` reports "invalid Info.plist" and the
kernel kills it on exec without a word on stderr. A uv-managed Python's
binary is signed standalone, which is why local runs passed. The copy
started from `psutil.Process().exe()` in ca8cc04 (before it, the
framework launcher re-exec'd Python.app and the process wore that name
instead). The test-macos job (9aa360f) was the first to run the suite on
such a Python.

On macOS the fixture now re-signs the copy ad hoc, which makes its signature
hold at its own path whichever Python runs the suite. No product behavior
changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`under_codex` set PYTHONHOME for the copied interpreter, which needs it to
find its standard library, and every process below it inherited the value.
A Python below it built on another base then looked for its standard library
under the test interpreter's prefix and died with "Failed to import
encodings": with the suite on a framework 3.12 and the prepared installation's
environment on uv's default Python, the journeys that run its `bin/leaf`
under the fake codex failed that way (six of the codex group, found while
reproducing the macOS failures on a framework Python).

The runner now drops PYTHONHOME before it starts the shell, so the command
gets the environment the test gave it. Where both interpreters share a base,
as on CI, nothing changes. No product behavior changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A choose group pads every child as a cell, at zero specificity so a
cell's own padding outranks it. The quiet word (`.lf-quiet`) set no
padding of its own, so inside an `lf-options` it took the cell padding
and became a 49x16 box clipping its words instead of a 1px one. Since
#3837 the render gate reads what a box cuts off of its own content and
exempts only boxes under 2px, so every choose group carrying "my change"
(a user's pick replayed over the page) reported `clipped-content`, and
`page check --render` failed a valid page.

`.lf-quiet` now sets `padding: 0`, so it stays the 1px box it declares
wherever its holder pads its children. Nothing visible changes: the
clip path hid the word either way.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The test ran `page check --render` with `check=True` and
`capture_output=True`, so a failing check reached the log as a bare
CalledProcessError: the findings on stdout, which name the fault, were
dropped. The failure on main (a clipped quiet word, fixed in the
previous commit) showed only "returned non-zero exit status 1".

It now asserts the return code with stdout and stderr in the message,
as tests/AGENTS.md ("Failure messages") asks. No behavior under test
changed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The words watch lets typed words go on a press elsewhere, and
input_work_watch.js names which input caused each change. A press moves
focus as its native default, after its own listeners return, so the
blur that move dispatched ran with no source: a box that closes on
blur, as the file tree's search does (Pierre's `onBlur` calls
`closeSearch`), was reported as words leaving the screen with no key or
press, though the user had pressed elsewhere.

`test_presses_and_fills_leave_no_element_naming_stale_keys[file-tree-input]`
hit this once #3836 added Copy link buttons to the page and reshuffled
the sweep's seeded steps: it fills the tree's search, then presses the
panel's Threads chip. The gap predates that PR.

A trusted blur, focusout, focus or focusin dispatched outside any
callback now takes the source of the gesture still finishing its
dispatch. Tab's focus move is credited to its keydown, which the words
watch still treats as moving the user only, so a box that closes when
Tab leaves it is still reported, as is a blur no input caused.
`test_words_a_box_closing_on_blur_is_put_away_only_by_a_press` holds
all three.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The sweep compares each element's painted keys with a forced repaint
and calls any difference stale. Pressing motion-playground's Enlarge
asks for `requestFullscreen`; the browser enters fullscreen frames
later and blurs the pressed button as it does, and the playground's
tracked reflections drop its keys on the next frame. None of the
reading's waits (readiness, round trip, `rendered`) covers that
transition, so on CI's slower Linux runner it landed between the
snapshot and the repaint, and the keys the page had just repainted
correctly read as stale. Releasing a held request inside that window
reproduces the failure here, at the same steps.

The sweep's page now counts its unanswered fullscreen requests, and
the reading waits for that count to reach zero before it takes its
snapshot. With each request delayed a second, the reading after every
Enlarge press sees the page in fullscreen. Nothing in the product
changed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… draft brings it back

A margin card beside its subject that a reply grows past the window's foot rises,
as #3524 decided, but once lifted it stayed lifted: shortening the draft left the
card in mid-window (top 394 px where it opened at 152), detached from where it
stood, and `test_margin_card_holds_its_top_as_a_turn_arrives_and_as_a_reply_wraps`
has failed every nightly since #3524 landed.

Cause: #3524 modelled the rise as a foot hold switched on by `floored`, read from
the previous landing's position. Once a landing met the window's foot the card
held its foot from then on, so a shrinking draft kept its lifted top, and the
attachment limiter then pulled it up to the target's last line. The seat the card
opened at was lost.

Now a card being written in beside its subject holds its top and is offered the
window's whole height (`rises`, from CardAnchor to comment-placement's `fit`). The
boundary lifts it as it outgrows the room below, and its held top is the spot
before that lift, so the card rises exactly as before, line by line with the
editor's foot still, and comes back down to where it stood as the draft shrinks.
`floored`, its landing reading and the solver's `foot` measure are gone.

Behavior changed: a shortened draft now returns the card to its opening top.
Checked with `leaf-dev probe review-a-plan --do drive:card-reply` at 1400x900
against main: typing six lines raises the card 21 px a line with the editor's foot
at 820 px and the transcript unscrolled, identically on both. The journey test now
asserts #3524's tall-draft result (the card fills the window, its transcript
unscrolled) in place of the top-held expectation #3524 replaced.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A one-line comment sent from a margin comment box opened its thread card 280 px
wide, under the card's 320 px minimum (`--thread-card-min`), so
`test_an_inline_thread_keeps_one_readable_card_across_page_claims[False]` failed
from the 10-23 nightly on.

Cause: #3634 moved the comment box's options trigger from a row under the field
into a column beside it. The box's frame keeps the card's minimum width, but the
origin Send hands the card is the field plus the frame's padding, leaving out the
options' tracks since they disappear on Send. With the trigger in a column, that
dropped its width from the card's, which then stood 40 px narrower than its box.

Now the origin is no narrower than the frame's own minimum. A field narrower than
that holds one short line, so the wider card rewraps no words. Behavior changed:
a short comment's card opens as wide as the box it replaces (320 px), as before
#3634, with the trigger kept beside the field.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…s it unfolds

Tapping a folded reaction pin at 390 px unfolded it 11 px lower than the seat it
was pressed in, and `test_a_pin_unfolds_from_the_seat_it_was_pressed_in` failed on
macOS, here and in CI; Linux CI passed it.

Cause: #3341 made every margin entry, the pin's toggle among them, a hold-to-read
control (`HOLDS_WORD`). held-word.js presses such a control at the finger's
release by dispatching its click, but a finger's press is focused only by the
browser's compatibility mouse events after the release. The margin layout pass the
unfold queued could run in between, with the row neither hovered nor focused, so
margin-layout.js did not count it as held and seated it afresh, below a neighbour.

Now the release focuses the control first, ringless (`focusVisible: false`, which
Chromium, Firefox and WebKit honour), as a pointer's press does before its click.
The pin is held through the layout its press queues. A tap still leaves no ring and
no label. held-word.js joins focus.js's `focus()` owners in the placements lint
rule, since it stands in for the browser's own press, which focus.js already reads
as a press.

Behavior changed: a control pressed by a finger's release is focused at the
release rather than a moment later.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`test_refused_reply_retains_its_live_foot[panel]` has failed since #3400 (bisected
to eacf650). The refusal arrives as news, and the shift watch read the panel's
head moving down 69 px and its controls moving up 21 px as moved without input.

Cause: #3400 stands the panel's controls over its field at the view's foot and
lets a refused turn keep no room ("A refused turn no longer keeps its room"). So
when a provisional reply is refused, the turn leaving lowers the panel's head, and
the two lines given back to the field raise the controls over it. The Send button
and the passage after the panel hold still, which the test's pose check reads.

This accepts #3400's motion: the panel case now consumes, at the refusal, the
vertical moves the shift watch reports inside the floating panel, and nothing
else. The other places, and every later step of the panel case, stay strict. The
behavior the test gave up is "a refusal moves nothing in the panel". Max may
reverse this by asking for the panel to keep its height against a refusal, as it
already does for a list against news, and for the field to keep its height
through a pending send; then this expectation goes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`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]>
`test_another_key_or_a_scroll_away_puts_the_shown_gesture_back_to_showing`
pressed `z` on a choice already in view and scrolled the window away in
the next breath. The arm starts watching what a press showed only once
the press's fragment travel has finished, and clears on a scroll only
after a pass has read it in view, so a scroll in that window leaves the
arm standing and the next `z` takes the choice back. On a fast host
(this Mac, the macOS runner) the test's scroll won that race every time;
on the slower Linux runner the travel finished first. No user scrolls
within the few milliseconds of that window.

The test now waits for the press's travel to finish and for the pass
after it, and for the pass after its own scroll, before pressing again.
Introduced with the test in #3603. The behavior protected is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`test_sample_editor_focus_preserves_outer_scroll_and_the_caret[webkit_browser]`
found the containing page scrolled 1,386px to a sample's editor after
`focusDestination(editor, 'move')`, though every placement asks for no
scroll.

#3634 added a `focus` listener to LeafEditorView's contentDOM that writes
the recorded caret, for arrivals that bypass `focus()` (native Tab and
shadow-root delegation). It also ran inside the view's own `focus()`,
writing the selection during the focus event, before WebKit finished its
focus steps; WebKit then revealed that selection as it reveals a retained
one, and the reveal crossed into the containing page. The listener now
stands aside while `focus()` moves native focus, and `focus()` places the
caret once focus has landed, as it did before #3634. Arrivals by Tab or
delegation still get their caret in the arrival task.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`test_a_pointer_press_on_a_playground_control_leaves_the_user_in_the_preview`
read the sample's focus once, right after a click and a drag on the Width
range. A range takes native focus to be dragged, and the playground hands
the user back to an opaque sample through its port, so the focus returns
after the sample answers. On the macOS runner the read landed before the
answer and failed with "slider". The test now waits for the sample's
button to hold focus again; a 500ms delay on that answer fails the old
read with the CI message and passes the wait.

The read has raced that answer since the hand-back went through the
port (older than #3593, which moved the package); the macOS job is the
first run to lose it. The behavior protected is unchanged: a press on a
playground control leaves the user in the preview.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… waits

`test_a_click_draws_nothing_and_escape_leaves_the_mode` failed on the
macOS runner with the page activated by the press that Escape ended.

In Draw mode a press claims its compatibility mouseup and click, and its
pointerup releases that claim on a zero timeout. A new press set the claim
again but left the earlier press's timeout pending, so when the browser
delivered the new press before that timeout ran, as Chromium may since
input outranks timers, the old timeout dropped the new press's claim and
its click reached the page. A real double click in Draw mode hits the same
order. A press now cancels a pending release before it claims.

Holding the zero timeouts until after the second press reproduces the CI
failure on this checkout and passes with the change.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`test_a_side_list_workspace_scrolls_its_list_and_its_item_apart` pressed
`d` in the narrow workspace, waited until the item's top line had moved
four lines, and then read that line and widened the window. The `d`
scroll is smooth (about 140ms here), so that wait returns mid-scroll: the
read is a transient, and on the macOS runner the resize landed before the
scroll rested and before the runtime recorded the place it keeps, so the
widened item came back to the place before `d` ((8, 16, 7) in the run).
The test now waits for the scroll to rest and the runtime's pass after
it. Sampling the scroll per frame here shows the read landing at 491 of
635px; with the read held past the scroll's end the old order fails the
same assertion.

The behavior protected is unchanged: reading on in the narrow workspace
moves the place the item keeps when the workspace fills the window again.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`test_each_sampled_focus_ring_is_shown_whole_in_its_surface` found six
rings cut at the side of command-hub's and live-progress's tracks: the
"Stopped work" and "Release notes" summaries, and "Show activity", each
5px outside `div.scroll`.

#3918 gathers a track's blocks into one box (`data-lf-track-body`) that
sticks and scrolls them. A scrolling box clips at its padding edge, and
the blocks run its full width, so every full-width control's ring was cut
at both sides, and the last one's at the foot. Before #3918 a track of
several blocks did not stick, so nothing clipped them. The body now holds
`--focus-ring-room` as padding and scroll padding and gives it back as a
negative margin, so what it holds stands where it did and a focused
control's ring is drawn whole. #3918's sticking is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The focus ring sweep found rust-sort's Copy ring 4.7px outside the
source pane's top edge after Tab reached it.

Since #3916 a lone Copy stands half above its block's top border. Tab
reveals the focused element, Copy's shadow button, and nothing gave that
button a scroll margin: the page's `:focus` rule reaches the host, not a
Web Awesome button inside it. Reaching Copy from the heading above
therefore scrolled the pane until the button stood flush with its top,
and the ring above it was clipped. Before #3916 the button sat inside the
block, which was already in view. The button now keeps
`--focus-ring-landing` as its scroll margin, as a focused control in the
page does.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The focus ring sweep reported the playground instruction pane's Copy
ring as "under" the controls region above it in code-comparison,
data-explorer and notification-playground, though a screenshot shows the
ring drawn whole over the region.

Since #3916 that Copy stands half above the pane and reaches 4px into the
region above it, so the sweep asks which of the two paints in front where
they meet. It looked for the ring's control, Copy's shadow button, in
`elementsFromPoint`, which answers with the host instead, so it found no
control and reported a cover. It now takes the first box in the stack
that is the control or holds it, which is the host here, standing in
front of the region.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`test_a_comment_field_scrolled_away_and_back_is_still_there[item-page]`
failed on the macOS runner with the field 62px below where it stood
(441.6 against 379.2). The test read the field's window position and the
page's scroll offset, scrolled away, and scrolled back to that offset. A
reflow above the target after those reads, which scroll anchoring absorbs
by moving the offset, sends the same offset back to a different place,
and the field arrives lower though it stands exactly beside its target.
Inserting 62px above the target after the offset is read reproduces the
failure here (454.2 against 379.2).

The test now waits for the page's rendering before reading, and compares
where the field stands against its target, which is the contract its
docstring states: on return it stands beside the target. The same
insertion passes. The behavior protected is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`test_scrolling_target_hints_does_not_measure_hidden_targets` failed on
the macOS runner with 2,000 rect reads of the 1,000 spans in a closed
disclosure.

The target hints refresh their membership in the passes after a scroll
rests, and each target's `visibleTargetParts` read its rect through
`shownParts` before asking whether it was drawn. For a target inside a
closed disclosure that read forces the browser to lay out content it
skips, only to answer that nothing there is drawn, twice per refresh.
The test snapshotted its count in the frame after `scrollend`, which on
this Mac came before those passes (the reads land about 30 and 75ms
later), so it passed without seeing them; on the macOS runner the
passes came first. The test now reads its count once the scroll has
rested and the runtime's passes have run, and fails with the CI's 2,000
before this change.

`visibleTargetParts` now answers a target in skipped content (geometry.js,
`skipped`) with no parts before any geometry read. Its answer is the same
as before for every target, since such a target was never drawn; only
the forced layout goes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
test_a_wait_takes_the_suites_deadline failed because two waits fixed their
own deadline: the margin pins test's `timeout=8000` on the status notice
(#3814) and the exhausted-watcher test's `changes.wait(mark, timeout=10)`
(#3848). Each now takes the suite's deadline, SERVED_TIMEOUT_MS by default
and STATED_TIMEOUT, so a slower host waits longer instead of failing. No
product behavior changed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
A failure an open pull request covers belongs to it and needs no issue,
matching tests/AGENTS.md's ownership rule from #3939. A test-macos
failure keys on the same node id as on Linux, and its row names the job.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 25, 2026
Update the release-page geometry test for the focus-ring space
deliberately added by #3939. The sidebar track still reaches the page
edge; its panels now reach the track's content edge, leaving the inline
padding that keeps their focus rings visible. This preserves both the
wide-page layout check and the intended ring clearance without changing
the interface.

The failure in [CI run
40199854161](https://github.com/max-sixty/leaf/actions/runs/40199854161)
reproduced locally as panel right 1531 versus page right 1536. The
previous scheduled run's JUnit record passed this test before #3939. The
corrected test passes locally, including its narrow-layout and
newest-log-line checks:

```
uv run pytest tests/browser/widgets/test_workspaces_and_bounds.py::test_a_release_page_is_wide_and_keeps_the_log_on_its_newest_line -n 0
```

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 25, 2026
The margin scroll test now permits the rail's marker `tabindex` changes
while continuing to reject every other DOM write and checking that the
card stays fixed relative to its cluster.

#3939 deliberately made the rail's Tab stop follow the highest visible
row. In [main's failed
run](https://github.com/max-sixty/leaf/actions/runs/40199854161), the
old no-write assertion rejected exactly two marker `tabindex` changes.
Preserving that assertion would conflict with the keyboard behavior
#3939 intended; this changes only the test.

The old test passed in run 40182101239, reproduced the reported failure
locally at main, and the updated test passes (`uv run pytest
tests/browser/margin/test_card_placement.py::test_a_scroll_that_carries_the_card_only_updates_the_rail_tab_stop
-q -n0`). The separate sidebar geometry failure is being repaired
independently.

Co-authored-by: leaf-agent <[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]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
A sidebar page's `aside` is the room the page gives to navigation, and
`page-authoring.md` ("Contents navigation") tells authors to put the
contents outline there. The outline still drew as a folded disclosure,
so pr-walkthrough at 1440×900 and 1024×768 showed "▸ ON THIS PAGE" alone
at the top of an empty third of the window, beside an eleven-screen
review, on every screen of it.

## The fix

The Layout (`layouts.css`) now sets `--lf-sidebar-slot: beside` on a
sidebar page's `aside` while it stands beside the body
(`data-lf-beside`, which prepaint already writes). A column's margin
sidebar already says `--lf-sidebar-slot: margin` the same way. `lf-toc`
(`toc.css`) reads the token. Beside the body, it hides its toggle, shows
its "On this page" label, and draws the section in view in ink rather
than muted. With the summary hidden, `lf-toc.js` already opens the
disclosure. When the track stacks above the body, the toggle comes back
and the disclosure returns to the reader's own open or closed choice.

The widget reads only a token describing its box (`browser/AGENTS.md`,
"A Layout, a style and a widget never read one another"), so a
hand-written page can opt in with the same token.

The open outline's last link sits at the foot of the track's scrolling
body, so its focus ring relies on the ring room #3939 gave that body;
this change adds no rule of its own for it.

## Evidence

`leaf-dev stills origin/main --state walkthrough-wide --state
walkthrough-body-short`. `walkthrough-wide` is a new state:
pr-walkthrough at the desktop viewport, two windows down. The base shows
the folded toggle beside the body. The head shows the nine section links
with "Change surface", the section in view, in ink.
`walkthrough-body-short` (900×600) shows the same change.

## Checks

- New
`test_a_sidebar_page_track_beside_the_body_stands_its_outline_open`: the
outline is open with its summary hidden beside the body at 1440, and
folded again at 700. It fails with the token removed.
- `test_each_sampled_focus_ring_is_shown_whole_in_its_surface` passes,
the open outline's last link included.
- The sidebar track tests
(`test_a_sidebar_pages_track_stays_in_view_only_beside_the_body`,
`test_a_revision_keeps_the_readers_place_in_a_sidebar_tracks_body`,
`test_a_sidebar_pages_items_trim_their_words_at_both_edges`,
`test_browser_and_file_captures_agree_on_a_sidebar_tracks_blocks`),
`test_pr_walkthrough_navigation_starts_the_review_at_every_width`,
`test_layout_style_and_widgets_never_read_each_other`,
`test_page_fixture_renders` for command-hub, live-progress, triage-board
and pr-walkthrough, and `pnpm run test:runtime` pass on the merged tree.
- The catalog stills are recaptured, so pr-walkthrough's first screen
shows the open outline, and triage-board's track prose shows the rewrap
from #3939's ring room, which main's earlier pin predated. The pin is
the later of this branch's and #3936's `leaf-assets` revisions, which
holds both branches' stills. `wt refresh-previews` run again from this
branch merged with main, #3936 and #3939 included, reproduced every
pinned still byte for byte, so the pin did not move.

> _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
…rowing

The rail's one Tab stop is its highest row in view (#3939), but the stop
read each row's own box, and a row standing in a carrier, which the
browser moves with the scroll, reads its box a frame late after a scroll.
margin-layout.js already says so and reads such a row from its target.
On ship-review, scrolling down and back to the top left the stop on the
second row, below the first, until a resize or another render re-read
the rail. margin-layout.js now exports that reading (`paintedBox`), and
the projection's visible rows, which the stop, the walk and the Page
Map's hand-back all use, read it.

Behavior changed: after a scroll, Tab into the rail starts at the
highest row the user sees, carried rows included.

#3939 also made a resize that carries a region into the page keep the
page's own place among places the reader never made. That rule had no
check beyond one test on live-progress, though with it reverted seven
corpus pages move on an untouched narrowing (sidebar tracks and stacking
panes). The corpus gate now narrows a fresh, untouched copy of each page
and fails when the page leaves its own place's words, which catches the
two that jump furthest (live-progress, command-hub); the others move
27 to 422px and keep their words in view. The check API
exposes `capturePlace` and `placeNode` for it.

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

Every sticking block (a column's margin sidebar, a sidebar page's track
body, a widget's track such as a playground's rail) scrolls what it holds,
so it clips at its padding edge. #3939 gave the ring's room to the track
body alone, so a column's margin sidebar holding more than a contents map
still cut rings: a details summary's at both sides and a line-leading
link's at its start and top (5px, Tab at 1440x900).

The room (padding, scroll padding, and the block-axis room given back as a
negative margin) now sits in the shared Sticking blocks rule, and the
track-body-only rule is gone. The margin sidebar's float rule takes
`:where()` so the shared block-axis margin outranks its own while it
sticks, keeping what it holds at its old top; flowing, it keeps its
margins. A playground's rail now stands its panes 5px in from each side,
as the track body already did.

The new test tabs onto a line-leading link and a summary in both a margin
sidebar and a sidebar page's track and asks that each ring is whole; on
the previous CSS it fails for the margin sidebar.

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 kept a framed Leaf page's arrival from taking focus from the page around
it with a clause on one caller, the arrival's composer recovery. The rule it
stated already had a home, focus.js's `canPlaceFocus`, which every Leaf focus
placement passes through, but there it held only for live samples. So a framed
page that isn't a sample still took focus by every other route: when the
embedding page sent it to a fragment, by a link targeting the frame or by
script, travel put focus on the heading and the embedding page's link lost it.

`canPlaceFocus` now holds for every framed document: a top-level page may
always place focus, and a framed one only while it holds focus. The arrival's
own clause goes, so a framed page with a saved composer draft now reopens it
without focus, as a page in a background tab does. The sample's trusted-input
entry moves from the sample bridge to every framed document, since an ⌥-press
cancels the native mousedown focus that would otherwise enter the frame and
the composer it opens would then refuse focus.

The framed-arrival test now also sends the frame to a fragment and ⌥-presses
inside it; on the previous runtime the fragment step fails, and without the
entry the ⌥-press does.

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 added three engine workarounds with no entry in
notes/browser-support.md, so nothing scheduled a recheck to remove them.
Each now has one, with the evidence and the recheck that settles it:

- Chromium skipping the visual review's case-button restyle under a
  nested container. Reproduced on 2026-10-25 by deleting
  `container-type: normal` and narrowing visual-review-gallery from
  1200px to 880px: the buttons kept 14px 4px in Chromium 153 and took
  10px 8px in Firefox 155.
- WebKit revealing a selection written during the focus event.
  Reproduced on 2026-10-25: with the editor-view guard disabled,
  test_sample_editor_focus_preserves_outer_scroll_and_the_caret
  [webkit_browser] failed with the page scrolled 1,386px, and the
  Chromium case passed.
- Firefox misplacing a `left`-inset heading link after a resize. Not
  reproduced: a `left` form of the current arithmetic followed its
  heading in Firefox 155 on three corpus pages and a one-heading page,
  so the entry calls the gap unconfirmed and says what drops it.

No behavior changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
The user judged focus rings too central to Leaf for another per-case
fix. This reverts the branch's two ring commits: the ring room shared by
every sticking block (647ef69) and the Web Awesome host margin at Tab
arrival (4eb1eef). Main keeps #3939's track-only room and #3916's
Copy-only margin.

notes/focus-ring-room.md lists the six cases found so far, with their
measurements and reproductions, the two mechanisms behind them, and the
two candidate fixes tried. TODO #31 asks for one mechanism once the list
shows its shape.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
At 1200x900 a one-line comment's card opened by Send stood 280px wide, 40px
under `--thread-card-min`, while the same thread reopened from its margin
marker stood at 320px with the same left, top and height. A wrapping comment
showed the same gap at the other bound: 552px at Send, 592px reopened.

The card Send opens takes the comment field's rectangle, so the words keep
their column through Send. #3634 stood Other responses in a grid column
beside the field, inside the frame, so the field (and the card from it) was
the frame less that column, while a reopen sizes the card by the frame's
own bounds (`--thread-card-min` to `--thread-card`).

The user chose on 2026-10-25 that the field is at least the card's minimum.
The frame's grid returns to one track, so the field takes its whole
measure, and the trigger stands 4px over the field's end in the head row
the frame already reserves, where the card's controls stand once it opens.
The frame's width bounds are then the card's, with no second clamp, and the
boundary that holds the frame holds the trigger.

Rejected: letting Send's card size itself as a reopen does, which drops the
field's width and rewraps a wrapping comment at Send (3 lines to 2 here,
the card 21px shorter); and hanging the trigger outside the frame, which a
window edge would cut.

Behavior changes in tests: the margin journey again requires the card at
least the minimum (relaxed by #3939); the narrow response-field test asserts
the trigger over the field's end rather than beside it; a new test holds
Send's card to the reopened card's rectangle.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
The user chose on 25 October that words landing in the floating panel's
reply field without typing, handed back by a refused send or typed in
another tab, grow the field at once as typing does. The returned words show
whole first, the path is rare, and a hold for it costs code on every later
change.

Behavior change: when the log refuses a reply sent from the panel's thread
view, the view gives the turn's room back and the field grows to the words
it hands back, so the view's head moves down and the row over the field
moves up, where #3939 held both until the user's next gesture.

Removed from floating-panel.js: `holdRefused`, `holdField`,
`releaseField`, `fieldHold` and their calls, and `stoodAt`, which only
`holdRefused` read. `holdThread` stays for a press in the view and a
rewrite's caret. The reply row's `sent` binding no longer gets the send's
flight, which only `holdRefused` awaited, so `sendReply` returns
`sendMessage`'s result directly.

browser/AGENTS.md, "Stability", gains "Stability is owed to the common
path", scoped to the floating panel because margin and page cards still
hold refused words and mirrored drafts in `reply-continuity.js`.

Test: `test_refused_reply_retains_its_live_foot[panel]` now asserts the
handed-back words show whole in the field (it fails against the hold) and
consumes the panel's own moves, each reported in a frame that moved the
panel, while the Send action and the page's tail still hold still.

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

Follow-ups to #3939 from a /fix-underlying review of its fixes and the
decisions that review raised. Each part fixes a cause one level above
where #3939 patched it, or removes a hold that cost more code than the
movement it prevented.

## Product changes

- **An oversized upload is read to its end before it is refused.** The
server closed the connection with the body unread, so a client still
sending got a connection reset instead of the 400. `read_body` in
`src/leaf/http.py` now keeps up to the limit and discards the rest.
- **The margin rail's Tab stop reads a carried row where it is
painted.** `paintedBox` in `margin-layout.js` serves both `visibleRows`
and `syncRoving`, so a row the rail carries a frame late no longer takes
the stop by its stale box. A gate now covers an untouched narrowing.
- **Leaf places focus in a framed page only once the user enters it.**
`canPlaceFocus` is now `window === window.top || document.hasFocus()`,
one rule for every framed page, and `bootstrap.js` enters a frame on a
trusted pointerdown or keydown. #3939 handled only arrival recovery.
- **Send's card is the card a reopen shows.** The comment field's
options trigger took a 40 px column beside the field, and the card Send
opens takes the field's rectangle. The trigger now stands above the
field's right end, so the field fills its frame (CSS only).
- **A page read from its top stays at its top.** `capturePlace`
(`reading-place.js`) marks a scroller at 0 as read from its start, so
narrowing no longer scrolls root-parts 135 px and takes its title out of
view. Leaf's own resize correction had overridden the browser, whose
scroll anchoring leaves a page at its top alone.
- **A refused reply's words grow the panel's field as typing does.**
This removes the refusal hold #3939 restored (`holdRefused`,
`holdField`, +16/−64 in the runtime). `browser/AGENTS.md` gains
"Stability is owed to the common path": a rare path the user reads at a
glance may move the layout rather than carry a mechanism of its own. Its
wording covers the floating panel; whether margin cards follow it is
still open.

## Test changes

- **The scroll-watch gesture drives its own frames.** It runs a fixed 24
frames and holds the runtime's settle with `scrollGlides`, the hold
Leaf's own key scrolling uses, exported from `check-api.js`. A
follower's allowance no longer depends on how fast the host draws. The
`design-header` case failed at 8 frames on macOS CI and passes at any
speed now. An injected follower is still caught on 24 of 24 frames.
- The test #3939 relaxed for the card width requires the minimum again.

## Notes

- `notes/browser-support.md` records #3939's three engine workarounds.
The Firefox one is unconfirmed.
- `notes/focus-ring-room.md` records six cases of a focus ring cut at a
scroller's edge, the two mechanisms behind them, and two candidate
fixes. Neither fix landed. Per the user, ring fixes wait until the cases
are weighed together, so the two ring commits on this branch are
reverted.

Each fix has a test that failed before it and passes after, run by node
id. The PR's `test` job fails six journey tests, and each fails on main
as well (checked locally on main at f90ff10):
`test_refused_reply_retains_its_live_foot` in all four cases (#4127),
and `test_page_fixture_renders[lost-update]` and
`[notification-playground]`. The refusal test's panel case now accepts
the panel's own moves.

> _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 27, 2026
After a card moves between board columns, its "Sent" pin now stands on
the moved card, down its right edge below the grip. Before, it stood in
the gap between columns, over the next column's card.

**Cause.** A pin's first seat is just outside its target's top-right
corner. That seat only had to stay clear of words, controls and media
(`coverIn`'s cover); a neighbouring block's own box wasn't checked. On
`triage-board` the gap between columns is 8px, and a card's text starts
about 35px past the moved card's edge. The 31px pin cleared the words
but stood 11px into the next column's card (`card-export`), so it read
as that card's. The same happened to a suggestion's pin inside a board
card: on the `test_suggestions` board at 820px, `sug-in-card`'s pin
stood 26px into the "Done" column.

**Change.**
- `coverIn` (`browser/runtime/annotation-overlay/margin-layout.js`) now
also answers `beside(rect)`. It is true when a shown box stands there
that isn't the target, doesn't hold it, isn't held by it, and isn't
`display: inline`. Inline boxes are left out because they span the empty
ends of their lines, and their words are already cover.
- `seatsBy` offers its two outside seats only where `beside` is false
for the seat's span level with the part it stands by. That part is the
subject's box for the corner seat and the last line for the seat after
the last word.
- The span is clipped because a seat is as tall as the pin (44px) while
a line is about 27px. The overhang would otherwise refuse a seat
whenever the next block starts just below the line, though a pin there
still reads as the line's.
- A neighbour beside the target, as the next board column is, still
refuses the seat. The rule therefore holds for board columns, tiles,
grid cells, workspace panes and a sidebar's aside alike.
- A seat that isn't offered is `null`, so `corner` still indexes the
inside seat. `seatRows` already let `pinSpot` skip a null seat.
`leastCovering` now skips one too, and a folded pin reads its width from
the corner seat instead of `seats[0]`.
- `seatsBy` moves to `margin-placement.js` beside `seatRows`. Given its
rects and a `beside` predicate, it answers from its arguments alone, so
`tests/runtime` covers it.
- The walk only stores each element's rect. Style, containment,
visibility and clipping are read only for a box a seat meets.

**Evidence.**
- Board probe: `uv run leaf-dev probe triage-board --do
drive:card-grabbed --do press:Enter` at 1440×900, reading the pin and
card rects.
- Before: the pin was at x 262–293, y 326–352, over `card-export` (x
282–474).
- After: it is at x 223–254, y 363–389, on the moved card `card-tz` (x
66–258).
- Phone (390×844, touch):
- A board card moved by its "Move to" button has its pin at x 281–330 on
both base and head.
- `release-notes`' `rn-sug-dry` suggestion pin is at (282,632)–(379,676)
on both base and head: two controls after its last word.
- Phone pin placement is unchanged, including the open "pin covers words
at a line's end on a phone" decision in
`notes/agent-usability-evals.md`.
- `leaf-dev pins --base`:
- It gains a `board` case (a real `lf-board`) and a `beside` fault: a
pin over another block level with its target.
- The base shows `beside (board-now-0)` at desktop; head shows no
faults.
  - The board desktop crop is the only one that changed.
- `tests/browser/margin/test_pins.py` asserts the gallery, so it now
fails on the old rule.
- `leaf-dev stills` ran on 20 pin-bearing states:
- It includes `release-draft-phone`, the new `triage-moved` (keyboard
move, desktop) and `triage-moved-touch` (destination button, phone).
- `triage-moved` changes as above. `triage-moved-touch` and
`release-draft-phone` are unchanged.
- `margin-gallery-phone` differs only in the panel's status text ("Codex
away" vs "14 agent messages"), which is timing.
- `retained-quote-touch` differs because its driver's `if full.count():
full.click()` races. The "Full quote" disclosure was open in base and
closed in head on one run, and the other way round on the next.
- `tests/runtime/margin-placement.test.mjs` adds two cases:
- `seatsBy` with a block 15px under the last line (seat kept) and a
block level with the words (both outside seats `null`). Without the
clip, the overhang assertion fails.
- `seatRows` passing over null seats at either size. This fails on
main's `seatRows` with a `TypeError`.

**Tests run.**
- `pnpm run test:runtime`: 551 pass.
- `tests/browser/margin/test_pins.py`, `test_clusters.py`,
`test_card_placement.py`, `tests/browser/test_render_send_placement.py`,
`tests/browser/widgets/test_suggestions.py`: 103 pass, 2 fail.
- 19 whole files that read `.lf-margin-cluster` or `data-lf-place`: 702
pass, 3 fail. They are:
  - the other margin files;
  - boards, outbox, thread layout;
  - workspaces, panes;
  - drawing, anchors, aim, reactions;
  - suggestions, press-away, code review;
  - chrome contracts, semantic selection.
- The failures are `test_suggestion_controls_stay_out_of_the_column`
(both motion settings) and
`test_workspace_root_scrollbar_appears_only_when_page_overflows`. All
three also fail on the merge base's margin runtime, so this change
doesn't cause them.
- The suggestion test counts `sug-refill`'s pin as covering words at
820px on both base and head. Its word reading includes a text box at x
627–765 that the runtime's cover doesn't see.
  - `sug-in-card`'s pin covers no words on head.
- Main has since moved the suggestion test onto the render gate's word
reading (#3939), which leaves out that box.
- The merge with main rebuilds `dist/kernel/` from the merged runtime;
`pnpm run test:runtime` (670 pass), `test_pins.py` and
`test_clusters.py` pass on it.

**Not verified.**
- Firefox.
- The journeys and nightly render tiers.
- The layout pass's cost on a long page. The walk adds one small object
per element in the band and no new style reads unless a seat meets a
box.

**Calls Max may reverse.**
- `beside` counts any non-inline box level with the target, including an
unpainted wrapper.
- The rule applies to the after-last-word seat as well as the corner
seat. Above and below are unchanged: below already requires its row to
be clear of words.

> _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 27, 2026
Every opening fetched and evaluated CodeMirror
(`vendor/codemirror.esm.js`, 345 KB)
before the page first showed the server's state. `bundle-answer`
imported it statically
through the text field (`composing/text-field.js`), and `widget-api.js`
re-exported
`LeafEditorView`, which extends CodeMirror's `EditorView`. Only writing
needs it, and
an empty field already built its editor only when the user arrived in
it.

CodeMirror now loads with a dynamic import once the page has presented
(`afterPresentation`, the route `floating-ui` takes), as an arrival the
page answers
for. The code that needs CodeMirror is built over the loaded module: the
field's
state, decorations, preview and row reveal in
`composing/field-editor.js`
(`loadFieldEditor`), and the view class in `editor-view.js`
(`leafEditorView(codemirror)`, one class per module). `caretAt`, which
main's #4116
exported for the field's row reveal, needs CodeMirror's `Direction`, so
it is now the
view's method (`view.caretAt(pos)`). These modules stay in the page's
static graph, so
the kernel's chunks keep their shape. Importing `field-editor.js` lazily
instead made
the compiler regroup the shared chunks around it: four more requests on
every opening
with the compiler's chunk optimization off, as on main, and two more
(`bundle-editor-view`, `bundle-widget-upgrade`) on top of #3904, which
turns it on.

Before its editor exists, a field holds a plain draft: its words, its
selection, the
words its history starts from, and the history steps its owner recorded.
A field that
must build before CodeMirror has arrived, because it holds words or the
user arrived in
it, keeps a rendering hold until the module lands. Meanwhile it shows
its words plain
in the empty line's place, with the draft's caret there while the user
is in it.
Typing lands natively in that place, as does a selection the page sets,
and the field reads the words and caret back
after each input, so the editor builds holding both. Words an input
method is still
composing join the draft when it commits, and the editor builds then.
The editor's
history starts from the draft's base words, with the early typing as one
step undo
takes back. Return still asks the owner first (`lf-edit-return`), and
Shift+Return
breaks the line.

`widget-api.js` exports `leafEditorView(codemirror)` in place of
`LeafEditorView`, and
the file editor passes the CodeMirror module it already imports, so it
gets the class
synchronously, with no top-level await. Removing a public export breaks
pages vendored
before this change, so the page protocol
(`browser/runtime/kernel-registry.json`)
moves from 28 to 29.

A one-line field (`aria-multiline="false"`, #4323) holds one line in
both forms: its
editor turns a pasted or platform line break into a space and takes no
Shift+Return,
as on main, and the plain draft before CodeMirror arrives does the same.

Measured with `uv run leaf-dev probe <page> --base` against merge base
f90ff10 (first
measured at 4789149; an independent run reproduced the release-notes
figures), on
the compiled kernel. JS requests and JS bytes (decoded) are those loaded
when the page
first showed the server's state (`presented`). Release-notes read the
same in both
runs. On triage-board, `markdown-it.esm.js` (102 KB) sometimes finishes
just before
`presented` on either arm, on a host at load 30-48; the table gives the
reading without
it, which base gave in 4 of 5 runs and this branch in 3 of 5. In every
run on this branch `codemirror.esm.js` finished after
`presented`.

| page | arm | JS requests | JS bytes |
| --- | --- | --: | --: |
| release-notes | base | 45 | 2,494 KB |
| release-notes | this | 44 | 2,156 KB |
| triage-board | base | 38 | 2,360 KB |
| triage-board | this | 37 | 2,022 KB |

Time to `presented` wasn't measured on the new base, since the host was
too loaded for
timings to mean anything. On earlier bases it didn't move beyond
run-to-run noise:
medians of three runs were 510 → 411 ms and 323 → 314 ms at 1x against
c7e3d23, and
1,135 → 1,112 ms and 851 → 773 ms at 4x CPU against 936b607.

From a press of `c` to a focused editor in the page comment box (Event
Timing on the
keydown, measured against 936b607), focus was in CodeMirror's content
node by the
first animation frame after the press in every run of both arms. The
keydown's
input-to-paint duration was 16 ms at 1x on both arms; at 4x it was 64-72
ms on both,
with handler time 27-30 ms on base and 33-35 ms here on release-notes.
With CodeMirror
held, focus lands in the field in the first frame, and in Chromium and
Firefox the
words typed meanwhile, a caret moved with the arrow keys and a
Shift+Return included,
are in the editor once it builds.

Tests:

- `test_words_typed_while_the_editor_loads_are_its_first_words`, in
Chromium and
Firefox, holding CodeMirror's module: the page presents and reads
`arrived`; `c`,
typing, a caret moved back, more typing and a Shift+Return reach the
editor with the
caret where it was; undo takes back the editor's typing, then the early
words.
- `test_a_kept_draft_and_an_input_method_reach_the_editor_as_it_loads`,
in Chromium
(the input method goes through CDP), holding CodeMirror's module: words
typed after
a kept draft on reload follow it; a selection the page sets
(`setSelectionRange`)
is where the next words land; an input method composing as CodeMirror
lands
  commits its words once.
- `test_an_unavailable_editor_module_leaves_fields_writing_plain_words`,
with
CodeMirror's module aborted: Leaf reports the failure each time a field
asks for
its editor, and the field keeps writing plain words, Shift+Return
breaking the line
  and Return sending.

On the merge base the first test times out, since the held module keeps
the page from
loading; on this PR's first version both fail (caret at 16 not 14; "
wordsKept").

## How it merges with other bundle work

- #3904 (`grind/g-boot-tla`) moves `leaf.js`'s boot out of a top-level
await. On top of
it, at c7e3d23, this PR's chunk layout was the same 27 files as
main's; the lazily
imported `field-editor.js` alternative gave 30, two of them on the
opening. With
#3904's `architecture/top-level-await` rule this PR adds no top-level
await. Not
  re-checked on the new base.
- #3462 (Solid 2, draft) changes `composing/input.js`, the top of
`widget-api.js`'s
export list and the build scripts, and bumps the protocol too. It
touches neither
`text-field.js` nor `editor-view.js`. Expected conflicts: the protocol
number (take
one bump above whichever lands first) and `dist/kernel/`, which a
rebuild resolves.

## Calls Max may reverse

- The public API shape `leafEditorView(codemirror)`, which takes the
CodeMirror module
  the caller imports.
- `caretAt` as a method of the view class rather than a module export.
- CodeMirror loads as an arrival after presentation rather than on idle
or on a first
pointer or key intent. In every measured run it had arrived before the
probe pressed
  `c`.
- The rendering hold covers the load only: an input method still
composing when
CodeMirror lands defers the build to its commit without holding the
page's readiness
  on the user.

## Checks run

On the merge with main at `b1fdabcb4`: `pnpm run check`; the three tests
above;
`test_render_options_addition.py`'s one-line phone case and add-field
preview.

On an earlier merge with main:

- `pnpm run check`: the build check, framework (134 passed), runtime
(562 passed) and
  Worker (85 passed) tests.
- The three tests above (4 runs), and main's

`test_a_scrolling_draft_shows_the_caret_s_row_with_the_padding_beside_it`
in Chromium
  and Firefox (4 passed).
- `-k` selections of `test_render_files.py` (file editor),
`test_render_shift_watch.py`,
`threads/test_layout.py`, `margin/test_card_reply.py`,
`threads/test_rewrites.py` and
`test_chrome_contracts.py` on editor carets, reveals and scrolling
drafts (17 passed).

Earlier, on c7e3d23: `tests/browser/startup/test_modules.py`,
`tests/browser/drafts/test_composer.py`, `test_draft_editing.py`,
`test_keys.py`,
`tests/browser/threads/test_composing.py`,
`tests/browser/test_render_files.py`,
`tests/browser/test_chrome_contracts.py`,
`tests/browser/test_render_export.py`,
`tests/browser/test_render_words_watch.py` (230 passed).

An independent review on 3a095de also checked:

- #4116's row reveal and #3939's WebKit focus guard survive the move
into the
  factory, each with a bug-back check
(`test_sample_editor_focus_preserves_outer_scroll_and_the_caret` passes
in WebKit
  and fails `assert 1386 == 0` without the guard).
- Typing before CodeMirror loads, in Chromium, Firefox and WebKit.
- CI's website build and `leaf-dev verify-site website-worker`, green on
3a095de.

## Not verified

- An input method in Firefox or WebKit; the composition test drives
Chromium's CDP.
- Time to `presented` on the new base.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 27, 2026
The margin-card journey measured Send while the short draft's shrink
animation was still running. Playwright's subsequent click waits for a
stable button, so the assertion compared the next action against an
earlier animation frame rather than the pressed position.

Wait for the card's finite animations before recording that baseline.
The 0.5px send-position assertion and the complete send-and-answer
journey remain intact; no product behavior changes. This preserves
#3939's intent that a shrinking draft returns the card to its original
top.

Validation: the journey failed before this change and passed after it,
including with Chromium slowed sixfold.

Closes #4255 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 4, 2026
`running-tend` told a session fixing a failure only `test-macos` shows
to dispatch `ci` on the fix's branch and read that run's `test-macos`
job. A triage session takes that as evidence it must collect before it
finishes, so it polls the run for its whole length, four to five hours,
while it holds the only triage lane. Two Claude triage sessions did so
in their first day: #5174's waited 4 h 10 min and #5184's 4 h 46 min. In
both, the PR (#5218, #5267) merged within 20 minutes of the wait
starting, so the result changed nothing, and #5184's dispatched run
ended red after its PR had merged.

Leaf already chose not to have Tend sessions wait on CI (`await_ci:
false`, #2455), and Tend tells every triage session so. This
instruction, added in #3939, asked for a wait the setting doesn't
govern, since the dispatched run is outside the PR's checks. It also
supplied the "passes after" evidence the merge rule in **Fixing a CI
failure's cause** asks for. Now the merge rule says that for a failure
only `test-macos` shows, the checks the Linux runner can run suffice,
and the macOS paragraph names the next scheduled run on main, after the
merge, as the evidence after the fix. The landing sessions already
worked that way: both PRs merged before their dispatched runs ended. If
the scheduled run still fails, its CI report brings the failure back to
triage.

Supersedes #5315, which makes the same merge-rule change but still
dispatches the macOS run and leaves the cause issue open until a later
session reads it. That costs a macOS run and another triage session per
fix to learn what the next scheduled run reports anyway.

> _This was written by Claude Code on behalf of max-sixty_
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