Repository navigation
Sample the panel's fold as a probe journey, and profile bench-latency's transitions with --profile - #5264
Merged
Conversation
…'s transitions with --profile Two leaf-dev commands become modes of the ones they duplicated. `bench-panel-motion` becomes `run(page)` in `dev/leaf_dev/panel_paint.py`, the module that already held the mark and ring readers, run as `leaf-dev probe SOURCE --journey dev/leaf_dev/panel_paint.py`. It returns the same readings and load averages, and now takes probe's `--base`, `--record` and any SOURCE. To read any page, it makes the body transparent before sampling: the chrome stands beside the body, so only the panel's pixels reach the crop. On review-a-plan without that, page ink matched the ring's grey and the keyboard fold read a 250 px ring separation. `profile` becomes `bench-latency --profile`, which traces and CPU-profiles every transition the run selects and prints profile's attribution after the table, per page, transition and arm, with the arms side by side under `--base`. `--marks` is gone: the user-timing marks section always prints under `--profile`. The `Session.recording` hook, whose only other user was `profile`, becomes the profiling itself, and `scaling` imports `Profile` from `bench_latency`. `go_to_threads` returns when Threads is already open. Completing `g T` again closes the view (keyboard/go-to-sequence.js), so `bench-latency`'s reply transition, which asks for Threads after `open()` has opened it, timed out on main, alone or after a move, and so did `profile SOURCE reply`. Behaviour changes for whoever ran them: `leaf-dev bench-panel-motion`, `leaf-dev profile` and `profile --marks` no longer exist.
…the benchmark's window A screencast's first frame can show the page from before it started, stamped with its start. The journey now runs one screencast across its four routes and gives each route the frames swapped between its input and the end of its motion, so no route reads a stale first frame: bench-panel-motion's `.` fold reported `missing_ring: 1` on every bare-page run from that frame, and on review-a-plan the stale frame's On me count, in the ring's accent, read as a 488 px ring separation. `--profile` now reads the trace over the benchmark's own window, placing the transition's start on the trace's clock through a goal's mark, rather than from the last keydown or, for an agent write, the trace's first span, which counted the `leaf` command's startup.
…re the routes with the fold test
leaf-agent
approved these changes
Nov 3, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
This overlaps #5244, which renames the panel's data-open to data-lf-open and edits go_to_threads's wait_for line. Git won't report a conflict between the two hunks, so if #5244 lands second it keeps this PR's new get_attribute("data-open") == "threads" early return. That check would then never match, and the reply transition would close Threads again and time out, as it does on main today. If this PR lands second, the rebase needs the same rename.
max-sixty
added a commit
that referenced
this pull request
Nov 4, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 4, 2026
… a page's CSS can't name (#5244) Leaf wrote 84 data attributes on its own elements outside the `lf-` namespace that `page check` reserves for it: the floating panel's state (`data-open`, `data-rest`, `data-shown`, `data-expanded`, `data-tone` and two dozen more), a thread's and a message's identity (`data-thread`, `data-event`, `data-message`, `data-attempt`), the paint boxes' `data-for`, the composer's `data-words` and send corner, and the parts the bundled widgets draw: lf-code's line numbers and elided rows, lf-tabs' scroll buttons, the trace timeline's marks, the timeline's events, the deck's pips, the call diff's lines and the diff's file rows. It also wrote the `scroll` class on its own scroll surfaces. A page's own CSS for one of those names restyled Leaf. On a probe page whose `<style>` held `[data-tone] { --warn: red }`, `[data-event] { --lf-msg-text-end: 123px }`, `[data-line] { background: blue }` and `.scroll { outline: 4px solid magenta }`, main painted the panel's away leaf red (rgb(255, 0, 0)), gave a margin card's messages a 123px text end, painted lf-code's lines blue (rgb(0, 0, 255)) over its highlight, and outlined lf-tabs' strip and panel, lf-code's scroller and lf-options' "Add another option" field in magenta (4px rgb(255, 0, 255)). The chrome's `all: revert-layer` guard stops a plain declaration but not a custom property, and a widget's parts in the page have no guard at all. Each is now the same name under `data-lf-`, its values unchanged, except where that name already meant something a document-wide reader or an unscoped rule relies on: - the panel view's `data-view` became `data-lf-route`, since prepaint.js sweeps `[data-lf-view]`, a revision's view members; - the panel status's `data-held` became `data-lf-held-lines`, since thread/presentation.js strips `data-lf-held` from every node no thread holds; - an On me item's `data-obligation` became `data-lf-obligation-id`, since obligations/view.js sweeps `data-lf-obligation`, the location mark, and chrome.css gives every `[data-lf-obligation]` a landing margin; - the composer field's `data-scrolls` became `data-lf-overflows`, the name the margin card's transcript already gives the same fact, since reach.js writes `data-lf-scrolls` on that field too. Where the prefixed name was already in use for the same kind of fact on other elements (`data-lf-tone`, `data-lf-state`, `data-lf-open`, `data-lf-unread`, `data-lf-place`, `data-lf-ready`, `data-lf-line`), every selector and query names its element, so the uses share a word without meeting. The video bar's `data-hovered` and `data-keyed`, built from one template, are `data-lf-hovered` and `data-lf-keyed`. The `scroll` class stays the page's: page-authoring.md tells an author to add `class="scroll"` to a custom horizontal scroll box, and `page check` would refuse `data-lf-scroll` in markup. Leaf's own surfaces, and a package module's (module-scroll-and-motion.md now says so, as it already did for `data-lf-track`), wear `data-lf-scroll`, and reach.js and the shared containment rule in controls.css read both. Where the runtime marks an element the page owns (a code block, a part beside the Layout's views, a bounded block's body), the mark joins `RUNTIME_PAINT_ATTRIBUTE`, so a reading of the author's attributes looks past it, as it did past `class`. Kept as they are: the attributes an author writes (`data-width`, `data-height`, `data-bound`, `data-sample*`, `data-annotations`, `data-rail`, and `data-room`, which Leaf's own controls also use, one rule for both), the playground's `data-playground-*` on its host, which the author's preview CSS reads by design, Pierre's attributes on the DOM it renders (`data-line`, `data-line-type`, `data-code`, `data-content`, `data-separator` and the rest), including the ones lf-diff copies onto its own rows and `pre` so Pierre's vocabulary keeps reading them, and the diagram's `data-id`, which pele writes. On the same probe this change shows Leaf's own styling: the away leaf in the theme's warn (rgb(180, 116, 26)), the message's own 13px text end, lf-code's lines unpainted but for the highlight, and no outline on any widget part. Nothing changes on a page that doesn't target the old names, and specificity is unchanged: each `[data-x]` became `[data-lf-x]`, and `:where(.scroll)` became `:where(.scroll, [data-lf-scroll])`. Tests and dev tools read the new names. Attributes a test gives its own fixture, which only share a word with Leaf's, stay: the `data-row` key test_focus.py, focus.test.mjs and an application-boundary widget hand to `holdFocus`, a test widget's `data-words` and `data-ready`, the shift watch test's `data-key` on `body`, the write watch test's `data-for`, and the examples' own `data-state` and `data-status`. The shift and words watches' expected node paths lose the `.scroll` class (`leaf-text#field`, `lf-diff#patch.lf-rendered`), and reach.test.mjs asks a native code block for `data-lf-scroll`. ### Checks - Main is merged in, and with it three new readers of the old names, which now read `data-lf-obligation-id` (the On card selector, `ON_CARD`), `data-lf-key` (the queue walk), `data-lf-event` (undo's message lookup) and `data-lf-number` (a text document's line number, in #5226's lf-text-document code and test). #5249's change bars write theirs as `data-lf-for`, `data-lf-gap` and `data-lf-kind`, the stills drivers that moved to `dev/leaf_dev/states.py` in #5259 read the new names, as do #5263's fold test (`data-lf-says`, `data-lf-rest`) and #5264's dev browser helper (`data-lf-open`). - The pull request's `test` job: its failures outside the journeys fail on main too; of the journeys, `test_the_feature_gallery_exercises_its_core_journeys` failed here because the test read the gallery's own preset buttons as `data-lf-route`, and now reads the author's `data-view`. The pressed-controls sweep's 28 cases, `test_an_aimed_comment_keeps_its_place_with_on_me_open`, and the navigation, controls and website-server journeys that failed fail the same way on main. - `pnpm run check` and `pnpm run test:runtime` (753 pass), pre-commit over the changed files, and the kernel rebuilt with `pnpm run build:browser`. - 67 browser tests, by node id, that read the renamed attributes: the floating panel's status peek, passing notices, versions, menu lists and Threads' New; thread summaries, attempts, failure receipts and message obligations; reactions; the send corner; the shift and words watches' field paths; reach for an authored `.scroll` box; the trace timeline and overview; timeline steps; lf-code excerpts and text-document numbers; the diff's cut path; the call diff; overflowing tabs; On me cards; rings and aim; a board's lifecycle; the recording bar; the smoke tier's three changed tests; and read state. `test_a_pointer_folds_the_panel_from_its_corner` fails the same way on main: the corner button calls `foldPanel` directly, so no `lf-command-invoked` arrives for the test to read. - `leaf-dev stills` over the 61 catalogue states that draw the renamed attributes found no computed style that differs; the style lists only re-key the elements that lost the `scroll` class. Stills differ only where every run differs: About's fingerprint and port, a caret's blink, an overlay scrollbar's fade, and a target trace one arm caught mid-transition, in the other arm on a second run. The stills drivers name the new attributes, so for this comparison 21 states drove the merge base's runtime through a local patch that accepted either name. > _This was written by Claude Code on behalf of max-sixty_
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.
Two
leaf-devcommands become modes of the ones they duplicated:bench-panel-motionis now a probe journey, andprofileisbench-latency --profile.The panel's fold, as a probe journey
dev/leaf_dev/panel_paint.pyalready held the mark and ring readers that the floating-panel test uses. It now also definesrun(page), so the sample runs asIt returns the old command's readings for each of the four fold routes: frames, intermediate mark positions, frames missing the mark or the ring, and the greatest mark-to-ring separation, plus the load average before and after. Through probe it also takes
--baseand any SOURCE. The floating-panel test imports the journey'sROUTESrather than repeating them. Two things about the reading changed:.fold reportedmissing_ring: 1on every bare-page run, and on review-a-plan a stale frame showed a count in the panel's row drawn in the ring's accent, which read as a 488 px separation. One screencast now spans all four routes, and each route takes the frames swapped between its input and the end of its motion, after the setup has come to rest. The journey waits for late frames before the screencast stops.Readings on one build, the merge base's runtime: the old command on the bare page it used, then the journey on that page and on review-a-plan. Each cell is frames / intermediate positions, plus missing ring and separation on the keyboard routes. No run missed the mark.
.The Mac was heavily loaded (1-minute load 13–17 for these runs, up to 59 earlier in the session), and every run went through
taskpolicy -b. Frame delivery depends on scheduling, so these runs show that the journey reads what the command read, less the stale frame's missing ring. They don't measure the motion.profileasbench-latency --profile--profiletraces and CPU-profiles every transition the run selects, using the same pages, transitions, runs and arms as the timing. After the table it printsprofile's attribution for each page, transition and arm, and with--basethe arms side by side. The window is now the benchmark's own window: the transition's start is placed on the trace's clock through a goal'slf-bench:mark.profilebegan an agent write's window at the trace's first span, so its reading included theleafcommand's startup: under that rule a reply the table timed at 271 ms read 1782 ms in the profile. On one run the two now agree: move 278 / 277.6 ms, reply 438 / 437.5, revision 1198 / 1197.8.--marksis gone. The user-timing section always prints under--profile. TheSession.recordinghook, whose only other user wasprofile, became the profiling itself, andscalingimportsProfilefrombench_latency.browser/AGENTS.md,bench_check.pyand the responsiveness note now namebench-latency --profile.go_to_threadswhen Threads is already openCompleting
g Tagain closes the view (keyboard/go-to-sequence.js).bench-latency's reply transition asks for Threads afteropen()has already opened it, so on main it timed out waiting for the Threads view, whether reply ran alone or after a move.profile SOURCE replyfailed the same way.go_to_threadsnow returns when the panel already shows Threads.Not changed
bench-latency --page corpusfails on main as it does here. The firstsettle()after the page loads, before anything this change touches, reports "the page never settled within 30s": main'sbench_latency.pyand this branch's each failed 2 of 2 alternating runs at load 6–16. Probe reads the corpus as ready, so the wait is probably in the request ledger thatquiet()inbench_latency.jschecks. That is left for a separate change.Removed for whoever ran them:
leaf-dev bench-panel-motion,leaf-dev profileandprofile --marks.