Skip to content

Drop the swipe control fixture and pressed-reaction ink main already landed - #297

Merged
max-sixty merged 1 commit into
mainfrom
fix/duplicate-swipe-control-stability-fixture
Sep 5, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/duplicate-swipe-control-stability-fixture

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Problem

#291's last commit was a base merge, and it stacked the PR's swipe work on top of equivalent content main had landed independently. Two files merged textually without a conflict, so both copies survived and landed on main as 7ffb4d4. Eleven nightly tests are red there now, deterministically.

CONTROL_STABILITY_PAGE gained a second stable-swipe-decision deck beside main's. The page declares seven ids twice, so every parametrization of test_each_control_archetype_holds_its_neighbours_still fails before the browser opens:

$ uv run pytest tests/test_render_controls.py --run-nightly -n0 -q -k each_control_archetype_holds_its_neighbours_still
9 failed, 71 deselected in 3.31s

E  AssertionError: duplicate ids (anchors need unique targets): ['stable-swipe',
E  'stable-swipe-a', 'stable-swipe-b', 'stable-swipe-decision', 'stable-swipe-keep',
E  'stable-swipe-pass', 'stable-swipe-queue']

.lf-margin-button.lf-react[aria-pressed="true"] gained color: var(--ink-2). Main had already fixed that problem one level down, by excluding .lf-margin-button from the .lf-react-palette > .lf-react:not(…) repaint rules in both skills/leaf/assets/theme.css and the chrome's @scope block, so a margin reaction keeps its own furniture without an override. Layered on top, the override is what now moves the ink between resting and pressed — the thing the test forbids. Dark reads rgb(201, 195, 182) pressed against rgb(232, 228, 219) resting; light reads rgb(60, 57, 52) against rgb(28, 27, 24).

Solution

Drop both, since main carries the working form of each. The archetype entry goes with the fixture rather than being re-seated: main's swipe-verdict covers .lf-swipe-controls > button, a superset of the :is(.lf-swipe-pass, .lf-swipe-keep) the second entry declares, so the coverage half needs nothing. Both files return to their f37fc167 content, which is the only thing #291 changed in either.

Verification

  • uv run pytest tests — 864 passed, 6 skipped
  • uv run pytest tests/test_render_controls.py tests/test_render_reactions.py --run-nightly -n0 -k "each_control_archetype_holds_its_neighbours_still or selected_reactions_keep_neutral_button_furniture" — 10 passed (the 11 that are red on main)
  • uv run pytest tests/test_render_controls.py --run-nightly -n0 -k composed_corpus_declares_every_control_row_archetype — 1 passed, so dropping the archetype entry leaves the corpus fully declared

The two repairs #291 was actually about survive the merge and are untouched here: composing/targets.js's line.right + gap seat and the themed class-surface pin both pass at 7ffb4d4.

…landed

#291's base merge stacked its swipe work on top of equivalent content main
had landed independently, in two files git merged without a conflict.

`CONTROL_STABILITY_PAGE` gained a second `stable-swipe-decision` deck beside
main's, so the page declares seven ids twice and every parametrization of
`test_each_control_archetype_holds_its_neighbours_still` fails before the
browser opens. Main's `swipe-verdict` archetype covers `.lf-swipe-controls >
button`, a superset of the `:is(.lf-swipe-pass, .lf-swipe-keep)` the second
entry declares, so both halves of the addition go.

`.lf-margin-button.lf-react[aria-pressed="true"]`'s `color: var(--ink-2)`
repaints a pressed margin reaction away from its resting ink. Main fixed the
same problem one level down by excluding `.lf-margin-button` from the
`.lf-react-palette` repaint rules in `theme.css` and the chrome's `@scope`
block, so the override is redundant and breaks
`test_selected_reactions_keep_neutral_button_furniture` in both schemes.
@max-sixty
max-sixty merged commit b69c5d3 into main Sep 5, 2026
3 checks passed
@max-sixty
max-sixty deleted the fix/duplicate-swipe-control-stability-fixture branch September 5, 2026 08:23
max-sixty pushed a commit that referenced this pull request Sep 5, 2026
…action (#298)

## Problem

Main's nightly run
[33950527888](https://github.com/max-sixty/leaf/actions/runs/33950527888)
failed 13 tests. Ten are already repaired on main by #286, #291 and
#297; the three that remain are all on the feature gallery, and they
share one cause: that page never stops rendering its margin, so its main
thread runs back-to-back ~350ms tasks forever and every Playwright read
of it waits on one.

The cycle is a layout hook that restates content. `syncLayout` ends in
the anchor runtime's `dockSeats`, which called `record.margin.update()`
on every reaction seat; `update()` restates the offer, so it ran a full
margin render; a margin render ends in `paintKeys`, which ends in
`paintHere`, whose animation frame ends in `syncLayout`. Any page
carrying a standing reaction closed that loop and ran a whole margin
render every frame with nothing dispatched and nothing on the page
moving. #289 measured the same thing from the other side and named it as
a finding it did not fix.

## Solution

`dockSeats` asks the margin to repack its rows —
`scheduleMarginLayout()` — rather than to restate what the seats offer.
That is what the hook is for: the chrome moved, so the rows a seat hangs
in have to be packed again. The end state is the same pass the render
was scheduling anyway, minus the render.


`test_a_settled_page_with_a_standing_reaction_stops_rendering_its_margin`
counts `lf-margin-layout` over 30 frames on a settled gallery and
asserts at most one, which is the two-second heartbeat's share. It
asserts the reaction seat first, because a page with no seat visits
nothing in `dockSeats` and would pass saying nothing.

<details><summary>How the cause was found, and the numbers</summary>

`told()` failed with `waiting for X, the page last applied X` — the two
readings equal. They were equal: the page had taken in what the server
held, but `page.wait_for_function` could not complete inside its 500ms
round, because on that page a trivially true `wait_for_function` took
~700ms and a bare `page.evaluate("() => true")` took ~370ms. A
`longtask` observer on the same page reported ten consecutive tasks of
325–394ms over three seconds, with nothing dispatched.

A CDP sampling profile named the loop:

```
(anon)@living-margin.js:836 <- [email protected]:818
  <- [email protected]:2164 <- [email protected]:26
  <- [email protected]:128 <- [email protected]:375
  <- [email protected]:1190 <- [email protected]:233
  <- leaf.js:533 (the paintHere frame)
```

and a stack capture on `paintHere` closed it: 42 of 48 calls over two
seconds arrived from `paintKeys` reached from that same margin render,
i.e. one per frame.

Bug-back on the new test with the one-line fix reverted: 30 margin
layouts over 30 frames, against `<= 1`. The suite is also faster where
it touched the gallery — the seven tests #291 covers ran in 329s on main
and 243s with this change.

</details>

## Testing

- The three failures this fixes, on this branch:
`test_the_feature_gallery_exercises_core_reader_workflows`,
`test_the_feature_gallery_exercises_live_and_snapshotted_external_data`,
`test_r_immediately_opens_the_gallery_reactions_and_digit_chooses` —
passed. The first was reproducing on main before the change (121s,
failing) and now passes in 18s.
- `uv run pytest tests` — 864 passed, 6 skipped.
- `--run-nightly` on `test_render_margin.py`, `test_render_anchors.py`,
`test_render_navigation.py`, `test_render_reactions.py` — 279 passed;
`test_render_aim.py`, `test_render_semantic_selection.py` — 74 passed;
`test_render_controls.py`, `test_render_conversations.py`,
`test_render_pages.py` — 196 passed.
- The new test, three consecutive runs — passed.
- `pre-commit run --all-files` — passed.

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/33950527888)

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