Repository navigation
Read the note's centring against the page's box, not the window - #33
leaf-agent wants to merge 2 commits into
Conversation
The strip a sidenote claims comes out of body's padding, so what says none was taken is the column sitting on the centre of the box that padding is spent from. The new test asked the window for that centre instead, and the two are the same width only where a scrollbar takes no room. Body owns the document's scroll and reserves a stable gutter for it, a decision made at the gutter and reasoned there: wherever scrollbars take room the page is 15px narrower than the window and stands 7.5px to its left, note or no note. So the assertion was a statement about the machine it ran on — green on macOS, where overlay scrollbars make the reservation a no-op, red on the runner, and blind in both to a strip of exactly the gutter's width. ROOM_GEOMETRY gains that box as `pageBox`, body's padding box, which is neither of the two readings it already had: `column` is what the strip moved and `room` is what the strip left, and only a box the strip cannot resize can say whether one was taken at all. Both halves of the test now read against it. Checked in both directions with the corpus: restoring the flat `--strip-l: var(--note)` fails the wide half by the 108px the docstring names, and dropping the reservation to 0px fails the narrow half with the note 34px off the edge.
leaf-agent
left a comment
There was a problem hiding this comment.
test and lint are both green on 542408b, and the geometry holds up: body owns the document's scroll under html:not(.lf-copy), so body.clientWidth is the padding box less the stable gutter, and the strip is body's own padding — a box the strip cannot resize, which is precisely what the window reading wasn't. The two corpus edits in the description cover non-vacuity in both directions, which is the part tests/CLAUDE.md asks for on a geometry assertion.
One naming point. paper is already a term of art here — it is the print medium (theme.css: "What paper does lose is…", leaf.js: "paper needs no rule of its own, never having been handed the arrangement to undo") and --paper is the background token. This helper reads the box of the live page, the one medium the surrounding comment says paper does not have, so the name points at the wrong thing. The returned key is already pageBox, so the two names disagree with each other too. page() sits alongside span() and box() without borrowing a word that means something else.
|
The same failure recurred on Neither intervening commit reaches this: 3889756 touches |
|
On the adjacent observation folded into the description — the Not proposing a PR for it against the queue that is already open; leaving the verified change here so it is one line whenever you want it. The change, and what it measures function stateStrip() {
- const avail = document.documentElement.clientWidth - panelStrip() - trayStrip();
+ const gutter = document.body.offsetWidth - document.body.clientWidth;
+ const avail =
+ document.documentElement.clientWidth - panelStrip() - trayStrip() - gutter;
document.body.toggleAttribute("data-lf-cramped", avail < STRIP_MIN);
document.documentElement.style.setProperty("--lf-avail", avail + "px");
}At the 1100px band on The gate for it, since nothing in the suite can currently see the drift — the narrow half already resizes and reads, so it is one more assertion there: gutter = page.evaluate(
"() => parseFloat(getComputedStyle(document.querySelector('main')).paddingLeft)"
)
assert abs(tight["note"]["left"] - gutter) <= 1, (
f"the strip left the note a gutter of {tight['note']['left']:.0f}px where main "
f"gives its prose {gutter:.0f}px, so the room the page reserved was not the room "
f"the note needed"
)Bug-back: with the runtime line reverted it fails
|
|
Third occurrence, now at 39cf80c — run 32685064246, same assertion and same numbers: Merged this branch into |
|
Not re-reporting the recurrence or the merge check — the comment above has both. One thing not yet on this thread: this PR's own Attempt 1 sat That makes #30 the practical gate on this PR, not just an adjacent fix: the assertion change here is verified correct against current Tonight's wedges, and the log that confirms the signatureFour more since #30's table closed on 2026-08-22, all on the
I cancelled 32672180928 specifically to make its log readable — logs 404 while a job is in-flight — and it is #30's shape exactly. Suite runs clean to 96%, then four hours of nothing, then the orphan set ending in a live browser: No The two |
|
Closing this as superseded, not as wrong. f3d7df1 replaced The 7.5px came straight back with the rewrite: run 32695640826, The wedged |
Problem
ciis red onmainat 749e467 — one deterministic failure intest_a_note_moves_the_page_only_where_the_page_owes_it_room, the test that commit added:column centred at 792px of 1600px,assert 7.5 <= 1.The 7.5px is the stable scroll gutter. Body owns the document's scroll and reserves a gutter for it whether or not a scrollbar is drawn, so on the runner the page's box is 1585px inside a 1600px window and the column centres at 792.5px — a settled decision made at the gutter, reasoned there at length ("reserving a gutter never costs more than the shift not reserving it produces"), and nothing the note has a part in. The test asked the window for the centre a page with no strip would sit on, and the window is that width only where scrollbars overlay — so it was green on macOS, where the reservation is a no-op, and red on Linux.
Solution
Read both halves against the page's box rather than the window.
ROOM_GEOMETRYgainspageBox— body's padding box — because neither reading it already had can answer this:columnis what the strip moved,roomis what the strip left, and only a box the strip cannot resize says whether one was taken at all. The strip is body's padding, so "no strip" is exactly "the column is on the centre of that box", stated without reference to any platform's scrollbar.The fix is in the test, not the theme: the strip arithmetic the commit landed is doing what it says, and the assertion was measuring the scroll region instead.
Testing
Reproduced locally at the same assertion before the change. Checked non-vacuous in both directions against the corpus, since a centring assertion is easy to pass by accident:
--strip-l: var(--note)--strip-l: 0pxuv run pytest tests --run-nightly— 1035 passed, 6 skipped.pre-commitclean on the changed file.An adjacent observation, not fixed here
stateStrippublishes--lf-availasdocument.documentElement.clientWidth, which still includes body's scroll gutter — so the page's box is reported 15px wider than it is, and the strip under-buys by that much. Measured at the 1100px band: the note's gutter lands at 16.5px where--col-padis 24px, half the gutter short. It never paints off the edge, so no assertion sees it, and closing it means deciding how the runtime learns a width it may not measure off the box it writes into — a design call rather than a CI fix, so it is left alone here.Automated fix for failed run