Repository navigation
Keep the interaction gallery's contained frames out of the page's focus and its exported copy - #383
Conversation
…us and its exported copy Each contained replay runs a whole second Leaf page, and a Leaf page arrives: it restores the workspace the reader last had open and puts them on its own body. Neither is the frame's to do. A document has one focus, so focus taken into the frame is focus taken off the page the reader is actually on — which folded an open margin cluster, dropped the selection hints, and sent the next key somewhere invisible. `data-lf-contained` now marks both sides of that boundary, the frame element in the gallery and the body of the page inside it. A contained page restores no arrangement and places no focus, and the bake drops the frame with the scripts, since its document names a runtime, theme, and adapter that a standalone file has no server to fetch. The gallery's chord caption lives with its own visibility for the same reason, so an exported copy holds no words it can never show. Two readings the expanded gallery moved are restated: its swipe specimen sits in an unselected tab, so one row is withheld and the posture clear runs for it.
leaf-agent
left a comment
There was a problem hiding this comment.
The arrival half holds up: with restoreArrangements() and letGo() skipped, test_a_contained_replay_leaves_the_page_around_it_standing passes here (uv run pytest tests/test_site.py -k contained_replay), and that is what the 14 nightly readings were failing on. The finding below is about the third guard and the invariant the PR writes down beside it, not about that fix.
A contained page does still place focus, and the outer page does still lose it — just later, when the Threads replay runs rather than at arrival. Measured on this branch, driving the gallery's Open and close Threads tab and reading the outer document while the framed panel stands:
ACTIVE WHILE PANEL OPEN: ['IFRAME', '', True]
The reader was standing on the tab they had just pressed (document.activeElement === tab holds immediately after the click, as test_the_interaction_gallery_drives_real_widgets already asserts for the Move a card tab); once the frame opens its panel, the tab no longer holds it.
Also worth knowing before either lands: #378 rewrites this same frame construction — frameSource and the srcdoc assignment both go, replaced by a written document — so <body data-lf-contained> and the toggleAttribute beside this.frameElement.srcdoc are both on lines that PR deletes. The conflict is mechanical, but the failure mode of a careless resolution is silent: drop the body mark and containedPage reads false everywhere, with only the new test standing between that and the nightly reds coming back.
|
The same cause took Two are not in this PR's list, and they reach the frame's stolen focus through a swallowed key rather than a lost hint, so they are worth checking against the fix here rather than assuming:
Both are the gallery, both press a page-level chord with no explicit focus placed first, and a chord goes to
The three reactions readings are #385 — #371 retired the |
…tired (#385) ## Problem The nightly leg of [`ci` on `e0b2563`](https://github.com/max-sixty/leaf/actions/runs/34089008067) went red on 21 readings. Three of them are the reactions module asserting a paint #371 deliberately retired: `test_selected_reactions_keep_neutral_button_furniture[light]`, `[dark]`, and `test_a_copy_keeps_a_standing_reaction_as_a_mark_and_drops_the_press`, all failing on `assert ... MARGIN_STATE_WITNESS ... is True` → `assert False is True`. #371 left the lifecycle corner mark to `busy` and took `settled` out of `BUTTON_GRAMMAR` entirely, dropping the `marginButtonState(pill, "settled")` call from `paintReactionStanding` and the `[data-lf-state="settled"]::after` rule from `chrome.css`. It restated `test_render_margin.py` for that, including the note that "a standing reaction mark exists only while its reaction stands, so its presence is the whole of what it says and it carries no lifecycle paint on top" — but `test_render_reactions.py` is nightly-only and #371 touched no file that would have made CI run it, so the three readings there went unseen until main had already moved. ## Solution The tests, restated to what #371 shipped. `MARGIN_STATE_WITNESS` becomes `PAINTS_LIFECYCLE_MARK`, since since #371 `busy` is the only state that paints one and the reactions module now reads its absence. The palette pill reads from the fill it holds with the pointer parked at the origin. Hover lays down the same `var(--chip)`, so the fill alone cannot separate them — what can is that a standing pill keeps it once the pointer has gone, and that is where every reading in `assert_selected_face` was already taken. One assertion is added so the comparison cannot go vacuous: `neutral_hover["fill"] != resting["fill"]`, because if hover ever laid down the resting fill then `selected` would collapse into `resting` and the whole sequence would hold of a pill that painted nothing. The seated mark in an exported copy reads the absence of a witness on both sides of the pointer. Its presence is already asserted by the `glyph` comparison above it; what the pointer half owes is that no paint arrives with the cursor, and a lifecycle witness in a file would state a state nothing in a file can leave. **Not this branch's**: the other 18 readings. Fourteen are the contained-frame focus cause #383 is already carrying, plus `test_draw_mode_cursor_matches_the_widget_controls_it_captures` and `test_the_feature_gallery_exercises_core_reader_workflows`, which are the same cause reached through a swallowed `page.keyboard.press` rather than a lost `.lf-target-hint` — commented on that PR. `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` is the separate `pageSettled` timeout #383's body already names as a red main of its own. `test_a_reload_mid_flight_never_wedges_round_trip` is unclassified. ## Testing `uv run pytest tests/test_render_reactions.py -q -n0` — 46 passed, where the three named readings fail on `main`. `uv run pytest tests -q` — 901 passed, 6 skipped. `pre-commit run --files tests/test_render_reactions.py` clean. Bug-backed: with `.lf-margin-button.lf-react[aria-pressed="true"]`'s `background: var(--chip)` replaced by `transparent`, both parametrized furniture cases fail on `'fill': 'rgb(45, 41, 34)' != 'rgba(0, 0, 0, 0)'` — the restated reading still catches a standing pill that stops painting. --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/34089008067) Co-authored-by: leaf-agent <[email protected]>
|
@leaf-agent fix conflicts |
The panel guard in `showPanelLayer` could not do what it was written for. `panel.show()` runs the browser's dialog focusing steps before the guard's `invoker` is ever read, so by then the outer document's `activeElement` is already the `<iframe>`; nulling the invoker only chose which element inside the frame kept focus. Measured on the gallery's `Open and close Threads` tab, the reader standing on the tab they pressed lost it the moment the framed panel opened, and `g T` and `w` then went to a document they could not see. A contained page cannot hand focus back — only the document around it knows where the reader was standing — so every call into a frame now returns through the gallery, which puts the reader back on what they were holding, or blurs the frame when they were standing nowhere in particular. The frame's own chrome is left free to run the platform's focusing steps behind the picture. The claim in `context.js` and `assets/CLAUDE.md` narrows to match: a contained page arrives without arrangements and without placing focus, and focus its chrome places later is the gallery's to take back.
# Conflicts: # skills/leaf/assets/runtime/interaction-gallery.js
|
Correcting myself above: the ring census is not unowned — #373 is carrying it, and its diagnosis is the one I reached independently before finding it. The wedge is So of the 21: 16 are this branch's, 3 are #385, 1 is #373, and |
|
Conflicts are clear — the branch is mergeable at The review's finding is fixed rather than argued: the
|
leaf-agent
left a comment
There was a problem hiding this comment.
The arrival half and the export half both hold up, and the reclaim is the right shape — the finding below is one gap inside it, not an argument against it.
keepsReaderStanding puts the reader back with a bare stood.focus(), which silently does nothing for the destinations focusDestination exists for. Where the reader is standing on an element that is not natively a tab stop — a heading or fold a g hint landed on, a version swap's handback, the reference's handback, the skip link's banner landing — focusDestination lent it tabindex="-1" and registered a one-shot blur listener that takes the lend away again. The frame taking focus fires that blur, so by the time the finally runs, stood is no longer focusable and stood.focus() is a no-op; the else frame.blur() branch is not reached either, because stood is still connected. The reader is dropped, and lands on body at the next wrapped call.
Measured on FEATURE_GALLERY, standing the reader on #bg-interactions-title the way keyboard/address.js does and then running the Open and close Threads replay:
# on b76c3650
AFTER PANEL OPEN: {'active': 'BODY', 'id': '', 'tabindex': None}
AFTER COMPLETE: {'active': 'BODY', 'id': ''}
# with focusDestination(stood)
AFTER PANEL OPEN: {'active': 'H2', 'id': 'bg-interactions-title', 'tabindex': '-1'}
AFTER COMPLETE: {'active': 'H2', 'id': 'bg-interactions-title'}
tabindex: None on the first is the lend already gone. Chords still reach the outer page either way, so this is not the swallowed-w shape — it is the reader losing the place they addressed, which is the half assets/CLAUDE.md now states as a layer contract ("only the page around the frame knows where the reader was standing").
The inline suggestion needs the import widened alongside it, since the line won't resolve on its own:
import { focusDestination, offer, reserve } from "./widget-elements.js";focusDestination is safe for the cases the current line already handles — a body or a control that is focusable returns on its first focus() without lending anything.
|
Closing the caveat I left above: |
The gallery takes the reader's focus back from a contained frame with a bare `stood.focus()`, which works only where they were standing on something that is natively a tab stop. Most of the places a reader addresses are not: a `g` hint, a version swap's handback, the reference's handback and the skip link's landing all put them on a heading or a fold that `focusDestination` lent `tabindex="-1"` to, behind a one-shot `blur` listener that takes the lend away again. The frame taking focus is that blur, so by the time the handback runs the destination is no longer focusable, `stood.focus()` does nothing, and the reader lands on `body` — while `stood` is still connected, so the `frame.blur()` branch never runs either. `focusDestination` is the layer's answer to the same question and re-lends the stop, so the reader gets their heading back. It is what the already-focusable cases were getting anyway: its first `focus()` returns without lending anything. The contained-replay reading now runs the Threads replay a second time with the reader standing where the go-to chord stands them, placed in the same synchronous step that starts the replay so no framed call can run in between. Without this change it reads `body` once the framed panel opens.
|
That also closes the loose end from my comment above: One reading from this run is worth adding to the swallowed-chord list I posted earlier, as a candidate rather than a confirmation. The twenty readings and where each landsReproduced on Reproduced on No longer reproducing on Both branches merge cleanly onto |
…frame (#394) ## Problem `ci` on main failed on [run 34084018735](https://github.com/max-sixty/leaf/actions/runs/34084018735) with 19 nightly failures. Most of them are the interaction gallery's contained frames taking the page's focus, which #383 fixes, and the reaction readings #371 retired, which landed as #385. Two survive on today's main (`e6adf0b2`) and neither is covered by either. `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` times out waiting for `pageSettled`, because the corpus never settles once the ring walk stands on a control in a docked margin cluster: `layoutMarginRows` floats that cluster out of static flow to read where it can hang and docks it back, a document tree has one focus, so the move blurs the control and the restore focuses it again — and `keyboard/dispatch.js` answers that pair by painting the standing chrome. That paint's layout asks for the next placement, so the page laid its margin out, rebuilt its whole key line and refolded its banner row on every frame for as long as the reader stood there. This is the second time this cycle has closed on a different edge; #298 cut the `dockSeats` one. #373 cuts the other edge of this same loop, and has the same ring test green: it keeps a docked row docked while the room it answered about holds, so `moveHost` is never reached in the case that loops. The two compose rather than compete — that one removes a caller's reason to move the host, this one stops any placement move from painting the standing chrome, so it also holds for the callers it does not touch (`float`, the inline `target.after`, and both branches of the Page-map render). Either can land alone and fixes the failing run; landing both is deliberate belt-and-braces, and neither is based on the other. `test_a_reload_mid_flight_never_wedges_round_trip` waits the corpus's whole answer-all cascade out inside one 30-second budget, and the corpus gained an ask in #354. The fact under test — that a ledger carried across a navigation does not wedge the new document — has already settled on that document's first trip. ## Solution `runtime.placingChrome` says a chrome placement is in flight, `moveHost` raises it around the move and the focus it hands straight back, and the focus painters skip while it stands. `moveHost` asks for the paint itself in the one case the placement really did move the reader: the control they were standing on did not survive it. The flag lives in `context.js` rather than beside `living-margin.js`'s existing `settlingOptionsFocus` because what has to know is every reader of where the reader stands, not just the options state machine. The gate test now waits for the new document's first trip rather than for its whole cascade, so the reading stops tracking how many asks the corpus happens to carry. It waits on the press's own attempt leaving the outbox's `pending`, which is delivery with retries folded in: `acked` is counted in a `finally` around the fetch, so a post that throws counts one and is retried, and an empty `pending` is only the momentary gap between the cascade's trips. ## Testing - `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`: red on `e6adf0b2`, green with this change. It is the gate — I could not reduce the cycle to a small fixture, and dropped a candidate regression test that passed with the change reverted rather than land coverage that says nothing. - `test_a_reload_mid_flight_never_wedges_round_trip`: red under `-n4` on `e6adf0b2`, green with this change. Its new reading still fails on a wedged first trip: with `/api/event` aborted on the reloaded document it gives up on `sends=16 acked=16 pending=1`, the shape `acked > 0` would have gone green on. - `uv run pre-commit run --all-files`. - The full `--run-nightly` run promised when this opened never got posted — that session ended before it finished. CI runs the nightly cases of `tests/test_render_gate.py` on this PR, the module it touches; the rest of the nightly suite the runtime change drives runs after main moves. <details><summary>How the cycle was found</summary> At the failing wait, `moving()` reported three running transitions on one `.lf-margin-button-label`, restarting continuously. A document-wide `MutationObserver` over one second on that page showed the whole chrome rebuilding at frame rate with nothing dispatched: 125 `lf-key` inserts and 125 removals, 52 `.lf-btn.lf-others` moves between `lf-banner-actions` and `lf-banner-menu`, 50 same-value `style` writes on `nav.lf-living-margin`, and 25 moves of one `.lf-margin-item.lf-docked` between `MAIN` and its `SECTION`. A stack captured inside a `focusout` listener named the mover: ``` at /runtime/living-margin.js:2073 | at moveHost (/runtime/living-margin.js:2379) | at moveExternalHost (/runtime/living-margin.js:2073) | at Object.float (/runtime/living-margin.js:1644) ``` with a second identical one from `Object.dock`, 50 focusouts per second between them, and `requestAnimationFrame` stacks from `paintHere` and from `layoutMarginRows`'s dispatch at 25 per second each. </details> --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/34084018735) --------- Co-authored-by: leaf-agent <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The handback holds: focusDestination re-lends the stop, and the second Threads run in test_a_contained_replay_leaves_the_page_around_it_standing is a real gate rather than a repeat of the first — the scenario ends on setThreads(false), so the .lf-panel wait it opens with is a wait. The two things I went looking for against the swap are both not there: focusDestination passes preventScroll: true on both of its focus() calls, and it never lends the outer <body> a stop it did not have, because keyboard/page.js already sets document.body.tabIndex = -1 at module scope, so the first focus() takes and it returns before the lend.
#393 lands a one-line fix for the half this PR spends a wrapper on. #393 sets body.inert = true in loadFrameDocument, immediately before body.replaceChildren(main) — the same line this PR inserts body.toggleAttribute("data-lf-contained", true) on, so the two conflict textually whichever lands first. Its body names the same symptom: "It also keeps gallery demo frames inert so their startup focus cannot swallow page shortcuts."
It looks like it covers what keepsReaderStanding is for. The panel is a non-modal dialog — showPanelLayer calls panel.show(), not showModal() — so an inert body leaves its focusing steps nothing to reach, and focus never crosses the boundary to be taken back. Measured on this branch: with that one line added and this.frameApi = keepsReaderStanding(frameApi, this.frameElement) replaced by this.frameApi = frameApi, test_a_contained_replay_leaves_the_page_around_it_standing passes and tests/test_site.py -k gallery is 6 passed.
So the question worth settling before either lands is whether the gallery still needs the wrapper once the frame's own body is inert, or whether inert is the deeper statement of what assets/CLAUDE.md now writes down — a contained page is a picture rather than a place to stand. The arrival half is unaffected either way: inert says nothing about restoreArrangements(), so the containedPage guard in leaf.js is still the thing that keeps a frame from opening the reader's stored workspace.
What I did not check
Whether inert changes anything else about a contained page — hit-testing behind the replay's drawn pointer, the accessibility readings, or the nightly modules this branch reaches. Only the two runs above, on this branch's tree with those two edits applied and then reverted.
|
One reading is new to the cluster and is in none of the lists above: It is not the first assertion that fails but the one after the undo: the approval lands, The fifteen readings and where each landsReproduced on Intermittent on Tracked elsewhere — 1: Method: every reading run with |
The gallery wrapped every call into a frame so it could put the reader back where they were standing once the framed chrome had taken focus. The platform already has the statement that wrapper was reaching for: an inert subtree ends a shown dialog's focusing steps before they reach anything, so the focus never crosses the boundary and there is nothing to hand back. `loadFrameDocument` writes the body inert beside the `data-lf-contained` mark, and `keepsReaderStanding` and its `focusDestination` handback go. The replays are unaffected, because they drive the framed chrome through the adapter rather than by pointing at it. The arrival half is untouched: `inert` says nothing about `restoreArrangements()`, so the `containedPage` guard in `leaf.js` is still what keeps a frame from opening the reader's stored workspace. The contained-replay reading keeps both runs and both gates. With the inert line removed it fails on the first, the reader losing the tab they pressed the moment the framed panel opens.
|
Settled the way the review points: the wrapper goes and the frame's body is written It is load-bearing rather than incidental: with that line alone removed, The three things the review listed as unchecked are checked and clear. The replays drive the framed chrome through the adapter rather than by pointing at it, so an inert subtree takes nothing from them: the pointer the replay draws is a span in the gallery, over the picture. Every accessibility, drawing, export, standalone and gallery reading in the suite passes, and so do the nightly readings this branch is for. The arrival half is untouched, as expected — #393 and this branch now write the same line on the same line, so the conflict is one copy of The classification comment above is anchored to Runs on
|
## Problem [`ci` on main](https://github.com/max-sixty/leaf/actions/runs/34104687695) failed on `6d4860a3` with 13 nightly failures. Twelve of them are the interaction gallery's contained frames taking the page's focus and its exported copy, which #383 fixed; that landed as `6b07467f` after this run started, and all twelve pass there unchanged. The thirteenth survives, on `6b07467f` and on today's `51f286ae` alike. `test_render_conversations.py::test_a_coined_class_cannot_reach_the_chromes_rules` fails deterministically, with `lf-living-margin` extra in the pinned authored-theme ledger. #390 (`5b503dd7`) added `.lf-living-margin { z-index: auto; }` inside `chrome.css`'s `@scope (.lf-chrome)` block, so the class became one the runtime sheet names *and* the authored theme dresses at document level — the test's `themed` category, whose ledger did not yet name it. That PR touched `chrome.css` and `test_render_aim.py`, so its own nightly leg ran `test_render_aim.py`'s cases rather than this module, and its run on main was cancelled by the next push, which is why the reading first surfaced a commit later. ## Solution Widen the ledger, which is what the assertion asks for by name. `lf-living-margin` belongs in it by the category's own rule: the rail is chrome, the authored theme owns its whole document face — placement, the hidden state, and the container widths that fold it away — and the runtime sheet names it only to say which plane it stands on. So the movement its document-level rule would cause on the probe element is that deliberate face rather than a leaked scoped rule, which is exactly what the exception exists to hold out of the collision probe. Nothing in the product is wrong here: the adopted chrome sheet's `z-index: auto` is the plane rule #390 wanted, and it still reaches the rail. ## Testing - `test_a_coined_class_cannot_reach_the_chromes_rules`: red on `6b07467f` and on `51f286ae`, green with this change. - The run's other twelve failures: all green on `6b07467f` with no change, confirming they were #383's. - `uv run pytest tests/test_render_conversations.py` on `51f286ae` — 75 passed. - `uv run pytest tests` on `51f286ae` — 901 passed, 6 skipped. - `uv run pre-commit run --files tests/test_render_conversations.py`. <details><summary>The failing reading</summary> ``` FAILED tests/test_render_conversations.py::test_a_coined_class_cannot_reach_the_chromes_rules - AssertionError: the authored-theme class surface changed: widen the exception on purpose Extra items in the left set: 'lf-living-margin' ``` `themed` is the set of classes the runtime sheet names inside its `@scope` block that no document-level rule of *its own* names, but that some other sheet dresses at document level. Before `5b503dd7` the rail's class was only ever theme.css's, so it was never scoped and never reached this set. </details> --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/34104687695) Co-authored-by: leaf-agent <[email protected]>
Leaf had two competing shapes for ordinary controls: the shared rectangular Button face and page-local capsules. Compact status and metadata labels used the same capsule geometry, so shape did not reliably distinguish actions from state. This change gives every ordinary action the shared 6px Button corner, whether it uses text or only an icon. Send, Resolve, Close, reaction overflow, attachment removal, and the floating response field now belong to that rectangular family. Compact state, value, and reaction labels use filled 3px chips. Circles remain only where the geometry has its own meaning: the document-margin Button family and circular status or selection markers. The change also removes the `lf-pill` vocabulary throughout the runtime, packages, examples, tests, and generated MCP App. Keyboard focus reveals a margin Button's label immediately, avoiding a paint-only tooltip transition that could be restarted while the living margin settled. The interaction gallery keeps contained preview frames out of the rendered page until they are ready, so initialization cannot interrupt outer-page focus while the fixed stage preserves layout. The deeper runtime repaint repair in [#394](#394) and the contained-frame focus/export boundary in [#383](#383) have both landed and are merged into this branch. This PR owns the reader-facing presentation. The landing-page stills and GIF were re-recorded from the shipped runtime, and their content-addressed product-page references now point to those images. The branch also carries the paint-order correction from [#399](#399), so the nightly ring check distinguishes content underneath an outlined control from content covering that control. Local checks passed: pre-commit; 907 everyday tests; focused controls/margin, interaction-gallery, option/chip, conversation, and site modules; an eight-case pass covering the changed embedded action faces; the selected-reaction nightly; both coarse-pointer paint-order cases; the seven product-page tests; and the complete 35-page site build. > _This was written by Codex on behalf of max-sixty_ --------- Co-authored-by: leaf-agent <[email protected]>
…frame (#394) ## Problem `ci` on main failed on [run 34084018735](https://github.com/max-sixty/leaf/actions/runs/34084018735) with 19 nightly failures. Most of them are the interaction gallery's contained frames taking the page's focus, which #383 fixes, and the reaction readings #371 retired, which landed as #385. Two survive on today's main (`e6adf0b2`) and neither is covered by either. `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` times out waiting for `pageSettled`, because the corpus never settles once the ring walk stands on a control in a docked margin cluster: `layoutMarginRows` floats that cluster out of static flow to read where it can hang and docks it back, a document tree has one focus, so the move blurs the control and the restore focuses it again — and `keyboard/dispatch.js` answers that pair by painting the standing chrome. That paint's layout asks for the next placement, so the page laid its margin out, rebuilt its whole key line and refolded its banner row on every frame for as long as the reader stood there. This is the second time this cycle has closed on a different edge; #298 cut the `dockSeats` one. #373 cuts the other edge of this same loop, and has the same ring test green: it keeps a docked row docked while the room it answered about holds, so `moveHost` is never reached in the case that loops. The two compose rather than compete — that one removes a caller's reason to move the host, this one stops any placement move from painting the standing chrome, so it also holds for the callers it does not touch (`float`, the inline `target.after`, and both branches of the Page-map render). Either can land alone and fixes the failing run; landing both is deliberate belt-and-braces, and neither is based on the other. `test_a_reload_mid_flight_never_wedges_round_trip` waits the corpus's whole answer-all cascade out inside one 30-second budget, and the corpus gained an ask in #354. The fact under test — that a ledger carried across a navigation does not wedge the new document — has already settled on that document's first trip. ## Solution `runtime.placingChrome` says a chrome placement is in flight, `moveHost` raises it around the move and the focus it hands straight back, and the focus painters skip while it stands. `moveHost` asks for the paint itself in the one case the placement really did move the reader: the control they were standing on did not survive it. The flag lives in `context.js` rather than beside `living-margin.js`'s existing `settlingOptionsFocus` because what has to know is every reader of where the reader stands, not just the options state machine. The gate test now waits for the new document's first trip rather than for its whole cascade, so the reading stops tracking how many asks the corpus happens to carry. It waits on the press's own attempt leaving the outbox's `pending`, which is delivery with retries folded in: `acked` is counted in a `finally` around the fetch, so a post that throws counts one and is retried, and an empty `pending` is only the momentary gap between the cascade's trips. ## Testing - `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`: red on `e6adf0b2`, green with this change. It is the gate — I could not reduce the cycle to a small fixture, and dropped a candidate regression test that passed with the change reverted rather than land coverage that says nothing. - `test_a_reload_mid_flight_never_wedges_round_trip`: red under `-n4` on `e6adf0b2`, green with this change. Its new reading still fails on a wedged first trip: with `/api/event` aborted on the reloaded document it gives up on `sends=16 acked=16 pending=1`, the shape `acked > 0` would have gone green on. - `uv run pre-commit run --all-files`. - The full `--run-nightly` run promised when this opened never got posted — that session ended before it finished. CI runs the nightly cases of `tests/test_render_gate.py` on this PR, the module it touches; the rest of the nightly suite the runtime change drives runs after main moves. <details><summary>How the cycle was found</summary> At the failing wait, `moving()` reported three running transitions on one `.lf-margin-button-label`, restarting continuously. A document-wide `MutationObserver` over one second on that page showed the whole chrome rebuilding at frame rate with nothing dispatched: 125 `lf-key` inserts and 125 removals, 52 `.lf-btn.lf-others` moves between `lf-banner-actions` and `lf-banner-menu`, 50 same-value `style` writes on `nav.lf-living-margin`, and 25 moves of one `.lf-margin-item.lf-docked` between `MAIN` and its `SECTION`. A stack captured inside a `focusout` listener named the mover: ``` at /runtime/living-margin.js:2073 | at moveHost (/runtime/living-margin.js:2379) | at moveExternalHost (/runtime/living-margin.js:2073) | at Object.float (/runtime/living-margin.js:1644) ``` with a second identical one from `Object.dock`, 50 focusouts per second between them, and `requestAnimationFrame` stacks from `paintHere` and from `layoutMarginRows`'s dispatch at 25 per second each. </details> --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/34084018735) --------- Co-authored-by: leaf-agent <[email protected]>
…us and its exported copy (#383) ## Problem The nightly leg of [`ci` on `edd1c5a`](https://github.com/max-sixty/leaf/actions/runs/34083084673) went red on 17 readings. All but two came from one cause, and every one of them reproduces deterministically on that commit and on today's `main`. #354 gave the interaction gallery three contained frames, and each of them runs a whole second Leaf page. A Leaf page arrives: `restoreArrangements()` puts back the workspace this reader last had open, and `letGo()` puts them on the page's own body. Both run inside the frame, and a document has one focus — so `document.activeElement` out on the gallery became the `<iframe>`, and whatever the reader was holding was let go of. That is what closed the crowded margin cluster mid-test, dropped every `.lf-target-hint` on the corpus, and took `#bg-choice-ask` off its focus. The export half is separate and had been masked by the reading in front of it: the frame's `srcdoc` names the runtime, the theme, and the gallery adapter on a server a standalone file has not got, so an exported copy opened with four CORS failures. Its `<kbd>` chord caption was authored hidden, so the copy also held words with no script left to reveal them. ## Solution `data-lf-contained` marks both sides of the boundary — the frame element out in the gallery and the body of the page inside it. A contained page arrives restoring no arrangement and placing no focus, and the bake drops a contained frame with the scripts. The chord caption now lives with its own visibility rather than in authored markup. On a page that is not contained nothing changes: every guard reads a constant that is false there. Arrival is only half of it. The framed chrome still places focus once a replay runs it — a shown `<dialog>` runs the browser's focusing steps whatever the page around it wants. So the frame's body is written `inert` beside the mark: an inert subject ends those steps before they reach anything, so the focus never crosses the boundary and there is nothing to hand back. The replays are unaffected, because they drive that chrome through the adapter rather than by pointing at it. Measured on the `Open and close Threads` tab: without the line the reader loses the tab they just pressed the moment the framed panel opens, and `g T` and `w` then reach a document they cannot see. `inert` is the same one-line fix #393 carries, arrived at from the other side. The two conflict textually — both write it into `loadFrameDocument` on the line this branch marks the body on — and resolving either way is taking one copy of the line. `test_a_contained_replay_leaves_the_page_around_it_standing` pins both halves: it fails on `main` with `assert 'IFRAME' != 'IFRAME'` at arrival, and on the arrival fix alone at the replay, where the reader is no longer standing on the tab they pressed. Two readings are restated rather than repaired, because the gallery really did change: its swipe specimen sits in an unselected tab, so one margin row is withheld and the posture clear runs for it. (The Ask count 13 → 14 landed separately in #376.) <details><summary>The 17 readings, and what each was</summary> Focus taken by a frame — 14: `test_the_feature_gallery_keeps_its_real_actions_reachable[1440/1200/700/390]`, `test_ask_addresses_follow_the_feature_gallery_s_visible_margin_controls[1200/390]`, `test_margin_target_hover_requires_pointer_movement`, `test_a_workspace_lands_one_responsive_layout_and_carries_the_column_to_it[1440/1600]`, `test_selection_hints_do_not_name_page_content_behind_a_covering_panel`, `test_a_shipped_log_opens_its_example_on_a_live_thread`, `test_other_responses_can_turn_the_compact_field_into_a_suggestion`, and both `test_an_exported_page_fixture_stands_on_its_own` cases, which failed on the caption before they could reach the CORS errors. Restated: `test_an_unchanged_heartbeat_restates_no_margin_name[gallery]`, `test_the_feature_gallery_exercises_the_injected_core_surfaces`. **Not this branch's**: `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` fails the same way on `06daeef3`, one commit before #354 — `pageSettled` never becomes true in the response bar of `ship-review`. It took [run 34079766897](https://github.com/max-sixty/leaf/actions/runs/34079766897) down too, so it is a red `main` of its own and I am carrying it separately. </details> ## Testing `uv run pytest tests` (899 passed), and the complete nightly modules the change reaches: `test_render_margin.py`, `test_render_navigation.py`, `test_render_export.py`, `test_render_semantic_selection.py`, `test_render_pages.py`, `test_render_widgets.py`, `test_site.py` — all green. The new test was checked against a tree with the two runtime guards reverted, where it fails. For the focus half added since: `test_site.py` (31 passed), and every gallery, contained-frame, export, standalone, accessibility and drawing reading in the suite (130 passed), plus `test_render_margin.py` whole and the two readings elsewhere this branch clears (83 passed). With the `inert` line alone removed, the contained-replay reading fails on the tab losing focus. ## One flake carried too `test_unchanged_margin_refresh_cost_is_bounded_by_refresh_count` took this branch's first CI run down at `LayoutCount: 29` against a bound of 20, and it does the same on `6b77b0a9` with none of this branch on it — once in six runs there, once in seven here. The corpus carries the gallery's contained frames, and a frame still arriving lays itself out in the measured page's own process, which counted against five dispatches that touch nothing reads as the heartbeat forcing layout. Both corpus cost measurements — that one and `test_margin_layout_batches_the_composed_page_without_refolding_controls`, which measures the same page the same way — now wait for the frames to be ready before opening the CDP session: fourteen runs green after, where it failed twice in thirteen before. ## What this does not clear One reading on `main` is still red and is not this branch's: `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`, which I re-ran on this tree after #385 landed. It is tracked in #396, where the two possible repairs are written out — both are a product decision rather than a mechanical one. <details><summary>What it looks like</summary> The walk hangs on `pageSettled` in the response bar of `ship-review`: three transitions on one reaction chip's `.lf-margin-button-label` — opacity, transform, visibility, the label reveal — restart before they finish, indefinitely. `startTime` moves forward and `currentTime` goes back to 0 between two samples a second apart. Last green on [`934bfc4c`](https://github.com/max-sixty/leaf/actions/runs/34077249270); red from `06daeef3` (#365), which is what made a reaction a margin button with a label. The other readings that were red beside it have since been repaired on `main` and pass here: the three `test_render_reactions.py` cases went with #385, and `test_render_gate.py::test_a_reload_mid_flight_never_wedges_round_trip` passes on this tree. </details> ## Rebuilt on #378 #378 landed while this was open and rebuilt the contained page without `srcdoc`. The mark and the `inert` write both go on the document `loadFrameDocument` writes, and the frame element carries the mark beside it. `main` is merged in and the branch is green: `uv run pytest tests` (901 passed), and `test_site.py` and `test_render_margin.py` complete under `--run-nightly` (112 passed). --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/34083084673) --------- Co-authored-by: leaf-agent <[email protected]>
## Problem [`ci` on main](https://github.com/max-sixty/leaf/actions/runs/34104687695) failed on `6d4860a3` with 13 nightly failures. Twelve of them are the interaction gallery's contained frames taking the page's focus and its exported copy, which #383 fixed; that landed as `6b07467f` after this run started, and all twelve pass there unchanged. The thirteenth survives, on `6b07467f` and on today's `51f286ae` alike. `test_render_conversations.py::test_a_coined_class_cannot_reach_the_chromes_rules` fails deterministically, with `lf-living-margin` extra in the pinned authored-theme ledger. #390 (`5b503dd7`) added `.lf-living-margin { z-index: auto; }` inside `chrome.css`'s `@scope (.lf-chrome)` block, so the class became one the runtime sheet names *and* the authored theme dresses at document level — the test's `themed` category, whose ledger did not yet name it. That PR touched `chrome.css` and `test_render_aim.py`, so its own nightly leg ran `test_render_aim.py`'s cases rather than this module, and its run on main was cancelled by the next push, which is why the reading first surfaced a commit later. ## Solution Widen the ledger, which is what the assertion asks for by name. `lf-living-margin` belongs in it by the category's own rule: the rail is chrome, the authored theme owns its whole document face — placement, the hidden state, and the container widths that fold it away — and the runtime sheet names it only to say which plane it stands on. So the movement its document-level rule would cause on the probe element is that deliberate face rather than a leaked scoped rule, which is exactly what the exception exists to hold out of the collision probe. Nothing in the product is wrong here: the adopted chrome sheet's `z-index: auto` is the plane rule #390 wanted, and it still reaches the rail. ## Testing - `test_a_coined_class_cannot_reach_the_chromes_rules`: red on `6b07467f` and on `51f286ae`, green with this change. - The run's other twelve failures: all green on `6b07467f` with no change, confirming they were #383's. - `uv run pytest tests/test_render_conversations.py` on `51f286ae` — 75 passed. - `uv run pytest tests` on `51f286ae` — 901 passed, 6 skipped. - `uv run pre-commit run --files tests/test_render_conversations.py`. <details><summary>The failing reading</summary> ``` FAILED tests/test_render_conversations.py::test_a_coined_class_cannot_reach_the_chromes_rules - AssertionError: the authored-theme class surface changed: widen the exception on purpose Extra items in the left set: 'lf-living-margin' ``` `themed` is the set of classes the runtime sheet names inside its `@scope` block that no document-level rule of *its own* names, but that some other sheet dresses at document level. Before `5b503dd7` the rail's class was only ever theme.css's, so it was never scoped and never reached this set. </details> --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/34104687695) Co-authored-by: leaf-agent <[email protected]>
Leaf had two competing shapes for ordinary controls: the shared rectangular Button face and page-local capsules. Compact status and metadata labels used the same capsule geometry, so shape did not reliably distinguish actions from state. This change gives every ordinary action the shared 6px Button corner, whether it uses text or only an icon. Send, Resolve, Close, reaction overflow, attachment removal, and the floating response field now belong to that rectangular family. Compact state, value, and reaction labels use filled 3px chips. Circles remain only where the geometry has its own meaning: the document-margin Button family and circular status or selection markers. The change also removes the `lf-pill` vocabulary throughout the runtime, packages, examples, tests, and generated MCP App. Keyboard focus reveals a margin Button's label immediately, avoiding a paint-only tooltip transition that could be restarted while the living margin settled. The interaction gallery keeps contained preview frames out of the rendered page until they are ready, so initialization cannot interrupt outer-page focus while the fixed stage preserves layout. The deeper runtime repaint repair in [#394](#394) and the contained-frame focus/export boundary in [#383](#383) have both landed and are merged into this branch. This PR owns the reader-facing presentation. The landing-page stills and GIF were re-recorded from the shipped runtime, and their content-addressed product-page references now point to those images. The branch also carries the paint-order correction from [#399](#399), so the nightly ring check distinguishes content underneath an outlined control from content covering that control. Local checks passed: pre-commit; 907 everyday tests; focused controls/margin, interaction-gallery, option/chip, conversation, and site modules; an eight-case pass covering the changed embedded action faces; the selected-reaction nightly; both coarse-pointer paint-order cases; the seven product-page tests; and the complete 35-page site build. > _This was written by Codex on behalf of max-sixty_ --------- Co-authored-by: leaf-agent <[email protected]>
Problem
The nightly leg of
cionedd1c5awent red on 17 readings. All but two came from one cause, and every one of them reproduces deterministically on that commit and on today'smain.#354 gave the interaction gallery three contained frames, and each of them runs a whole second Leaf page. A Leaf page arrives:
restoreArrangements()puts back the workspace this reader last had open, andletGo()puts them on the page's own body. Both run inside the frame, and a document has one focus — sodocument.activeElementout on the gallery became the<iframe>, and whatever the reader was holding was let go of. That is what closed the crowded margin cluster mid-test, dropped every.lf-target-hinton the corpus, and took#bg-choice-askoff its focus.The export half is separate and had been masked by the reading in front of it: the frame's
srcdocnames the runtime, the theme, and the gallery adapter on a server a standalone file has not got, so an exported copy opened with four CORS failures. Its<kbd>chord caption was authored hidden, so the copy also held words with no script left to reveal them.Solution
data-lf-containedmarks both sides of the boundary — the frame element out in the gallery and the body of the page inside it. A contained page arrives restoring no arrangement and placing no focus, and the bake drops a contained frame with the scripts. The chord caption now lives with its own visibility rather than in authored markup. On a page that is not contained nothing changes: every guard reads a constant that is false there.Arrival is only half of it. The framed chrome still places focus once a replay runs it — a shown
<dialog>runs the browser's focusing steps whatever the page around it wants. So the frame's body is writteninertbeside the mark: an inert subject ends those steps before they reach anything, so the focus never crosses the boundary and there is nothing to hand back. The replays are unaffected, because they drive that chrome through the adapter rather than by pointing at it. Measured on theOpen and close Threadstab: without the line the reader loses the tab they just pressed the moment the framed panel opens, andg Tandwthen reach a document they cannot see.inertis the same one-line fix #393 carries, arrived at from the other side. The two conflict textually — both write it intoloadFrameDocumenton the line this branch marks the body on — and resolving either way is taking one copy of the line.test_a_contained_replay_leaves_the_page_around_it_standingpins both halves: it fails onmainwithassert 'IFRAME' != 'IFRAME'at arrival, and on the arrival fix alone at the replay, where the reader is no longer standing on the tab they pressed.Two readings are restated rather than repaired, because the gallery really did change: its swipe specimen sits in an unselected tab, so one margin row is withheld and the posture clear runs for it. (The Ask count 13 → 14 landed separately in #376.)
The 17 readings, and what each was
Focus taken by a frame — 14:
test_the_feature_gallery_keeps_its_real_actions_reachable[1440/1200/700/390],test_ask_addresses_follow_the_feature_gallery_s_visible_margin_controls[1200/390],test_margin_target_hover_requires_pointer_movement,test_a_workspace_lands_one_responsive_layout_and_carries_the_column_to_it[1440/1600],test_selection_hints_do_not_name_page_content_behind_a_covering_panel,test_a_shipped_log_opens_its_example_on_a_live_thread,test_other_responses_can_turn_the_compact_field_into_a_suggestion, and bothtest_an_exported_page_fixture_stands_on_its_owncases, which failed on the caption before they could reach the CORS errors.Restated:
test_an_unchanged_heartbeat_restates_no_margin_name[gallery],test_the_feature_gallery_exercises_the_injected_core_surfaces.Not this branch's:
test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpusfails the same way on06daeef3, one commit before #354 —pageSettlednever becomes true in the response bar ofship-review. It took run 34079766897 down too, so it is a redmainof its own and I am carrying it separately.Testing
uv run pytest tests(899 passed), and the complete nightly modules the change reaches:test_render_margin.py,test_render_navigation.py,test_render_export.py,test_render_semantic_selection.py,test_render_pages.py,test_render_widgets.py,test_site.py— all green. The new test was checked against a tree with the two runtime guards reverted, where it fails.For the focus half added since:
test_site.py(31 passed), and every gallery, contained-frame, export, standalone, accessibility and drawing reading in the suite (130 passed), plustest_render_margin.pywhole and the two readings elsewhere this branch clears (83 passed). With theinertline alone removed, the contained-replay reading fails on the tab losing focus.One flake carried too
test_unchanged_margin_refresh_cost_is_bounded_by_refresh_counttook this branch's first CI run down atLayoutCount: 29against a bound of 20, and it does the same on6b77b0a9with none of this branch on it — once in six runs there, once in seven here. The corpus carries the gallery's contained frames, and a frame still arriving lays itself out in the measured page's own process, which counted against five dispatches that touch nothing reads as the heartbeat forcing layout. Both corpus cost measurements — that one andtest_margin_layout_batches_the_composed_page_without_refolding_controls, which measures the same page the same way — now wait for the frames to be ready before opening the CDP session: fourteen runs green after, where it failed twice in thirteen before.What this does not clear
One reading on
mainis still red and is not this branch's:test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus, which I re-ran on this tree after #385 landed. It is tracked in #396, where the two possible repairs are written out — both are a product decision rather than a mechanical one.What it looks like
The walk hangs on
pageSettledin the response bar ofship-review: three transitions on one reaction chip's.lf-margin-button-label— opacity, transform, visibility, the label reveal — restart before they finish, indefinitely.startTimemoves forward andcurrentTimegoes back to 0 between two samples a second apart. Last green on934bfc4c; red from06daeef3(#365), which is what made a reaction a margin button with a label.The other readings that were red beside it have since been repaired on
mainand pass here: the threetest_render_reactions.pycases went with #385, andtest_render_gate.py::test_a_reload_mid_flight_never_wedges_round_trippasses on this tree.Rebuilt on #378
#378 landed while this was open and rebuilt the contained page without
srcdoc. The mark and theinertwrite both go on the documentloadFrameDocumentwrites, and the frame element carries the mark beside it.mainis merged in and the branch is green:uv run pytest tests(901 passed), andtest_site.pyandtest_render_margin.pycomplete under--run-nightly(112 passed).Automated fix for failed run