Skip to content

Stop a margin placement move repainting the standing chrome on every frame - #394

Merged
max-sixty merged 2 commits into
mainfrom
fix/ci-34084018735
Sep 7, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/ci-34084018735

Conversation

@leaf-agent

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

Copy link
Copy Markdown
Collaborator

Problem

ci on main failed on run 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.
How the cycle was found

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.


Automated fix for failed run

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

Two things — one beside the branch, one on it.

#373 is cutting the same cycle. It fixes the same nightly red — test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus — by keeping a docked row docked while the room it answered about holds, so moveHost is never reached in the case that loops. This PR cuts the other edge of that same moveHost → focusout/focusin → paintHere → syncLayout → next-pass loop. They compose rather than conflict, but the body here cites #298 and not the open PR that already has this test green, so a reader lands on two branches each claiming the repair. Worth saying which is meant to land, and if both, which one is belt-and-braces.

The runtime change itself reads clean to me: placingChrome is raised only around the synchronous window where focus leaves and is handed straight back, the save/restore makes nesting safe, and the trailing paintHere() covers the one case where held did not survive the move. moveHost is the single door every host relocation goes through (float, dock, the inline target.after, and both branches of the Page-map render), so the guard is not partial. The other two settlingOptionsFocus sites are places the reader really does move, and correctly do not raise it.

The gate test is the part I would not land as written — see the inline note.

Comment thread tests/test_render_gate.py Resolved
`acked` counts a post that threw: `postEvent` increments it in a `finally`
around the fetch, so a wedged first trip that fails and retries forever
satisfies `acked > 0` and the reading goes green on the thing it exists to
catch. Wait instead for the attempt the press put in the outbox to leave
`pending`, which is delivery with retries folded in, bounded by one trip, and
stable once true. The trailing assertion the waits already established is gone,
and the docstring no longer names `round_trip`.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

This branch is load-bearing for a second red main: ci on 14c746ba — run 34094193440 — failed on 20 nightly readings, and two of the thirteen that still reproduce on today's main (8de0b9ac) are the two this PR owns, test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus and test_a_reload_mid_flight_never_wedges_round_trip. The other eleven are #383's, so neither branch alone turns that run green.

Merged together onto 8de0b9ac — this branch at f68a38e6, #383 at 9567c09a — the whole selection is 31 passed, 0 failed. The two branches merge cleanly onto main and onto each other in either order. Full per-reading attribution is in my comment on #383.

@max-sixty
max-sixty merged commit 6d4860a into main Sep 7, 2026
7 checks passed
@max-sixty
max-sixty deleted the fix/ci-34084018735 branch September 7, 2026 09:12
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 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