Skip to content

Repair the two nightly margin tests that read their own arrangement as a fault - #752

Merged
max-sixty merged 1 commit into
mainfrom
nightly-on-main
Sep 17, 2026
Merged

max-sixty merged 1 commit into
mainfrom
nightly-on-main

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Both cases were red on main, and each failed on how it was arranged rather than on the behaviour it names. Neither runs on a pull request — they are nightly-marked — so the evidence here is local runs, noted below.

test_the_margin_groups_meanings_at_one_destination_without_moving_the_page pressed ArrowDown from wherever the preview had left focus. The walk is over the markers the viewport holds and never scrolls to reach one, which is the contract this case is named for, so once #746 moved this fixture's third marker to 969 in a 900-pixel viewport the press landed on the last marker on screen, clamped, and the case read that clamp as a walk that had failed to move. It now presses Home to start at the first marker the walk offers and steps down from there, reading the count the walk itself publishes in .lf-walk-position. My first repair recomputed which markers the viewport holds inside the test; that is a second copy of visibleRows, and it drops the hidden, withheld and invisible rows that the runtime's copy also filters, so it could predict a neighbour the walk would skip.

test_margin_layout_batches_the_composed_page_without_refolding_controls bounds the browser work of five margin layout passes that change nothing, but its count started before the page's first pass, which reconciles the contained frames it had just waited for. Measured on the corpus:

span LayoutCount RecalcStyleCount
first pass after the frames arrive 4 21
every pass after it 2 3
first pass after a resize 2 3
five unchanged passes, warm 10 11
ten unchanged passes, warm 20 21

A changed pass costs what an unchanged one costs, so the 21 is page startup rather than the price of a change. The budget of 30 was carrying an 18-recalculation constant it never named, and went red at 31 where that constant landed one higher. Spending that pass before the metrics snapshot leaves the five measured passes at 10 layouts and 11 style recalculations across the corpus's 39 clusters, so the same bound now states what the test names: work that follows the phases rather than the number of contributed controls.

No product change: the margin layout's steady cost is 2 layouts and about 2.1 style recalculations per pass over 39 clusters.

Verification
  • Both cases pass, run together on a clean worktree at this change: 2 passed in 16.04s.
  • pre-commit run --files tests/test_render_margin.py clean.
  • The whole tests/test_render_margin.py module on this change: 108 passed in 126.08s.
  • The walk failure appeared in the scheduled nightlies of 2026-09-08 and 2026-09-13; the budget failure is macOS-only, since the constant lands under 30 on the hosted Linux runner.

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

…s a fault

Both cases were red on main, and each failed on how it was arranged rather than
on the behaviour it names.

`test_the_margin_groups_meanings_at_one_destination_without_moving_the_page`
pressed ArrowDown from wherever the preview had left focus. The walk is over
the markers the viewport holds and never scrolls to reach one, which is the
contract this case is named for, so once #746 moved the third marker of this
fixture to 969 in a 900-pixel viewport the press landed on the last marker on
screen, clamped, and the case read that clamp as a walk that had failed to
move. It now presses Home to start at the first marker the walk offers and
steps down from there, reading `.lf-walk-position` — the count the walk itself
publishes — rather than recomputing which markers the viewport holds. Deciding
that here would be a second copy of `visibleRows`, which also drops rows that
are hidden, withheld, or invisible.

`test_margin_layout_batches_the_composed_page_without_refolding_controls`
bounds the browser work of five margin layout passes that change nothing, but
its count started before the page's first pass, which reconciles the contained
frames it had just waited for. On the corpus that pass costs 4 layouts and 21
style recalculations, against 2 and 3 for every pass after it, and 3 again for
a pass that follows a resize: the reconciliation is page startup, not the price
of a changed pass. The budget of 30 was therefore carrying an 18-recalculation
constant it never named, and went red at 31 where that constant landed one
higher. Spending that pass before the metrics snapshot leaves the five measured
passes at 10 layouts and 11 style recalculations across the corpus's 39
clusters, so the same bound now states what the test names.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 95a542a into main Sep 17, 2026
5 checks passed
@max-sixty
max-sixty deleted the nightly-on-main branch September 17, 2026 05:41
max-sixty added a commit that referenced this pull request Sep 17, 2026
…ndex scale (#756)

Every colour token in `theme.css` now states its light and dark values
in one `light-dark()`, so the 29-line `prefers-color-scheme: dark` block
is gone and a token can no longer be changed in one scheme and missed in
the other. The root already set `color-scheme: light dark`, which picks
the half. The MCP app sets `color-scheme` on its shadow host for the
host's declared theme, so `split_theme` and the snapshot's `darkTheme`
go.

The 24 stacking literals in `theme.css` and `chrome.css` now read 17
named `--lf-z-*` tokens, listed in order in `:root`. The values are
unchanged.

The `@layer` half of the TODO row was tried and backed out; the row
stays open with the finding. With Leaf's sheets layered, a page's
unlayered `<style>` outranks all of them, so a page `div { position:
relative }` moved 53 chrome boxes including the aim (`test_render_aim`).
Giving `chrome.css` its own rung also flipped the specificity contests
it was written against `theme.css` with, such as a thread's focus tint.

Full suite with `--run-nightly` locally, before merging main: 2691
passed, 4 failed, and all 4 also fail when run on a merge-base worktree:
`test_a_stale_package_widget_uses_recursive_parent_eligibility`,
`test_the_room_is_measured_after_a_late_rail`,
`test_the_margin_groups_meanings_at_one_destination_without_moving_the_page`
(repaired on main by #752), and
`test_a_current_auxiliary_choice_replaces_a_persisted_tray_during_replay`.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5 <[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