Skip to content

Clear the contents map's spine with lf-toc + *, so a write in the chrome no longer restyles the page - #5370

Merged
max-sixty merged 2 commits into
mainfrom
agent-aa68f0cc768391447
Nov 4, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-aa68f0cc768391447

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

On the 512-section asks page of leaf-dev scaling, most of a wheel step's main thread went to restyling the page. Each heading that scrolled under the pointer showed its link, the link moved into the chrome, and Chromium restyled 20,255 of the page's 28,335 elements. The rule behind it is toc.css's @scope (div:has(> lf-toc)) from #5363. Chromium tests a scope root's :has() on every element the rest of its compound matches, here every div, the chrome's among them, and adding or removing a node inside any of them restyled the page. Bisecting the shipped sheets rule by rule found that rule alone.

The block after the map now clears the spine by lf-toc + *, which asks only for the element just before each one. Behavior change: a second loose block in the track stands by the spine; page-layout.md's sidebar holds the map and one block, page-authoring.md asks for a short status, and a page with several blocks wraps them in one element, which page-layout.md, "A sidebar page", now states. Each wider form costs pages with no map as well: lf-toc ~ :not(lf-toc) reads every earlier sibling for each element tested, and a full restyle of a column of 4,000 paragraphs took 82 ms against 54 ms with no rule, and 55 ms with lf-toc + *. Naming the track's class in the scope would have the default package read a Layout (test_layout_style_and_widgets_never_read_each_other).

annotation-chrome.css's html:has(.lf-margin-preview leaf-text:focus-within, …) goes too. Chromium matched its argument against the document again at each write in the chrome, which took about 5 ms of style recalc instead of 1 ms. floating.js now writes data-lf-floating-editor on the root while the user is in a leaf-text inside a box it stands in a plane, read as the user moves and as a box takes or leaves its plane, and the root's scroll padding drops on it as before. Checked in the response bar and in a thread's card: set while the user writes, cleared when focus moves to the card's Close and on Escape.

test_an_untyped_has_leads_only_to_a_typed_subject now also refuses an @scope root whose :has() names its element by a type alone. With the old rule put back it names toc.css.

Against main 9328f61 on the 512-section asks page, interleaved, a fresh tab each:

main this
A node added to the chrome and removed: style recalc, largest restyle 182.6 ms, 20,199 elements 1.5 ms, 27 elements
A heading hover: style recalc, largest restyle 93.7 ms, 20,255 elements 2.0 ms, 58 elements
A leaf-dev scaling wheel step, pointer at 400, 400: main thread, style recalc 60.7 ms, 28.3 ms 33.4 ms, 1.9 ms

Medians of 3 rounds for the first two rows and 5 for the wheel step. Style recalc was 47% of the step and is now 6%. #5309's test_a_status_line_in_the_map_s_track_stands_clear_of_its_spine passes, and fails with the rule removed.

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

…hrome no longer restyles the page

On the 512-section asks page of `leaf-dev scaling`, most of a wheel
step's main thread went to restyling the page. Each heading that
scrolled under the pointer showed its link, the link moved into the
chrome, and Chromium restyled 20,255 of the page's 28,335 elements. The
rule behind it is toc.css's `@scope (div:has(> lf-toc))` from #5363.
Chromium tests a scope root's `:has()` on every element the rest of its
compound matches, here every `div`, the chrome's among them, and adding
or removing a node inside any of them restyled the page. Bisecting the
shipped sheets rule by rule found that rule alone.

The block after the map now clears the spine by `lf-toc + *`, which asks
only for the element just before each one. Behavior change: a second
loose block in the track stands by the spine; page-layout.md's sidebar
holds the map and one block, page-authoring.md asks for a short status,
and a page with several blocks wraps them in one element. Each wider
form costs pages with no map as well: `lf-toc ~ :not(lf-toc)` reads
every earlier sibling for each element tested, and a full restyle of a
column of 4,000 paragraphs took 82 ms against 54 ms with no rule, and
55 ms with `lf-toc + *`.
Naming the track's class in the scope would have the default package
read a Layout (`test_layout_style_and_widgets_never_read_each_other`).

annotation-chrome.css's `html:has(.lf-margin-preview
leaf-text:focus-within, …)` goes too. Chromium matched its argument
against the document again at each write in the chrome, which took about
5 ms of style recalc instead of 1 ms. floating.js now writes
`data-lf-floating-editor` on the root while the user is in a `leaf-text`
inside a box it stands in a plane, read as the user moves and as a box
takes or leaves its plane, and the root's scroll padding drops on it as
before. Checked in the response bar and in a thread's card: set while
the user writes, cleared when focus moves to the card's Close and on
Escape.

`test_an_untyped_has_leads_only_to_a_typed_subject` now also refuses an
`@scope` root whose `:has()` names its element by a type alone. With the
old rule put back it names toc.css.

Against main 9328f61 on the 512-section asks page, interleaved, a
fresh tab each:

| | main | this |
|---|---|---|
| A node added to the chrome and removed: style recalc, largest restyle | 182.6 ms, 20,199 elements | 1.5 ms, 27 elements |
| A heading hover: style recalc, largest restyle | 93.7 ms, 20,255 elements | 2.0 ms, 58 elements |
| A `leaf-dev scaling` wheel step, pointer at 400, 400: main thread, style recalc | 60.7 ms, 28.3 ms | 33.4 ms, 1.9 ms |

Medians of 3 rounds for the first two rows and 5 for the wheel step.
Style recalc was 47% of the step and is now 6%. #5309's
`test_a_status_line_in_the_map_s_track_stands_clear_of_its_spine` passes,
and fails with the rule removed.

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

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

lf-toc + * now asks authors to put one block after the map, or wrap several in one element. That rule appears only in toc.css's comment, and the reference that comment cites says otherwise. page-layout.md, "A sidebar page", says the layout-track "holds everything that should stick and scroll together" and says to "Style its blocks by their classes or ids, or as .layout-track > p". page-authoring.md's "contents and a short verdict or status" doesn't say one block either. An agent following those references can put a status line and a list in the track. The second block's first words then lie under the spine and its hover strip, and no page check reports it. The scope rule this replaces cleared every block in the track. A sentence in page-layout.md's "A sidebar page" would fix it: put the map first, follow it with one block, and wrap several blocks in one element. That puts the contract where page authors read it. I can push that sentence if you'd like.

@max-sixty

Copy link
Copy Markdown
Owner Author

Agreed — the contract belongs in page-layout.md, "A sidebar page", where authors read it. Yes, please push that sentence (map first, then one block; wrap several blocks in one element), and keep it to the one place.

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

With the map's spine cleared by `lf-toc + *`, only the block right after the
contents map stands clear of it, so a sidebar page puts the map first and one
block after it, wrapping several in one element.
@leaf-agent

Copy link
Copy Markdown
Collaborator

Pushed as 41bdf29: page-layout.md's "A sidebar page" now says to put a contents map first in the track, follow it with one block, and wrap several blocks in one element. It's only stated there.

@max-sixty
max-sixty merged commit 7a2b11a into main Nov 4, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-aa68f0cc768391447 branch November 4, 2026 14:58
max-sixty added a commit to max-sixty/tend that referenced this pull request Nov 5, 2026
…other bots' heads for landing (#1652)

Leaf, the only consumer that sets `workflows.review.await_ci: false`,
has landed reviewed heads a median 2.4 minutes after their CI settles
over tend-land's first 20 days (p95 6.5 min, n=533). The shortfalls were
in the sessions around tend-land. This PR fixes four of them, building
on #1648's **Which heads to poll** rule.

## Every session is told the wait is off

Only the review, triage and land prompts carried the sentence "The
review's CI wait is off". Mention, notifications, nightly, weekly and
review-runs sessions never saw it, so they kept owning a bot PR's CI as
`run-tend` says. On Leaf's first 50 hours on Claude, 16 of 60 mention
sessions polled, 13 of them on bot PRs. 31 of 115 repair sessions found
that the pushing session, still polling, had already fixed the red.

The generator now passes the fact to each agent step as an `await_ci`
action input. `_prompt.render` states it once in the shared system
prompt, beside the merge mode, and the appended prompt sentences go.
`nightly`'s hard-coded poll now defers to `monitor-ci`. A focused eval
states the fact per situation, so `evals/prepare.py` renders it empty
there.

## A push to a human's PR stays with the session that made it

Once told, sessions read `run-tend`'s handoff as covering any push and
stopped polling on a maintainer's PR, where tend-land repairs nothing.
`run-tend` now says tend-land repairs only a PR with no human author,
and that a push to a human's PR stays with the session to poll, except a
review's own fix, which **Without the CI wait** in `approving.md`
already hands to the review queued behind it.

Replays of real Leaf mention sessions on Opus 5.5, each cut just after
its push and resumed with `gh` and `tend` stubbed offline, three runs
per session. Runs that polled CI afterwards:

| | Bot PRs (max-sixty/leaf#5374, max-sixty/leaf#5413) | Human PR
(max-sixty/leaf#5370) |
|---|---|---|
| #1648's rule, no sentence | 5 of 6 | 3 of 3 |
| The rule and the sentence | 0 of 6 | 0 of 3 |
| Both, with the `run-tend` clause | 0 of 6 | 2 of 3 |

The run that still stopped on the human PR took recording the push to
mean tend-land owned it. A red head there still reaches its author.
Three runs show a difference, not a rate.

## A head on another bot's PR can be recorded for landing

`land-pr intend` required this bot's push record, which a Dependabot or
Renovate head never carries. When CI outlasted the review, nothing
landed the PR until the daily sweep or a maintainer: 4 of 13 Dependabot
PRs on Leaf waited between 2 and 58 hours. `intend` now accepts a head
on a PR GitHub marks as authored by a bot. A waiting review already
merged these heads once green, so this changes when they land, not
whether. A head a person pushed to this bot's own PR, and a PR from an
automation account GitHub types as a user, still stay with a maintainer.

`review-without-ci-wait` gains a Dependabot session. On Claude, main
records nothing in 0 of 3 runs, each reasoning that the head has no push
record. This branch records it in 3 of 3, passing the case's other
sessions in the same runs.

## The landing session's reads

`merge-pr` told a landing session to leave the PR open "if the base has
changed since". The record holds a branch name, but 23 of 462 Codex land
sessions took it to mean the commit and refused because `main` had
advanced. Nothing wakes tend-land again for that head, so those PRs
waited for something else to merge them. The skill now says the record
names a branch, and that commits landing on it don't count.

max-sixty/leaf#5336 merged past a maintainer's comment: the session read
the thread, met GitHub 502s, and retried for 11 minutes on that read.
The skill now says a 5xx is no verdict, and to re-read the PR before
trying again. Neither wording change has an eval.

## Validation

- `uv run pytest` (all but the two network-bound tests) and `pre-commit`
pass.
- The replays and eval above, on Claude only. Nothing has run live on
Leaf.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 7, 2026
In margin form the contents map was a fixed 24px spine that revealed its labels over
the body on hover, focus or the go-to sequence. Drawing outside the box its Layout
gave it took a patch on each side: the sidebar Layout stacked its aside over the
body and isolated the body (#5117), toc.css pushed the next block in the track
clear of the spine (#5309, reworked in #5363 and #5370), the render gate exempted a
"resting overlay" from its width floor (#3109), and the sidebar's reserved width
stood blank beside the spine (#5619).

The map is now an ordinary block in its track, with its labels always shown at the
track's width. It keeps the proportional rows, the markers and the lens, and sticks
with the track. Its height fits the stuck track at the document's end, so the map's
start never leaves the window.

Removed: the aside z-index and body isolation in layouts.css, the reveal machinery
in toc.css (hover/focus/go-to widening, the press strip, pointer-events toggling,
the label fade, the `lf-toc + :not(.lf-ui)` clearance rule), and `restsOverPage` in
the render checks.

Behavior changes the tests now hold:
- The map no longer rests as a bare spine; its labels always show, and a press on a
  label follows it directly.
- A block after the map in the track follows it below and is reached by scrolling
  the track (was: beside the map at the track's top, clear of the spine).
- Long labels wrap at the track's width (was ~320px), so close sections pack one
  label apart sooner.
- Once its sidebar ends, the map scrolls away with it, as any sticky block does.

Tests: reveal and overlay assertions rewritten to the in-track map; the overlay
stacking test, the resting-spine render-gate test and the contents-over-reading
state are deleted; contents-spine-keyboard is renamed contents-map-keyboard.

Closes #5619

Co-Authored-By: Claude <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 7, 2026
The contents map in a document sidebar is now an ordinary block in its
track, with its labels always shown, instead of a fixed 24px spine that
revealed labels over the body on hover. That deletes the overlay and the
patches each side carried for it, and the sidebar's reserved width now
holds the labels instead of standing blank (#5619). Approved direction:
[#5619
(comment)](#5619 (comment)).

**Before** (`contents-map-keyboard`, 1440×900, focus on a map link): the
labels lie over the first words of the prose.


![Before](https://github.com/user-attachments/assets/6f8dfbe7-3976-42e1-892e-35afa111b033)

**After**: the same map in its own track. Nothing covers the prose, and
the column starts where it did.


![After](https://github.com/user-attachments/assets/1539b02b-af76-4a06-8a51-842ff6dac939)

**Removed**
- `layouts.css`: the aside's `z-index` and the body's `isolation`, which
existed only so the revealed labels covered the body (#5117).
- `toc.css`: the reveal machinery (`:hover` / `[data-lf-focus-within]` /
go-to widening, the press strip on the spine, `pointer-events` toggling,
the label fade) and the `lf-toc + :not(.lf-ui)` clearance rule with its
restyle-cost notes (#5309, #5363, #5370).
- Render checks: `restsOverPage`, the resting-overlay exemption from the
width floor and from the margin readings (#3109).

**What users see change**
- No quiet resting state: the labels always show, and pressing a label
follows it directly.
- The map's height fits the stuck track at the document's end, so its
start stays in the window (about 700px at a 900px window, was 828). Once
its sidebar ends, the map scrolls away with it, as any sticky block
does.
- A block after the map in the track now follows it below, where
scrolling the track reaches it. Before, it stood at the track's top
beside the spine. `page-layout.md` and `page-authoring.md` now say this
and suggest putting a status the reader should see at once at the top of
the body. No example or `docs/` page puts anything after the map.
- Labels wrap at the track's width (~210px, was ~320px), so close
sections pack together one label apart sooner.

`--lf-sidebar-slot` stays. It still tells the map (margin) apart from
the open outline (beside); merging the two is a separate call.

**Verification**: I ran these locally and they pass: the rewritten
journey
`test_a_margin_table_of_contents_maps_the_document_in_its_track`,
`tests/browser/test_render_toc_disclosure.py`, the contents tests in
`test_contents_and_glosses.py`, the go-to hints test, and the render
gate on `sidebar-contents`. The npm-based gates (`pnpm run check`,
prettier, eslint) have no `node_modules` in this sandbox, so they're
left to CI.

<details><summary>Test changes</summary>

- Rewritten to the in-track map: the margin-map journey (the reveal,
hover and spine-width steps are gone; it now checks the map stays clear
of the body, stays put while its track is stuck, and stays clear of the
panel's room), the history, hidden-sidebar and crowded-map tests, the
"map only beside the body" test, and the go-to hints test.
- The status-line test now asserts the status follows the map and a
press on it reaches it.
- Deleted, since their subject is gone:
`test_the_revealed_margin_map_covers_every_box_the_body_paints` and
`test_the_gate_passes_a_contents_map_resting_as_its_spine`.
- Stills: `contents-over-reading` is deleted, and
`contents-spine-keyboard` is renamed `contents-map-keyboard`.

</details>

Closes #5619

---------

Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: Claude <[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