Repository navigation
Mark changes with a bar beside their block, and turn off marking what changed since the last visit - #4890
Merged
Conversation
…s them The marks had a stop of their own, an Escape step and a Stop marking changes row, which no other annotation has. Max chose to treat them as annotations: o now hides their tint with the rest, the Escape step and the menu row are gone, and a chosen Compare still ends with its button in Versions. Without a stop, an offer must not accumulate a visit's worth of marks, so a return that brings a revision the user hasn't seen now starts the offer again from the newest they had; a return that brings nothing keeps the marks and the walk's place. The tests that pressed Escape twice and the menu row now check that both leave the marks, that o hides them, and that a return re-bases.
Max worried that marks moving on when the user leaves and comes back is a gate they can't see. The marks now count from the newest stamped version at or before the newest revision the user saw, so they move on only once a newer version has been seen, at a point the leaf's row names. Drafts between versions add up in the marks, and a page with no version at or before what the user saw marks nothing. A comparison's base is now always a stamped version, so revisionBase drops the went-live time it named an unstamped base by. The agent reference, events.md, read_state and the served-state schema say which version the page counts from. The tests now expect the draft the user watched to stay marked with the one they missed, a draft landing while away to join the marks, and a newer version seen to start them again; the other-tab test stamps the versions it reads.
# Conflicts: # dist/kernel/kernel.json # dist/kernel/leaf.js
# Conflicts: # browser/runtime/version.js # dist/kernel/kernel.json # dist/kernel/runtime/bundle-data.js
A change since the comparison's base painted the block's own background green, with a 4px green shadow round it. That covered whatever the block shades itself: an option's card, the chosen option's green (the change tint's own hue, so every option read as chosen), a board card, a draft's box, an aside. Each changed block now gets a 3px green bar in the margin beside it, drawn over the page by the same painter as the at-work bar. The bars stand in two lanes: the change bar 4px from the block, the at-work bar 10px, so a changed block being worked on shows both. `o` hides the change bars with the other annotations; the at-work bar is unaffected. The block keeps the `lf-ins-block` class as the marker of what the comparison marked; nothing styles it any more. The inline before → after view a Change entry opens is unchanged, so the `lf-version-inline` class and its step-back rule, there only to lift the wash, are gone. at-work.js becomes margin-bars.js, the one owner of bars beside a block, holding both kinds with one paint set. Behavior change: the coming-back test now checks for two change bars, the block's background staying clear, `o` hiding a bar, and the change bar standing between the block and the at-work bar.
The user asked on 31 October to disable the arrival marks for now while marks tied to Versions are considered: a page that comes back mostly green, with no easy way to toggle it, is the wrong default. application.js no longer mounts since-seen.js; the call and its import are commented out, with a note saying how to restore them, and the module's header says it is turned off. No tab posts `seen` now. The server's reading of `seen`, the event kind and `leaf page state`'s field are unchanged. Compare in Versions still marks what changed since the version it names, with the green bar beside each block, and `h` walks those marks. The agent reference no longer tells agents that the user's page marks what changed since they last saw it, so a reply about recent work lists its changes again. The contracts that described the browser's marking (read_state.py, events.md, the state schema, agent_state.py) say it is turned off. The feature gallery's guide now starts from Compare. Tests: the six arrival tests are skipped until the marking returns. The change-bar, `o` and lane checks, and the `h` walk, move to a new test that marks through Compare in Versions.
# Conflicts: # dist/kernel/kernel.json
leaf-agent
approved these changes
Nov 1, 2026
This was referenced Nov 1, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 1, 2026
The export audit reproduces eight unread exports on main. Keep local layout, outline and screenshot helpers private and remove unused facade re-exports. Remove the selectable-element helper's export too, since its only external reader was the unused facade. Remove the dormant arrival-marking implementation and its unused comparison entry points. #4890 deliberately stopped mounting this owner; arrival marking remains off, and the Versions picker still starts and ends comparisons. This removes the dead implementation rather than weakening the audit or restoring the disabled default. The kernel is rebuilt. Validation: the existing export audit fails before the change and passes afterward; all 737 runtime tests, the browser build check, and the browser test for comparison bars and the `h` walk pass. Reviewed the diff and searched the removed exports' consumers. Closes #4947 — automated triage Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 2, 2026
Comparing a page with an earlier version after the agent rewrote one section put a ⇄ Change margin entry beside every heading, paragraph, table cell and option in it: 28 entries for one rewrite on the page that prompted this, stacked down the margin, and `h` stopped at each one. That page was marked on the user's return, which #4890 has since turned off; Compare in Versions marks the same way. The version comparison now groups the blocks it marks into changes. A change is a run of changed blocks with no unchanged block between them in page order, as a diff's hunk is a run of changed lines, and it ends where a view does: a `details`, a declared view (`x-views`, such as a tab), or the content a disclosure control names in `aria-controls`, such as a settled options group's options behind its row. Each block keeps its bar (#4890's `margin-bars.js` now draws one per block of each change). `comparisonChanges(owner)` returns changes, each the array of its blocks, so a change gets one margin entry beside the block it starts with, one stop of `h`, and one in the Δ counts on tabs and settled choices. The notice a comparison gives says "2 changes since v9" where it said "28 changed passages since v9". A change's margin entry opens and closes all its blocks' inline comparisons together, and its Page Map row counts the parts a reader sees: "heading and 5 more changed since v9", with a table counting once. To group well, the comparison now lines up the two versions' blocks in document order with jsdiff's `diffArrays`, which the runtime already bundles. It used to count a block unchanged wherever the base held its words, so a short cell such as "No" that another table also held stayed unmarked and split a rewrite, while the other table's cell was marked. A block inserted with words the diff removed elsewhere has only moved and stays unmarked, as before. Past 1,000 block edits the comparison falls back to the one-pass reading, which keeps a long page rewritten whole fast. Known gaps: a rewrite that keeps one short block identical in the same place, such as a "No" cell in both the old and the new table, splits into two changes, and a rewritten section whose new blocks share no ids with the old one shows none of the old text when its entry is pressed. Tests: the inline-diff test reads log-retention's rewritten paragraph and the new paragraph after it as one change that one press opens. The script-words test finds the closing paragraph's inline diff through the change its three reworded paragraphs make. New tests, driven through Compare in Versions, hold a rewritten section to one margin entry and one walk stop, with an untouched table that shares a word left unmarked, and keep a change in a closed `details` or a settled options group apart from the visible one after it. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
pushed a commit
that referenced
this pull request
Nov 17, 2026
Hiding or showing annotations (`o`) restyled every element of the page. `annotation-layer.js` stated the hidden layer on `html`, and two rules read it there. One set a custom property on `html`, `--lf-change-bar: transparent`, which every element inherits; the margin's change bars and the contents map's changed stretches read it. The other hid the margin's pins through a descendant combinator from `html`, which makes Firefox visit every element to find them. On #4781's shape, 1.5 million elements, each `o` took 2 to 3 s of Firefox's main thread. The attribute now stands on the chrome's root, which holds the margin's pins and bars. The contents map, which stands in the page, reads it there through `:root:has()`. ## Change - `setAnnotationsHidden` (annotation-layer.js) toggles `data-lf-annotations-hidden` on the chrome's root (`chromeRoot`, chrome.js) instead of writing `data-lf-annotations="hidden"` on `html`. - The margin's change bars hide by a rule in the chrome's scope, `:scope[data-lf-annotations-hidden] .lf-change-bar` (chrome.css), and the pins' rule (annotation-theme.css) reads `.lf-chrome[data-lf-annotations-hidden]`. `--lf-change-bar` goes: it existed only as the switch. - The contents map's changed stretch reads `var(--lf-change)`, and `:root:has(> .lf-chrome[data-lf-annotations-hidden]) lf-toc …[data-lf-toc-changed]::after` makes it transparent, so it still hides with annotations, as its margin bar does. toc.css's header records that the stretch is a change mark. Firefox now visits only the chrome's elements for the margin's rules, and Chromium restyles only the pins, the bars and the stretches. ## No look change Each pair below is pixel-identical between main and this branch, at rest and after `o`, in Chromium and Firefox: `contents-marks-changes` at 1440×900 (the side map), 900×700, and 600×900 (the column outline), from `uv run leaf-dev probe --state contents-marks-changes [--do press:o] --base --shot --browser B --viewport V`. With annotations hidden, the map's changed stretches are transparent on both arms, and the spine's rule shows through them unbroken. `uv run leaf-dev stills --base` on `contents-marks-changes`, `contents-marks`, `margin-gallery` and `margin-reaction-mark`: unchanged in Chromium and Firefox. ## Call Max could take instead `o` could leave change marks to `v`, keeping both the margin's bars and the map's stretches drawn while annotations are hidden. That would drop the map's `:has()` rule and the bars' rule, but it reverses #4890, which made a change's bar an annotation. ## Evidence A scratch script (not committed) builds the bench's `side_documents(224)` with `DOCUMENT_STEPS = 25000`, 1,512,344 elements, as #6227 did, serves it from each arm, rests the pointer halfway down the open document, and presses `o` eight times, 400 ms apart. Main-thread CPU per press, as the bench reads it (`main_thread_clock`), less the idle rate: | | main (2685a32) | this branch | |---|---|---| | Firefox, Playwright's build | 2,059–2,949 ms | 10.4–17.8 ms | | Chromium | 64–74 ms, one recalc of 5,326 elements in 54 ms | 10.1–19.4 ms, the largest recalc 7 elements | With only the custom property removed, Firefox read 38–45 ms, so the pins' descendant rule from `html` cost about 25 ms of it. The map's `:has()` rule adds no cost these readings separate from noise: without it Firefox read 8.6–18.3 ms. Chromium's recalc on main counted 5,326 of the 1.5 million elements, which suggests it leaves the closed tabs' documents unstyled, where Firefox's 2 to 3 s suggests it restyled them all; no Gecko profile was taken to confirm that. ## Tests - `test_hiding_and_showing_annotations_restyles_only_the_chrome` (tests/browser/test_chrome_contracts.py) counts the elements Chromium restyles as `o` hides and shows the layer, and requires under a quarter of what a custom property changed on `html` restyles. It guards against `o` setting an inherited property on `html` again. Run against main's code it fails earlier, on waiting for the chrome root's attribute, which main never writes. Firefox visiting the page for a rule read through a descendant combinator restyles nothing, so no count here sees it. - `test_each_contents_row_marks_where_its_section_s_threads_on_me_and_changes_stand` (widgets/test_contents_and_glosses.py) now presses `o` with the changes view on and reads a changed row's stretch transparent, then drawn again after a second `o`. It fails without the map's rule. - The tests that waited for `html[data-lf-annotations="hidden"]` wait for `CHROME_ROOT`'s (render_harness.py) `data-lf-annotations-hidden`: test_draft_editing.py, test_comment_marks.py, test_composing.py, margin/test_pins.py, and journeys/margin/test_pins.py. Their absence checks read any value (`re.compile(".*")`) or the empty value, so each fails while the attribute stands. Ran `pnpm run test:runtime` (997 passed), `pnpm run check:browser`, pre-commit on the changed files; every browser and journey test that presses `o`, reads the annotations attribute or a change bar (20 passed, test_changes_in_place.py's three included); and the contents widget's browser tests (34 passed). Not run: the whole suite, WebKit. Not checked: Max's own #4781 page rather than its generated shape, and a desktop Firefox other than Playwright's. 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.
Follows #4809 (changes in place). Three changes to how Leaf marks what changed, and one switch-off.
Marking what changed since the user last saw the page is turned off for now. A page that comes back mostly marked, with no easy way to toggle the marks, is the wrong default while marks tied to Versions are considered.
application.jsno longer mountssince-seen.js(the call and its import are commented out, with a note on restoring them), so no tab postsseen. The server's reading ofseen, the event kind andleaf page state's field are unchanged. The agent reference no longer tells agents that the user's page marks what changed since they last saw it, and the contracts that described that marking say it is off. The six arrival tests are skipped until it returns.A change is marked with a bar beside its block, not a wash over it. The wash painted the block's own background, so it covered whatever the block shades itself: an option's card, the chosen option's green (the tint's own hue, so every option read as chosen), a board card, a draft's box, an aside. Each changed block now gets a 3px green bar in the margin, drawn over the page by the same painter as the at-work bar, in a lane of its own (4px from the block; the at-work bar stays at 10px).
at-work.jsbecomesmargin-bars.js, the one owner of bars beside a block. Compare in Versions uses it.The marks are annotations.
ohides them with the other annotations, and the Escape step and "Stop marking changes" row are gone; a Compare ends with its own button.A comparison's base is always a stamped version.
revisionBasetakes only a stamped entry, so the "since 3:58 PM" name for an unstamped revision is gone. The dormantsince-seen.jscounts from the newest version stamped at or before what the user saw.Tests: a new browser test marks through Compare in Versions and checks the bars, the block's background staying clear,
ohiding a bar, thehwalk, and the change bar standing between the block and the at-work bar.