Skip to content

Leave the lifecycle mark to the one state that needs it - #371

Merged
max-sixty merged 3 commits into
mainfrom
side-button-decorations
Sep 7, 2026
Merged

max-sixty merged 3 commits into
mainfrom
side-button-decorations

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

A margin Button carried a 6px witness at its corner for each of four lifecycle states: a dot for engaged, a moving open ring for busy, a diamond for failed, a square for settled. Only busy was saying something the page did not already say, so the other three go and the state axis keeps its other jobs.

Why each one goes

settled had no other job at all. It ranked identically to idle in STATE_PRIORITY and sat outside the active set, so painting the square was the whole of what the state did anywhere in the runtime. On standing reaction marks it was hardcoded, and a react-mark exists only while its reaction stands, so the square there carried no bits — 16 of the 17 settled marks on the feature gallery were those. It is gone from the grammar.

failed and engaged were saying something already in words. A failure always stands beside a receipt reading "Failed" and the Retry it swaps in; an engaged Button always stands beside the editor it belongs to. Both keep their axis value, so they still rank their Button first in the cluster and hold it unfolded — they just paint nothing.

busy earns its ring twice over. It is the only state nothing else states: a busy Button deliberately keeps its full opacity and its pointer, so with no ring an in-flight press looks exactly like an idle one. And it is the only mark that survives its own size — minus its 1px paper border each witness left about 4px of paint, and at 1x a circle, a rotated square and a square are the same grey smudge.

The gallery page now paints one witness where it painted twenty.

Also in here

The busy rule and its prefers-reduced-motion override now carry the same :not([data-lf-behavior="status"]). The override only wins on equal-or-greater specificity, so this is what keeps the ring held still and dotted for a reader who asked for stillness. test_button_tone_colors_only_the_icon runs under reduce and reads the mark's transform and borderTopStyle, which is the gate on that pair: both halves go red if the override drops back below the rule it overrides.

ACTIVE_STATES went with settled — the list existed to hold settled out of the non-idle states, so entryEngaged now reads the absence of idle rather than keeping a second list beside the grammar's. registerMarginItem's contract and the release notes both stopped offering or describing the mark that is gone; examples/developer/versions/feature-gallery.v1.html keeps its sentence, being an immutable revision that described the layer it shipped with.

Checks

uv run pytest tests green, pre-commit run --all-files clean, vendor bundles and corpus regenerated.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 2 commits September 6, 2026 19:52
A margin Button carried a 6px witness at its corner for each of four
lifecycle states: a dot for engaged, a moving open ring for busy, a
diamond for failed, a square for settled. Only busy was saying anything
the page did not already say. A failure always stands beside the word
"Failed" and the Retry it swaps in; an engaged Button always stands
beside the editor it belongs to; and a settled one added nothing at all,
since `settled` ranked identically to `idle` in STATE_PRIORITY and sat
outside the active set, so painting the square was the whole of what the
state did anywhere in the runtime. On standing reaction marks it was
hardcoded, and a react-mark exists only while its reaction stands, so
the square there carried no bits at all — 16 of the 17 settled marks on
the feature gallery were those.

The three redundant marks were also the three that could not be read.
Minus its 1px paper border each left about 4px of paint, and at 1x a
circle, a rotated square and a square are the same grey smudge. Busy is
the exception twice over: it is the only state nothing else states — a
busy Button keeps its full opacity and its pointer — and a moving
outline is the one mark that size a reader can still resolve.

So `settled` goes from the grammar entirely, `engaged` and `failed` keep
their ordering and fold-open weight while painting nothing, and busy
keeps its ring. The gallery page now paints one witness where it painted
twenty. ACTIVE_STATES went with it: the list existed to hold `settled`
out of the non-idle states, so entryEngaged now reads the absence of
idle rather than a second list beside the grammar's.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GhdFcugYp4BUa91gSUPhF7

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Three things, one of them a regression on the path the description claims.

The busy ring no longer stops under reduced motion. Folding :not([data-lf-behavior="status"]) into the rule that now also carries animation raised that rule to specificity (0,3,1), while the @media (prefers-reduced-motion: reduce) override below it is still .lf-margin-button[data-lf-state="busy"]::after at (0,2,1) — so animation: none; border-style: dotted loses to the rule it is meant to override. Measured on this head against 5d57131, loading just the block between those two comments:

under reduce base this head
animationName none lf-runtime-4f3c2a8d-button-busy
border-style dotted solid

Inline suggestion below; with it applied I read animation: none and dotted again, and the four values test_button_tone_colors_only_the_icon still asserts for busy (8px, 50%, 2px, transparent block-start) come back unchanged.

The suite stays green because the one assertion that read this went out in the same PR: the transform column in that test, which runs under emulate_media(reduced_motion="reduce"). Its stated reason — "the ring turns continuously, so sampling it is a race" — is something this change made true. Under reduced motion the ring was stationary, so transform != 'none' was a deterministic False there rather than a sample of an animation, and the column would have gone red on this head. It looks worth keeping for busy once the override wins again, since nothing else in the suite reads that mark under reduce.

registerMarginItem's contract still offers settled. In living-margin.js's header, the paragraph above the one this PR rewrote still reads "state is a value or live reading of idle, engaged, busy, failed, or settled". offerState now throws Unknown margin-item state: settled on that value, and assets/CLAUDE.md sends a package author to that header before anything else.

examples/release-notes.html still describes the square. Its lede says "A selected reaction keeps its square mark even under the pointer", where a standing reaction now carries only aria-pressed and the --chip fill; the preceding clause, "a small corner mark carries interaction state", reads the same way. corpus.html carries both sentences through from that source. The gallery guide got exactly this treatment in the diff — this is the other authored page that names the mark.

Happy to push a commit for the last two and the corpus regeneration if that saves you a round.

Comment thread skills/leaf/assets/runtime/chrome.css Resolved
Folding the status exclusion into the busy rule raised it to (0,3,1) while
the reduced-motion override below it stayed at (0,2,1), so `animation: none;
border-style: dotted` stopped applying and the ring turned forever under
`prefers-reduced-motion: reduce`. The override now carries the same `:not(...)`,
matching that specificity and winning where it stands.

The reading that would have caught this went out in the same change that broke
it. `test_button_tone_colors_only_the_icon` runs under `reduce`, where the ring
is held still, so its `transform` column was a settled `none` rather than a
sample of a turning one; dropping it as "a race" was true of the ring in
general and false of that test. It is back, with `borderTopStyle` beside it,
and both halves go red on the old override.

Two statements outlived the state they described: `registerMarginItem`'s
contract still offered `settled` as a legal value that `offerState` now throws
on, and the release notes still told a reader that a corner mark carries
interaction state and a selected reaction keeps its square. The frozen
`feature-gallery.v1` keeps its own sentence, being an immutable revision that
described the layer it shipped with.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GhdFcugYp4BUa91gSUPhF7
@max-sixty
max-sixty merged commit 1de01fc into main Sep 7, 2026
7 checks passed
@max-sixty
max-sixty deleted the side-button-decorations branch September 7, 2026 04:30
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 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
…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]>
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