Skip to content

Let the edge trim reach the live tab block's bottom margin - #113

Closed
leaf-agent wants to merge 1 commit into
mainfrom
fix/ci-33272278362
Closed

Let the edge trim reach the live tab block's bottom margin#113
leaf-agent wants to merge 1 commit into
mainfrom
fix/ci-33272278362

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Problem

ci on main is red at fcf32c2: tests/test_render_gate.py::test_example_renders fails on both gallery and parallel-workstreams with <main> draws 96px of inset and shows 128px below what it holds … its last block is a <lf-tabs> reserving 32px against a neighbour it hasn't got.

ce73388 gave a rendered lf-tabs its own frame and stated the block margin around it in the same rule — inside @media screen { html:not(.lf-copy) { … } }. That guard carries weight: the nested selector is html:not(.lf-copy) lf-tabs.lf-rendered, and the edge trim in theme.css is :nth-last-child(1 of :not(.lf-ui, [data-lf-gen])), which the guard outranks. main declares --lf-frame: 1, so on a page whose column ends in a tabs block the trim fired and lost, and the 32px it should have cancelled was painted as page inset — the exact reading TRAPPED_MARGINS exists to report.

Solution

Make the guard weigh nothing: :where(html:not(.lf-copy)). Every rule in the block then says what it weighs on its own, the tabs margin drops to lf-tabs.lf-rendered (0,1,1), and the trim reaches it.

:where(html:not(.lf-copy)) is already the file's idiom for a medium guard that shouldn't add weight — seven other blocks in packages/default/theme.css use it, and the one nested rule that needs weight against a :not() chain (lf-options[choose] at line 468) states it separately. The fix is at the level of the rule the regression is in rather than at the trim, because a trim that had to outrank whatever a widget declares would be an !important in a stylesheet a project overlays.

What the other rules in the block do at their own weight

Checked each against what it has to beat, since the guard's weight came off all of them:

rule new weight contest
lf-tabs.lf-rendered (0,1,1) beats lf-tabs (0,0,1); now loses to the trim (0,2,0), which is the fix
.lf-tabstrip (0,1,0) ties .lf-tabstrip { display: none } 20 lines above and wins on source order
> lf-tab::before (0,1,2) beats lf-tab::before (0,0,2)
> lf-tab (0,1,2) ties lf-tabs.lf-rendered > lf-tab { margin-top: 14px } and wins on source order
> lf-tab:not([hidden]), [hidden], [hidden]:not(…) (0,2,2)–(0,3,2) unchanged relative order

tests/test_render_navigation.py::test_an_inline_tab_keeps_its_panel_inside_one_visible_boundaryce73388's own test for the frame, its grounds and its insets — passes, so the surface ce73388 built is intact.

Testing

  • uv run pytest "tests/test_render_gate.py::test_example_renders[parallel-workstreams]" "tests/test_render_gate.py::test_example_renders[gallery]" --run-nightly -n0 — 2 passed; both fail on main without this change (reproduced here first).
  • uv run pytest tests/test_render_navigation.py tests/test_render_gate.py --run-nightly — 120 passed.
  • uv run pytest tests/test_interact_layer.py — 125 passed, 6 skipped.
  • pre-commit run --files plugins/leaf/skills/leaf/packages/default/theme.css — clean.

The run's two other failures are separate and not in this PR: the search-match bounding_box() read is #111, and test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus reports the page-map preview's close button sitting over the find box's ring in design mode, which is its own defect.


Automated fix for failed run

ce73388 gave a rendered lf-tabs its own frame and stated the surrounding
margin under the live-page guard, at a weight the :nth-last-child edge trim in
theme.css cannot beat. A page whose column ends in a tabs block therefore
painted 32px of trapped room inside main's 96px inset, which is exactly the
defect TRAPPED_MARGINS reports.

The guard is :where() now, so every rule in the block weighs what its own
selector says and the trim reaches the margin.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Still failing on main one commit later: 33273880881 at e5e3063, with the same two readings this PR fixes — tests/test_render_gate.py::test_example_renders on both gallery and parallel-workstreams, each reporting <main> draws 96px of inset and shows 128px below what it holds … its last block is a <lf-tabs> reserving 32px against a neighbour it hasn't got.

e5e3063 touches notes/agent-usability-evals.md alone (4 insertions, 4 deletions), so it carries nothing that could reach the cascade — the failure is inherited from main, as this PR's diagnosis of ce73388 says.

The run's third failure is the find-box ring under the margin preview's close button, which is #114.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

The third failure this body flags as "its own defect" now has a PR: #114, which takes placePreview's room from the page's box instead of the window. Independently derived the same two fixes from 33272397619 (d2fa10f) before finding these, and the pair is jointly sufficient — with both applied, uv run pytest tests --run-nightly is 1493 passed, 6 skipped in 30:01. Nothing else in the run is red, so #113 and #114 together close it and no third change is owed.

Base for that run was d2fa10f plus both diffs, not today's main (049f5df), which has moved four commits since; the suite has not been run against that head with both applied.

Same conclusions, reached separately
  • The trapped margin is cascade, not a missing declaration: main computes --lf-frame: 1 and lf-tabs.lf-rendered is genuinely the :nth-last-child(1 of :not(.lf-ui, [data-lf-gen])) match — probed in the browser, it just computes margin-bottom: 32px anyway. :where() on the guard is the same change as this PR's.
  • For the preview, measured on gallery in design mode at 1200×900 with Threads open: marker 589–621, card 629–949, panel 780–1200, page box 0–765. rightRoom reads 1200 - 621 - 12 = 567 against a 328px need, so the card goes right and 169px of it lands on the panel; against the page's box it is 132, so it flips left to 261–581.
  • Both first appear at ce7338833269374595 on c14bb42 has neither.

One difference worth naming, though it is not a defect in #114: document.body.getBoundingClientRect().right is body's border-box edge, which includes the scroller's stable gutter, where composing/surface.js's rightEdge() uses pageScroller.clientWidth and stops inside it. The card can therefore sit up to a gutter's width under the scrollbar. A fixed float cannot hand body a sideways scrollbar, which is what that clamp in surface.js is for, so the looser bound is defensible — just not quite the same reading.

max-sixty pushed a commit that referenced this pull request Aug 29, 2026
## Problem


`tests/test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`
is red on `main` —
[33271145855](https://github.com/max-sixty/leaf/actions/runs/33271145855)
and again at `fcf32c2` in
[33272278362](https://github.com/max-sixty/leaf/actions/runs/33272278362)
— with one fault over 402 stops: `in design mode of gallery, the ring on
input.lf-find-box "" is not all there: its top edge is under
button.lf-btn.lf-margin-preview-close "×"`.

`placePreview` (living-margin.js) measured its room against
`innerWidth`. An open panel does not stand over the page — it takes its
strip out of the body (`body[data-lf-panel] { margin-right:
var(--lf-panel-w) }`, chrome-style.js) — so a card placed against the
window reaches across the page's right edge and into the panel. The
first thing it covers there is the narrowing box at the top of the
thread list, and a preview the reader left open is clamped to `minTop`
once its marker scrolls away, which is exactly the band that box sits
in. Probing the walk on `gallery` with the panel open: the preview
stands at `629,50 → 949,248` while the page's room ends at `x=780` and
the panel runs `780 → 1200`, so its `×` sits over the find box's ring at
`792,101 → 1056,132`.

`ce73388`'s tab frame is what exposed it — it moved the marker that walk
opens — but the placement is wrong on its own, and the ring walk is what
reads it: a control whose ring the reader can only see half of.

## Solution

Take the room from the page's own box
(`document.body.getBoundingClientRect().right`) rather than from the
window, for both the right-of-marker test and the final clamp. This is
the side's version of the line two above it, which already bounds the
card by the banner rather than by the top of the window. Where the panel
covers the page instead of standing beside it, the preview is already
closed and refused (`changePosture`, keyed on the same covering query),
so the body's edge is the whole of the answer.

The new test opens the panel, hovers the marker, and asserts the card
stays clear of the panel's left edge and of the page's room; it fails on
`main` (`the preview stands in the panel: {'x': 773, 'width': 320}
against {'x': 780}`).

## Testing

- `uv run pytest
tests/test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus
tests/test_render_margin.py --run-nightly -n0` — 14 passed. The ring
test fails on this branch's base without the change (reproduced here
first, and it passes at `ce73388^`, which is how the exposing commit was
identified).
- `uv run pytest tests/test_render_aim.py --run-nightly` — 27 passed
(design-mode chrome).
- `uv run pytest tests` — 715 passed, 6 skipped.
- `pre-commit run --files
plugins/leaf/skills/leaf/assets/runtime/living-margin.js
tests/test_render_margin.py` — clean.

The run's other failures are not in this PR: the two
`test_example_renders` trapped-margin readings are #113, and the
text-entry key and search-geometry reads were fixed on `main` by
`3d04843` and `fcf32c2`.

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

Co-authored-by: leaf-agent <318509791+leaf-agent@users.noreply.github.com>
@max-sixty max-sixty closed this Aug 29, 2026
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