Repository navigation
Use the --lf- token names in the thread ending line's rule - #6069
Merged
Merged
Conversation
#6051 added `.lf-msg-ending`, the line under a question the agent ended that says how it ended, with `var(--sp-1)`, `var(--ink-2)` and `var(--font-small)`. #6025 landed beside it and renamed every theme token to `--lf-`, so on main nothing sets those three names and all three declarations are invalid at computed-value time. The line drew in the face of whatever holds it, with no gap above it. Each PR passed its checks against a base without the other. The rule now reads `--lf-sp-1`, `--lf-ink-2` and `--lf-font-small`. No other line added since #6025 names a bare token from that PR's rename list. Evidence: a `.lf-msg-ending` element added to `heat-loss`'s `main` (`leaf-dev probe heat-loss --base --js ...`), against a reference element that reads the three tokens directly: - main: margin-top 0px, ink rgb(28 27 24), 17px Charter serif - this branch: margin-top 4px, the second ink, 11.5px system-ui, identical to the reference Main fails three model tests on this rule, and all three pass here: `test_every_rule_of_the_interface_names_a_declared_font` and `test_every_font_size_names_a_theme_token` (`tests/model/test_interface_fonts.py`), and `test_every_token_a_sheet_reads_is_set_somewhere` (`tests/model/test_interact_layer.py`).
leaf-agent
approved these changes
Nov 15, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 15, 2026
…ops measuring every margin row (#6065) The rail's one Tab stop is its highest row in view. `syncRoving` (`browser/runtime/annotation-overlay/margin-projection.js`) found it on every scroll by reading each margin row's visibility and box, three times over (directly, inside `visibleRows`, and inside `holdTabStop`), so a wheel step's work grew with the rows the margin holds. An IntersectionObserver rooted at the document's window now keeps the set of rows within a window's height of the window (`rootMargin: "100% 0px"`), and reads the stop again when a row crosses that band's edge. `syncRoving` measures only those rows, and `visibleRows`, which the margin walk and the Page Map's hand-back read, filters to them before measuring. A row is drawn at tabindex -1, so moving the stop rewrites the row it leaves and the row it reaches rather than every row. With no row in view the stop is still the row nearest the window, which measures every row, as before. The band is wider than the window because the observer reports a crossing only after the frame that moved the row. With a band no wider than the window, the frame that drew a scroll up read the stop without the rows the scroll brought in at the top, and left it on a lower row for a frame or two: in review, Shift+Tab 16 ms after a wheel step up landed below the highest row in view 6 times in 7 in Chromium. With the margin, the scroll's own frame finds them, for any scroll of up to a window between reports. ## Evidence Chromium, `uv run leaf-dev bench asks --sizes 8,64,256 --input scroll --read cpu --rounds 3 --base`, CPU per wheel step: | | 8 | 64 | 256 | exponent | |---|---|---|---|---| | main | 1.7 ms | 2.3 ms | 3.5 ms | 0.76 | | this PR | 1.7 ms | 2.3 ms | 3.0 ms | 0.61 | Firefox, `--browser firefox --rounds 3 --base`: 2.2 / 2.7 / 5.0 ms on main, 2.3 / 2.7 / 3.5 ms on this PR. Firefox's readings vary more than Chromium's: a 2-round run of the same command read 2.5 / 2.8 / 5.2 ms on main and 2.3 / 3.4 / 5.6 ms here. Profiled (`--profile --rounds 2 --base`, before the margin), time under `syncRoving` across the scroll steps: 3.2 → 22.4 ms from size 8 to 256 on main, 3.1 → 3.0 ms on this PR. The growth left in a wheel step is outside the rail: reading-place.js `capturePlace` under version.js `recordPlaces` (12.6 → 20.9 ms across the profiled steps from size 8 to 256), and native style and layout time. ## Tests In `tests/browser/margin/test_rail.py`, each in Chromium and Firefox: - `test_tab_enters_the_rail_at_the_row_the_window_shows` Tabs into the rail after a scroll down, after a row is drawn in view, after a scroll back up, and from either side of a gap with no row in view. It passes on main, and fails when the observer no longer reads the stop again on a crossing, or no longer observes a row drawn after load. It also passed once in WebKit. - `test_the_rail_s_tab_stop_moves_in_the_frame_that_draws_a_scroll` scrolls up three rows and reads the stop in a task after the scroll's frame and before the next, where a key pressed straight after the scroll lands. It passed 3 of 3 runs on main and with the margin, and failed 3 of 3 without it. Ran: `tests/browser/margin/` files `test_rail`, `test_page_map`, `test_entries`, `test_clusters`, `test_status`, `test_card_placement`, `test_pins`, `test_opening_threads`, `test_scrollers`, `test_card_reply`; `pnpm run test:runtime`; the browser type check. `test_margin_entry_tone_stays_distinct_from_control_and_agent_state` fails locally on main's runtime and on this branch alike, before and after merging #6069. ## Left as it was - With no row in view, each scroll still measures every row to find the one nearest the window. Keeping the nearest row on each side of the window would make that constant too, at the cost of a cache to keep current; a page with many rows and long stretches between them is the case that pays. - When the stop lands on a delivery status, it passes to the nearest row that acts, found among all rows' visibility (no geometry), as before. - A scroll of more than a window between the observer's reports, such as a jump to a heading, leaves the stop behind for a frame or two until the report arrives. Part of #5194
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#6051 added
.lf-msg-ending, the line under a question the agent ended that says how it ended, withvar(--sp-1),var(--ink-2)andvar(--font-small). #6025 landed beside it and renamed every theme token to--lf-, so on main nothing sets those three names and all three declarations are invalid at computed-value time. The line drew in the face of whatever holds it, with no gap above it. Each PR passed its checks against a base without the other.The rule now reads
--lf-sp-1,--lf-ink-2and--lf-font-small. No other line added since #6025 names a bare token: a sweep ofgit diff a6533b520f..HEADagainst the rename list in #6025's message finds only these three.Evidence
A
.lf-msg-endingelement added toheat-loss'smain(leaf-dev probe heat-loss --base --js …), beside a reference element that reads the three tokens directly:rgb(28 27 24), the page's inkThe branch's values are identical to the reference element's.
Tests
Main fails three model tests on this rule. All three pass here:
test_every_rule_of_the_interface_names_a_declared_fontandtest_every_font_size_names_a_theme_token(tests/model/test_interface_fonts.py)test_every_token_a_sheet_reads_is_set_somewhere(tests/model/test_interact_layer.py), which reports all three names on main, not only the fontAlso run:
tests/model/test_theme_tokens.py(passes), andtests/browser/threads/test_agent_replies.py -k test_an_answer_says_what_it_leaves_while_that_stands(passes; it reads the line's text and clipping, not its style, so it passed on main too).Not checked: the line inside a real margin card. The probe placed the element in the page's
main, which shows the rule now resolves but not what the card's own face around it looks like.