Repository navigation
Open a stills state in probe with --state, and run stills through probe's loop in any engine - #5259
Merged
Merged
Conversation
…be's loop in any engine `leaf-dev probe --state NAME` opens one of the states `leaf-dev stills` compares: the state's page, in its window (run options override it, as in stills), brought there by its input, before probe's own `--do` steps, `--js`, `--journey` and readings run. The separate `--do drive:NAME` namespace is gone. It took a driver name, not a state, so the caller had to pick the right source and window; nothing in the tree used it beyond probe's own help, which now names `--state`. Stills and probe share one per-arm loop, `probe.visits`: serve the page from each arm, open a fresh tab in the run's engine, load it, run the state's input and any steps, settle, and hand the tab to the command's reading, keeping every arm's tab open until the command is done with them. A stage that fails records its error on that arm's visit and the next arm still runs. Stills is that loop plus its comparison: its own reading (`capture`) takes the screenshot, region, styles and baselines, and the comparison reads both arms afterwards as before. One definition of a state: `State`, its drivers and `STATES` move out of `stills.py` into `dev/leaf_dev/states.py`, which both commands import, unchanged apart from at-rest states, which now have no driver (`drive=None`) instead of the no-op `at_rest`. `stills.py` keeps the capture and comparison. Stills takes probe's engine option, `--browser chromium|firefox|webkit| ios`, now declared once beside `tab_options` (`browser.engine_option`) and opened by one function (`browser.launch`). A state whose input an engine can't run fails that state with the reason: any input, or the held runtime of `worktree-startup`, on the iOS simulator, and a touch state in Firefox, which refuses Playwright's mobile emulation. The comparison tab opens in the capturing browser, or in a Chromium shell when the iOS simulator took the stills; declarations, which need Chromium's inspector, are listed only in Chromium. The simulator's Safari answers `evaluate` and `screenshot` as a Playwright page does (`ios_safari.Tab`), so probe's `--js` and `--shot`, and stills' reading of an at-rest state, read it without a branch of their own. Behavior changes beside these: - Probe's Chromium shows scrollbars as readers see them, as stills' already did, including the room a classic bar takes on Linux. - Probe reports any exception that stops an arm as that arm's `failed` and runs the next arm; before, only Playwright, WebDriver, readiness, assertion and Click errors did, and anything else ended the command with a traceback. A `leaf` command's failure reads as its last line, as stills already reported it. - Probe keeps the base's tab and server open while the head runs. - `probe --browser ios` refuses `--do` steps and a `--journey` per arm, through the loop's rule, rather than before building. - Stills and probe list `--state NAME` without enumerating every state in `--help`; a wrong name still lists them.
…lding; give probe --authored and tracebacks
leaf-agent
approved these changes
Nov 3, 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.
leaf-dev probe --state NAMEopens one of the statesleaf-dev stillscompares: the state's page, in its window (--viewportand--touchoverride it, as in stills), brought there by its input, before probe's own--dosteps,--journey,--jsand readings. The--do drive:NAMEstep is gone. It named a driver rather than a state, so the caller had to pick the right source and window; nothing in the tree used it beyond probe's own help, which now names--state. Probe also takes stills'--authored, so a driven state can be compared across an edit to its page's markup, whichdrive:NAMEon a copied example did before.One loop, one definition of a state
Stills and probe run one per-arm loop,
leaf_dev.visits: serve the page from each arm, open a fresh tab in the run's engine, load it, run the state's input and the command's steps, settle, and hand the tab to the command's reading. It yields each arm's visit as it ends and keeps every tab open until the command is done, since stills reads both arms' tabs for its declaration list. A stage that fails ends that arm's visit with its error and the next arm still runs. Stills is that loop plus its comparison: its reading (capture) takes the screenshot, region, styles and baselines, and the comparison is unchanged.State, its drivers andSTATESmove out ofstills.pyintodev/leaf_dev/states.py, which both commands import. The catalogue is unchanged apart from at-rest states, which now have no driver (drive=None) in place of the no-opat_rest.Stills in every engine
Stills takes probe's engine option,
--browser chromium|firefox|webkit|ios, now declared once besidetab_options(browser.engine_option) and opened by one function (browser.launch). In Firefox against main, stills capturedplan-card-keyboard,plan-panel,ship-thread-open,review-a-planand the touch stateplan-versions-touch, and read all five unchanged.A state an engine can't reach fails with the reason, before its page is built, rather than hanging or being skipped. The one held-runtime state,
worktree-startup, shows only in Chromium: Playwright's Firefox and WebKit never resolvedocument.fonts.readywhile the entry module is held, and their screenshots wait for it, so it would hang there. Safari on the iOS simulator takes no input, so every state with one fails there. The simulator's Safari answersevaluateandscreenshotas a Playwright page does (ios_safari.Tab), so probe's--jsand--shotand stills' capture of an at-rest state read it the same way; stills capturedreview-a-planandtriage-boardthere, unchanged against main.ios_safari.evaluatenow takes a function source ending in;, as Playwright's does, whichstills_baselines.jsis. The comparison tab opens in the capturing browser, or a Chromium shell when the simulator took the stills; sync Playwright allows one driver per thread, so a Firefox run can't also open a Chromium. The declaration list needs Chromium's inspector, so stills writes it only in Chromium.Other behavior changes
failedand runs the next arm, and writes its whole traceback under.tmp/probe/, named by a newtracebackfield. Before, only Playwright, WebDriver, readiness, assertion and Click errors were reported, and anything else ended the command with a traceback. Infailed, aleafcommand's failure reads as its last line, as stills reports it; the traceback holds its whole output.--browser ios, probe refuses only--record;--viewport,--touchand--motionare the iPhone's own there, in both commands.--state NAMEwithout enumerating every state in--help; a wrong name still lists them.Checked
In Chromium, stills read
worktree-startup,plan-panel,ship-thread-openandreview-a-planunchanged, andplan-card-keyboardchanged by 7,368 px: the root's overlay scrollbar thumb, caught mid-fade in one arm, the arm differing between runs. Main's own stills code reads the same 7,368 px on that state, so the difference predates this change.probe --state plan-card-keyboard --browser firefox --base --authoredreached the open card with focus in its reply on both arms, andprobe --state worktree-startupread the page before its runtime upgraded it.dev/tests/model/test_stills.py, including a new case for a state an engine can't reach, and probe's recording journeys pass.