Skip to content

Keep the interaction gallery's contained frames out of the page's focus and its exported copy - #383

Merged
max-sixty merged 6 commits into
mainfrom
fix/ci-34083084673
Sep 7, 2026
Merged

max-sixty merged 6 commits into
mainfrom
fix/ci-34083084673

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The nightly leg of ci on edd1c5a 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.)

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 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 down too, so it is a red main of 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), 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.

What it looks like

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; 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.

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

…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 leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread skills/leaf/assets/CLAUDE.md Resolved
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

The same cause took ci on e0b2563 down again — 21 readings, 16 of them this branch's.

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:

  • test_render_navigation.py::test_the_feature_gallery_exercises_core_reader_workflows — page.keyboard.press("z") after signing off, then expect(approve).to_have_text("Approve version") finds ✓ Version approved still standing. The undo chord never reached the page.
  • test_render_drawing.py::test_draw_mode_cursor_matches_the_widget_controls_it_captures — page.keyboard.press("w"), then assert 'pointer' == 'crosshair'. Draw mode never turned on.

Both are the gallery, both press a page-level chord with no explicit focus placed first, and a chord goes to document.activeElement — which is the <iframe> once a contained page has taken it. data-lf-contained should cover them, but neither reading is in the 17 the body enumerates.

test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus failed again, the same way the body already describes: pageSettled never becomes true, this time in v2.html of the ring walk rather than in ship-review's response bar. Still unowned by any PR.

The three reactions readings are #385 — #371 retired the settled corner mark and test_render_reactions.py is nightly-only, so nothing ran it before main moved. test_render_gate.py::test_a_reload_mid_flight_never_wedges_round_trip is unclassified; it gave up on sends=8 acked=7 pending=1.

max-sixty pushed a commit that referenced this pull request Sep 7, 2026
…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]>
@max-sixty

Copy link
Copy Markdown
Owner

@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
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

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 in the response bar of ship-review, after two stops. moving() at the timeout returns three CSSTransitions on the focused pill's .lf-margin-button-label — opacity, transform, visibility — whose currentTime reads 16.7ms, then 0ms 400ms later, so they are being re-created rather than run. A MutationObserver on the margin item over 500ms sees 26 class mutations on .lf-ui.lf-margin-item.lf-docked and 13 data-lf-label-side mutations on the focused .lf-react: a dock/undock oscillation at frame rate, which is #373's loop exactly.

So of the 21: 16 are this branch's, 3 are #385, 1 is #373, and test_render_gate.py::test_a_reload_mid_flight_never_wedges_round_trip is the only one still unaccounted for.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Conflicts are clear — the branch is mergeable at b76c3650. #378 landed while I was working the review below, and by the time I had the merge resolved locally the branch already carried an equivalent one, so I checked that resolution rather than pushing a second: the body mark now goes on the document loadFrameDocument writes (the srcdoc template it replaced is gone), the frame element keeps its own mark, and the frame-call wrapper survives. That is the resolution's one silent failure mode — drop the body mark and containedPage reads false everywhere — so I re-ran the readings that would catch it: test_site.py (31 passed) and every gallery, contained-frame and export reading in the suite (47 passed) on the merged tree.

The review's finding is fixed rather than argued: the showPanelLayer guard could not reach what it was written for, so chrome-layout.js is back to main exactly, and the reclaim moved out to the gallery in bf8511b1, where the document that knows where the reader was standing can act on it. Measured before and after on the Open and close Threads tab: with the frame holding focus the reader's g T leaves the outer Threads closed and w never enters Draw mode, which is the same shape as the two swallowed-chord readings I listed above — I have not confirmed those two were this cause, only that the mechanism reproduces on the same page.

lint and test were still running when my poll budget ran out, so this head is unverified rather than green.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Closing the caveat I left above: ci on b76c3650 finished green — lint, test, and website-worker all pass, so this head is verified rather than unverified. The branch still merges cleanly against main.

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.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

ci on 14c746ba — run 34094193440 — went red on 20 nightly readings, and this branch plus #394 clears every one of them. Thirteen still reproduce on today's main (8de0b9ac); on main merged with this branch (9567c09a) and #394 (f68a38e6) the same selection is 31 passed, 0 failed. Eleven of the thirteen are this branch's and two are #394's, so neither branch alone turns the run green.

That also closes the loose end from my comment above: test_render_gate.py::test_a_reload_mid_flight_never_wedges_round_trip, which I left unaccounted for, is #394's — its body carries the diagnosis and its f68a38e6 head reworks that gate's wait.

One reading from this run is worth adding to the swallowed-chord list I posted earlier, as a candidate rather than a confirmation. test_render_drawing.py::test_a_posted_drawing_stands_down_without_a_false_page_reference fails on 14c746ba at page.keyboard.press("w") with <body> never gaining lf-drawing — the same shape as the two readings above, on the same page, with no focus placed before the chord. It did not reproduce in either of my two main runs, so I cannot attribute it; it passes on the merged tree, but so does main.

The twenty readings and where each lands

Reproduced on main (8de0b9ac), cleared by this branch — 11:

test_render_export.py::test_an_exported_page_fixture_stands_on_its_own[feature-gallery]
test_render_export.py::test_an_exported_page_fixture_stands_on_its_own[corpus]
test_render_margin.py::test_an_unchanged_heartbeat_restates_no_margin_name[gallery]
test_render_margin.py::test_ask_addresses_follow_the_feature_gallery_s_visible_margin_controls[1200]
test_render_margin.py::test_ask_addresses_follow_the_feature_gallery_s_visible_margin_controls[390]
test_render_margin.py::test_margin_target_hover_requires_pointer_movement
test_render_margin.py::test_the_feature_gallery_keeps_its_real_actions_reachable[1440]
test_render_margin.py::test_the_feature_gallery_keeps_its_real_actions_reachable[1200]
test_render_margin.py::test_the_feature_gallery_keeps_its_real_actions_reachable[700]
test_render_pages.py::test_a_shipped_log_opens_its_example_on_a_live_thread
test_render_semantic_selection.py::test_selection_hints_do_not_name_page_content_behind_a_covering_panel

Reproduced on main, cleared by #394 — 2:

test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus
test_render_gate.py::test_a_reload_mid_flight_never_wedges_round_trip

No longer reproducing on main — 7. The three test_render_reactions.py readings are #385, which landed as c4f1b481. The other four are readings this branch's body already attributes to the frame's stolen focus, plus the drawing one above; they passed in both of my main runs, and test_the_feature_gallery_keeps_its_real_actions_reachable[390] failed in the first and passed in the second, so main is intermittent on them rather than repaired:

test_render_reactions.py::test_selected_reactions_keep_neutral_button_furniture[light]
test_render_reactions.py::test_selected_reactions_keep_neutral_button_furniture[dark]
test_render_reactions.py::test_a_copy_keeps_a_standing_reaction_as_a_mark_and_drops_the_press
test_render_controls.py::test_a_workspace_lands_one_responsive_layout_and_carries_the_column_to_it[1440]
test_render_controls.py::test_a_workspace_lands_one_responsive_layout_and_carries_the_column_to_it[1600]
test_render_margin.py::test_the_feature_gallery_keeps_its_real_actions_reachable[390]
test_render_drawing.py::test_a_posted_drawing_stands_down_without_a_false_page_reference

Both branches merge cleanly onto 8de0b9ac and onto each other, in either order.

max-sixty pushed a commit that referenced this pull request Sep 7, 2026
…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 leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

ci on e6adf0b2 — run 34099278011 — went red on 15 nightly readings. Fourteen of them pass on this branch (9567c09a) merged with today's main (6d4860a3, which now carries #394); the fifteenth is the ring walk, and it passes on 6d4860a3 here now that #394 has landed. So with #394 merged, this branch is the only thing between main and a green nightly leg.

One reading is new to the cluster and is in none of the lists above: tests/test_render_navigation.py::test_the_feature_gallery_exercises_core_reader_workflows. It reproduces on main in all three runs I gave it, including one where it was the only test in the process, and git bisect over edd1c5a5..6d4860a3 names 821e0d5b (#378) as the first bad commit.

It is not the first assertion that fails but the one after the undo: the approval lands, z is pressed, and the button is still ✓ Version approved for the whole 5s — the chord never reaches the outer document. That is the swallowed-chord shape from your list, and #378 is what widened it: it changed when a contained page starts, so a frame is now holding the focus at the moment the gallery's own sign-off journey presses a key. This branch clears it: on the merged tree that node id and every test_an_exported_page_fixture_stands_on_its_own parametrization are 13 passed, 0 failed.

The fifteen readings and where each lands

Reproduced on main (6d4860a3), cleared by this branch — 12:

test_render_export.py::test_an_exported_page_fixture_stands_on_its_own[corpus]
test_render_export.py::test_an_exported_page_fixture_stands_on_its_own[feature-gallery]
test_render_gate.py::test_a_reload_mid_flight_never_wedges_round_trip
test_render_margin.py::test_an_unchanged_heartbeat_restates_no_margin_name[gallery]
test_render_margin.py::test_ask_addresses_follow_the_feature_gallery_s_visible_margin_controls[390]
test_render_margin.py::test_the_feature_gallery_keeps_its_real_actions_reachable[1440]
test_render_margin.py::test_the_feature_gallery_keeps_its_real_actions_reachable[1200]
test_render_margin.py::test_the_feature_gallery_keeps_its_real_actions_reachable[700]
test_render_margin.py::test_margin_target_hover_requires_pointer_movement
test_render_navigation.py::test_the_feature_gallery_exercises_core_reader_workflows
test_render_pages.py::test_a_shipped_log_opens_its_example_on_a_live_thread
test_render_semantic_selection.py::test_selection_hints_do_not_name_page_content_behind_a_covering_panel

Intermittent on main, passing on the merged tree — 2. test_render_controls.py::test_coarse_pointer_resize_reach_stays_reachable_without_trapping_scroll and test_render_margin.py::test_a_folded_compact_map_returns_to_the_banner_overflow: one of the pair failed once across four observations on 6d4860a3 and neither reproduced in two isolated runs, so I cannot attribute either the way I can the twelve above.

Tracked elsewhere — 1: test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus, which is #396 and which #394 has since landed for. It passed on 6d4860a3 and on the merged tree here, 3m21s each, so the walk is no longer wedging on this runner.

Method: every reading run with uv run pytest -q -n0 --run-nightly <node id>, on main at 6d4860a3 and on this branch's 9567c09a merged with it locally. On the merged tree that is three processes — 13 passed (navigation plus the export parametrizations), 14 passed (the remaining node ids), 1 passed (the ring walk) — 28 passed, 0 failed in total.

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.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Settled the way the review points: the wrapper goes and the frame's body is written inert, in b07722f2. inert is the deeper statement — the dialog focusing steps return against an inert subject, so focus never crosses the boundary and there is nothing to hand back — and keepsReaderStanding, its focusDestination handback and the wrapping of every framed call all go with it. What replaces them is one line beside the data-lf-contained mark in loadFrameDocument.

It is load-bearing rather than incidental: with that line alone removed, test_a_contained_replay_leaves_the_page_around_it_standing fails on its first gate, the reader losing the tab they pressed the moment the framed panel opens. The reading keeps both runs — the second still stands them on a focusDestination destination, which now survives because nothing takes the lend away rather than because the gallery re-lends it.

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 — 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.

#393 and this branch now write the same line on the same line, so the conflict is one copy of body.inert = true whichever lands first.

The classification comment above is anchored to 9567c09a; the head is b07722f2 now, and the readings it lists were re-run there.

Runs on b07722f2
uv run pytest tests/test_site.py                                  31 passed
uv run pytest tests -k "gallery or contained or frame or export
                        or standalone or accessib or drawing"    130 passed
uv run pytest tests/test_render_margin.py + the two elsewhere     83 passed
uv run pytest -q --run-nightly <the 9 node ids cleared above>      25 passed
uv run pytest -q --run-nightly tests/test_site.py
                               tests/test_render_drawing.py        52 passed
uv run pre-commit run --files <the four changed>                   passed

With body.inert = true removed from that tree:

FAILED tests/test_site.py::test_a_contained_replay_leaves_the_page_around_it_standing
 +  where False = evaluate('tab => document.activeElement === tab')

@max-sixty
max-sixty merged commit 6b07467 into main Sep 7, 2026
4 checks passed
@max-sixty
max-sixty deleted the fix/ci-34083084673 branch September 7, 2026 10:24
max-sixty pushed a commit that referenced this pull request Sep 7, 2026
## 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]>
max-sixty added a commit that referenced this pull request Sep 7, 2026
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]>
max-sixty pushed a commit that referenced this pull request Sep 7, 2026
…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]>
max-sixty pushed a commit that referenced this pull request Sep 7, 2026
…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]>
max-sixty pushed a commit that referenced this pull request Sep 7, 2026
## 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]>
max-sixty added a commit that referenced this pull request Sep 7, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants