Repository navigation
Fix the exported rail and the render coverage after the Button fold - #169
Conversation
… change `bba885a` landed the `…` fold without the nightly suite. A secondary contribution is now folded out of the rail and stands in the fold as a proxy, and the fold itself is a generated container in every cluster, so thirteen tests read a control the reader can no longer aim at or a shell the reader cannot see. Three of those are the layer's own. `bake` takes the emptied fold before it asks whether a target item is `:empty`, so a copy stops holding a rail open for nothing. The two `keydown` listeners the change added go through the register instead: the fold is a rung of the page's Escape ladder, and the card is a popover the platform already dismisses, so its `toggle` hands focus back only where that dismissal left it nowhere. The page-map sheet's focus ring is drawn inset, because a row fills the scrolling list to its own edge and an outset ring is cut on both sides. The rest is test surface. `unfolded_button` presses `…` and hands back the Button standing in for one folded contribution; two assertions that the fold alone had made true are restated; the `margin-action` archetype moves to the press that still has a neighbour; and the ring walk gains the Thread card and the compact Page-map sheet, which a Tab walk of the page cannot open for itself.
leaf-agent
left a comment
There was a problem hiding this comment.
Two findings, and they are the same root twice: expandedOptionsKey is durable page-global state — nothing folds it when the reader walks away — and both new consumers read it without asking where the reader is standing. Both are verified in a browser here, not inferred; the repro for each is in its comment.
The rest of the change reads well. bake's ordering is right and matches the sweep it sits in — .lf-margin-options is built with el, not offer, so the emptied-box walk above it stops at the fold; outline-offset: calc(-1 * var(--here-ring-w)) is the layer's own idiom for this; and unfolded_button names the fold rather than a control, which is the division the layer actually makes.
Not approving because GitHub rejects a self-approval, not as a verdict on the rest.
The Escape rung the fold added read `expandedOptionsKey` off the page, so a reader who unfolded a cluster and then walked into a tray or the thread panel pressed Escape and folded the cluster behind them — keeping the layer they were in and throwing their focus back out onto `…`. The ladder's own rule, stated a few lines above it, is that it unwinds from where the reader is standing. The rung now fires from inside the cluster or with nothing held, asked of the cluster's own element so the clusters that dock in the chrome keep it too. `lowerMarginSurface` had the same shape: it folded on every disarm, including one whose surface was a reply strip and which never raised the margin at all, and one over a fold the reader had opened themselves — where `openButtonOptions` is a no-op, so "as the press found it" was a fold the press never opened. The raise records whether it did the unfolding and only that raise puts it back. `buttonsUnfolded()` becomes `unfoldedButtons()`, handing back the cluster rather than a flag, which is what both callers need to ask their question of.
leaf-agent
left a comment
There was a problem hiding this comment.
One finding on 24b79df, and it is the fold-back's focus rather than its guard: marginUnfolded now decides whether to fold correctly, but foldButtonOptions() still folds with returnFocus: true, and the put-down runs from wherever the reader happens to be standing. The Escape rung earns that focus move — the reader is in the cluster by construction now — while a disarm does not, so every disarm that folds a cluster also throws the reader onto that cluster's …. Detail and the repro are in the inline comment; it is verified in a browser here on both paths, against 24b79df and against the merge base.
The unfoldedButtons() half reads right. hosts.get(expandedOptionsKey) is the same key the pruning at if (expandedOptionsKey && !live.has(expandedOptionsKey)) keeps live, expandedOptionsKey ? … matches the truthiness the rest of the file already asks of that key, and unfolded.contains(active) is a document-tree question on both sides — externalPerch climbs out of every shadow root until main.contains(perch), so a host is never staged inside one, and documentFocused retargets the reading to the outermost host. Asking the cluster rather than the chrome does keep the toolbar-docked half, as the comment says.
Not approving because GitHub rejects a self-approval, not as a verdict on the rest.
`lowerMarginSurface`'s put-back called `foldButtonOptions()`, which folds with `returnFocus: true`. That focus move is the Escape rung's: the rung only fires from inside the cluster now, so putting the reader on the `…` they opened it with is the whole of what the press promises. The put-down has no such standing — it runs on every disarm, from wherever the reader happens to be — so a disarm that folded a cluster back also dragged the reader out onto that cluster's `…`, and a press already on its way landed on a Button they were not standing on: Enter on another cluster's `…` disarmed, was moved, and reopened the cluster the disarm had just closed. `foldButtonOptions` now takes the caller's answer, defaulting to the rung's `returnFocus: true`; the put-down passes `false` and folds silently.
leaf-agent
left a comment
There was a problem hiding this comment.
The put-down's focus is fixed, and it verifies out here rather than on the commit's word. foldButtonOptions({ returnFocus: false }) on the disarm path, with ({ returnFocus = true } = {}) as the signature's default, keeps the two callers apart: the Escape rung in leaf.js still calls livingMargin.foldButtonOptions() bare, so it keeps the put-back it earns by only firing from inside the cluster, while the put-down folds from wherever the reader is standing and moves no one.
Checked independently: restoring if (marginUnfolded) foldButtonOptions(); in skills/leaf/assets/runtime/reactions.js fails the new case at expect(thistle_more).to_be_focused() with Actual value: inactive, so test_the_fold_a_put_down_takes_back_does_not_take_the_readers_focus holds the behaviour rather than the current code. tests/test_render_reactions.py, tests/test_render_navigation.py and tests/test_render_margin.py are green here (--run-nightly, 121 passed), and ci / lint and ci / test are green on 8c5bda0.
8c5bda0 itself is only the formatter putting the new signature on one line. Both earlier findings are closed; I have resolved the remaining thread.
Not approving because GitHub rejects a self-approval, not as a verdict on the rest.
|
The same fourteen came back on run 33425764621 ( This branch still answers them on today's main. I rebased One failure survives the rebase and it is main's, not this branch's: What I ranBoth trees,
The eight on main are the seven this PR fixes in those files plus I did not push the rebase: GitHub already reports the branch |
|
Run 33428793106 ( One correction to my previous comment, which claimed merging this would leave
It passes at |
|
Run 33430170849 ( Rebase and run
On that rebased tree,
The thirteenth, |
# Conflicts: # skills/leaf/assets/runtime/living-margin.js
|
The merge at I merged Nothing to add on the failure set itself — run 33429695964 ( What I ran on the merged tree
354 passing, 0 failing, over the four modules the merge touches on both sides plus every module the table names. This is the parallel run, not
The thirteenth, |
|
The reason load decides it: the test measures while the panel-close margin transition is still easing, and the transient narrower column happens to satisfy the assertion. A loaded machine reaches the settled layout first, where a docked It is main's, not this branch's, and it predates #166: reverting all of |
627ea48 landed the Escape ladder half of this branch as a registered page-map scope, so that half comes out here: the rung inside `rung()`, the popover toggle's focus return, and the two tests that read the branch's own key-line words. What main does not carry stays — the bake fold, the page-map ring inset, the reaction put-down, and the test surface that reaches a folded Button.
|
Run 33434899458 on So the blocked third and the red-fixing two-thirds are now disjoint: main's registered The fourteen on this runTwelve from this PR's table: Two from #174: Nothing new on this commit, and |
|
Merged Out: the Verified on the merged tree at Title and description are updated to the narrowed scope. The catalog preview digest is still left alone (#168), and run 33433213755 on |
leaf-agent
left a comment
There was a problem hiding this comment.
The merge is the right call and the resolution is faithful — main's registered margin.back row satisfies the register invariant on its own, so this branch's rung had nothing left to fix, and the three things that stay (the bake :empty fix, the ring inset, the reaction put-down) are exactly the parts nothing on main duplicates. The put-down's own two tests still hold against main's scope order.
One thing the resolution left behind: foldButtonOptions kept the two-caller signature after the merge deleted its second caller. keyboardRung() folds by calling setOptionsOpen(optionsHost.lfEntry, false, { returnFocus: true }) directly, never through this member, so the only call site left in the tree is reactions.js's disarm and it always passes returnFocus: false. The returnFocus = true default is unreachable, and the comment's last sentence names a rung that no longer routes here. setOptionsOpen's own returnFocus already defaults to false, so the option can go entirely.
|
Run 33435304606 on
The fourteenth stays red after both land, as this PR's body predicted: the digest moves again because this branch edits hashed runtime inputs. It wants What was runScratch worktree at The thirteen, in three batches under The fourteenth on the same tree: |
The merge with main deleted this member's second caller: keyboardRung()
folds through setOptionsOpen(optionsHost.lfEntry, false, { returnFocus:
true }) directly, so the Escape rung no longer routes here. The one call
site left is the reaction disarm, which always says returnFocus: false —
setOptionsOpen's own default — leaving the returnFocus = true default
unreachable and the comment naming a rung that does not call it.
…text (#173) ## Problem The nightly `test` job on [run 33425820038](https://github.com/max-sixty/leaf/actions/runs/33425820038) (afd65dd) came back `15 failed, 1561 passed`. Thirteen of the fifteen are the failure shape that has been red on main since `bba885a`, and #169 already fixes them; this PR is the fourteenth, `test_render_widgets.py::test_suggestion_controls_stay_out_of_the_column`, which is new on this run and is a real layout bug rather than the test's timing. A margin row that docks next to an inline perch lands **on** the line it decides instead of under it. `.lf-margin-item` is `display: inline-flex`, and it is `position: absolute` that blockifies it while it hangs in the rail. Docking only swaps `position: static` back in, so the row becomes inline-level again and joins whatever line box its perch sits on. For a change inside a card the perch is the inline `lf-suggestion` element itself — `externalPerch` takes `blockAt(target) ?? target`, and `TEXT_BLOCK` matches no ancestor inside `lf-card` — so the ✓/✗ row is baseline-aligned onto the last line of the sentence it decides. <details><summary>Measured, at 820×900 with the panel closed</summary> The row (`.lf-margin-item.lf-docked`, `display: inline-flex`, no transform) and the two line boxes of the inline `#sug-in-card` it is a sibling of: | box | top | bottom | | --- | --- | --- | | `#sug-in-card` line 1 | 511.09 | 530.09 | | **docked row** | **536.28** | **566.28** | | `#sug-in-card` line 2 | 539.53 | 558.53 | `#sug-in-card.contains(row)` is `false` and the row's parent is `LF-CARD#card-heater`, so this is not overflow out of the widget — the row is inline content sharing the widget's last line, extending above and below the text because an inline-flex box 30px tall is baseline-aligned against a 19px line. </details> ## Why it went twelve commits without failing The test read the layout while it was still moving. Closing the thread panel gives the room back on an eased `margin-right`, and the column re-wraps for the whole ~0.2s of it; the test clicked **Close threads**, resized, waited for the docked class, and measured. On an unloaded machine every read landed with body margin still at ~152px, where the narrower column wrapped the card's sentence onto enough lines that the row fell below it and the assertion held. A machine loaded enough to reach the settled layout first reads the real one. The transient and settled readings, same test, same commit: | body margin at the read | row top | `#sug-in-card` bottom | verdict | | --- | --- | --- | --- | | 151.9px (transition running) | 563.47 | 557.28 | passes | | 0px (settled) | 536.28 | 558.53 | fails | So this is not a regression from #166, and reverting all of `skills/` to `28b0e2b` — the commit before it — reproduces the identical `assert 536.28125 >= 558.53125`, 6/6. It is a bug the suite could not see. #167, which adds a rendering turn to `resized()`, would have surfaced it the same way. ## Solution - `.lf-margin-item.lf-docked` states its own `display: flex`, so a docked row is a line of its own wherever it comes to rest rather than inheriting the inline level the absolute position was covering for. `width: fit-content` keeps the box the width it had in the margin: `.lf-margin-item` carries `pointer-events: auto`, and a block-level row stretched to the column would take presses across a whole line the reader may be selecting in. - The test says the ordering it depends on: `panel_settled(page, open=False)` before the resize, so it reads the layout the reader ends up in. Without it the test proves the transient one, which is how it stayed green. Fixed in the theme rather than in `externalPerch`, because the perch is the right one — the row belongs beside the change, not after the card — and "docked is a line of its own" is the property every perch needs, not just an inline one. ## Testing - `test_suggestion_controls_stay_out_of_the_column`: 3/3 unloaded and 4/4 with the machine loaded, on the rebased head. Bug-back: with `theme.css` alone reverted to `origin/main`, it fails on the first run, unloaded — the ordering statement makes it deterministic in both directions. - Everyday suite: `740 passed, 6 skipped`. - Complete nightly suite, run file by file: the only failures left are the thirteen #169 covers (`test_render_controls` ×2, `test_render_widgets` ×5, `test_render_export`, `test_render_navigation`, `test_render_outbox`, `test_render_projection` ×2, `test_site`). No new ones, and `test_render_margin.py`, `test_render_pages.py` and `test_render_aim.py` are green. - `pre-commit` on both changed files: pass. <details><summary>The fifteenth failure, left alone</summary> `test_render_navigation.py::test_composer_marks_the_passage_instead_of_quoting_it` failed once on this run (`assert 'specimen' in ''`) and I could not reproduce it: 5 runs at `-n0`, 12 more with the machine loaded, and 3 whole-file runs at `-n 2`, all green, including on the rebased head. It stays unclassified rather than fixed — a guess at a wait for a failure that reproduces nowhere is how a test stops proving anything. </details> --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/33425820038) Co-authored-by: leaf-agent <[email protected]>
Problem
bba885a("Canonicalize target Buttons") landed the…fold without the nightly suite, and run 33364553456 came back14 failed, 1558 passed. They are one change seen from several sides: a secondary contribution is nowdisplay: nonein the rail and stands in the fold as a proxy, and the fold itself is a generated container that stands in every cluster. The same set has been red on everycirun ofmainsince, most recently run 33434899458 on627ea48.627ea48("Route margin Escape through the keyboard register") has since landed the Escape half of this branch onmain, as one registeredmargin.backrow. That half is out of this PR now — see What main took over — and the twelve still red on627ea48are what is left here, plus the catalog preview digest, which CI is the wrong machine to refresh (Left alone).Solution
Two of these are the layer's, not the tests':
baketakes.lf-margin-item:emptyso a pending action's stripped shell does not reserve the live page's rail. The fold is a child of every item whether or not anything is folded into it, so once its proxies were stripped the item was no longer:emptyand kept the rail on the strength of a shell. Take the emptied fold first, then ask the item. (test_a_copy_says_a_change_is_only_proposedcounted 3 items where it wanted 0, andtest_an_exported_example_stands_on_its_own[release-notes]read the empty right strip those shells left standing.)One behaviour change survives from the Escape work, because
mainhas no equivalent: a reaction raise that unfolds a cluster to stand its choices in folds that cluster back when the choices are put away — that cluster only, and without claiming the focus. Without it, disarming a reaction on a reply strip took away a fold the reader had opened for themselves, and a fold-back that moved focus threw a reader standing on another cluster's…onto one they had left.unfoldedButtons()hands back the unfolded cluster rather than a flag so the raise can ask whose target it belongs to; each guard has a test that fails against the unguarded form.The rest is test surface that still names a control the reader can no longer aim at:
unfolded_button(control)presses…and hands back the Button standing in for one folded contribution — the owner keeps the row's record and never comes out from behind the fold. Six presses of.lf-sug-rejectgo through it.visibility: hiddenthat says the decision was taken.margin-actionarchetype's target moves from the accept press, which has no visible control left to hold still, to…, whose neighbour is the primary and whose transition adds Buttons to the row it is made on..lf-margin-preview-action, which used to lightpage-map-action, went with the card that now holds only threads.Testing
Against
dae00e6,main's head at the merge:uv run pytest tests— the PR gate: 749 passed, 6 skipped.test_render_controls.py,test_render_export.py,test_render_outbox.py,test_render_projection.py— 204 passed;test_render_widgets.py,test_render_navigation.py,test_render_margin.py,test_render_reactions.py,test_render_aim.py— 221 passed. Both under--run-nightly -n 2.pre-commiton every changed file: pass.The ring walk's own two halves are asserted before they are divided by, so the new scopes are evidence rather than coverage:
a thread cardandthe page map sheetboth open, both walk, and the walk reports the sheet's cut ring before the theme fix and nothing after it.What main took over, and the one question it leaves open
627ea48replaced the living margin's two localkeydownlisteners withkeyboardRung()inliving-margin.js, registered asPAGE_MAP's singlemargin.backrow ahead of the reaction and navigation modes. That satisfies the register invariant on its own:test_the_register_is_the_only_way_a_key_enters_the_runtimeandtest_design_mode_comments_on_what_a_press_lands_on_and_nothing_elseboth passed on627ea48with none of this branch applied.So this branch's own ladder comes out rather than standing behind main's: the
unfoldedbranch inrung(), the popovertoggle's focus return, and the two tests that read this branch's wording (fold, and the reply box as a rung of its own under the card). Kept, both implementations would be live at once with main's row in front — one act named two ways depending on where the reader is standing.Two cases main's row does not carry, left as a question about
mainrather than a blocker here, since nothing red waits on either:margin.backfires withatFocustrue, so it needs focus inside the cluster; this branch's rung also folded for a reader holding nothing.627ea48closes the card on the first press from inside the box, and main's own copy oftest_a_new_anchored_comment_opens_its_inline_threadasserts that.Left alone: the catalog preview digest
test_site.py::test_the_public_catalog_is_a_visual_index_of_full_page_routesfails onpreview inputs changed — rerun scripts/example-previews.py, and this branch does not run it. #133 measured why: the runner has none of Charter, Iowan Old Style or Georgia, so a capture taken here falls the prose to a generic serif and clips the banner's sentence in every still — recapturing from CI would swap the public gallery's typography for the runner's. I ran the script here to confirm that is still true; all nine stills changed, including the six whose examples nothing had touched, which is the substitution's signature rather than a real recapture. The bytes are not in this branch.It would also be moot: this branch edits
leaf.js,chrome-style.js,living-margin.jsandreactions.js, all hashed inputs, so the digest moves again when it lands. #168 is open to name this as its own red-suite class; the refresh belongs to the nextwt mergefrom the authoring machine.The twelve still red on 627ea48, and where each goes
test_render_widgets::test_a_copy_says_a_change_is_only_proposed:emptybaketest_render_export::test_an_exported_example_stands_on_its_own[release-notes]baketest_render_controls::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpusmargin-targetandpage-map-actionpainted nowhere the walk reachestest_render_controls::test_each_control_archetype_holds_its_neighbours_still[margin-action]…test_render_widgets::test_a_decision_the_server_never_took_never_shows_as_takenunfolded_buttontest_render_widgets::test_a_widget_naming_its_own_words_does_not_read_the_runtimes[reject-Rejected]unfolded_buttontest_render_widgets::test_a_second_press_inside_the_round_trip_adds_no_second_decisionunfolded_buttontest_render_widgets::test_a_decision_travels_between_tabs_and_the_log_has_the_last_wordunfolded_buttontest_render_projection::test_a_pending_suggestion_can_be_discussed_instead_of_decidedunfolded_buttontest_render_projection::test_a_decision_that_empties_its_widget_detaches_the_element_anchorunfolded_buttontest_render_outbox::test_a_second_tab_takes_the_decision_back_toounfolded_buttontest_site::test_the_public_catalog_is_a_visual_index_of_full_page_routesThe two Escape-ladder failures from the original fourteen —
test_render_navigation::test_the_register_is_the_only_way_a_key_enters_the_runtimeandtest_render_aim::test_design_mode_comments_on_what_a_press_lands_on_and_nothing_else— are627ea48's now and pass onmain.Automated fix for failed run