Repository navigation
Stabilize generated interface at presentation - #362
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
Two things about the new startup boundary, one concrete and one worth a second opinion.
A failed startup now blanks the page's generated interface instead of leaving it inert. presentPage deliberately withholds the stamp when a prerequisite fails ("Keep the stamp absent when a malformed widget makes the anchor reading fail"), and startPage().catch withholds it on any startup fault. Before this PR that page kept its generated interface visible and non-interactive; with body:not([data-lf-presented]) > main .lf-ui { visibility: hidden } it keeps the reserved space and paints nothing into it for the page's lifetime. That is a different failure shape from the one the surrounding comments describe — worth deciding explicitly rather than inheriting from the new rule, since the partial-page path is the one the runtime is most careful about.
That interacts with the inline suggestion on settlePageInterface: with Promise.all, an optional surface's throw turns into a startup failure, which under the new rule is now a blank page rather than a reported fault on a working one.
Unverified, but the two facts behind it are checkable. SHADOW_STARTUP_CSS's new .lf-ui rule carries neither gate the light-DOM rule carries — no html:has(script[type="module"][src="/leaf.js"]), no > main — and export_page in skills/leaf/scripts/leaf/exporting.py waits for upgraded, dataApplied, and (only when the log has events) logApplied, never for presented. bake() serializes shadow roots with serializableShadowRoots: true, and it removes data-lf-reading and data-lf-traffic but not data-lf-presented. So a copy taken of an event-free page before the first read applies would carry that <style> over a body with no data-lf-presented, and every generated .lf-ui inside a shadow widget would be hidden in the file forever. The same shape already existed for the dialog/popover rule, where the loss is invisible; widening it to all generated interface is what makes it worth checking. I didn't run an export to confirm the window is reachable.
Note that test_generated_page_interface_first_paints_with_authoritative_geometry lands in test_render_widgets.py, which is pytestmark = pytest.mark.nightly — so PR CI's green here doesn't cover it.
…tion and composer readings as the icon actions now draw them (#369) ## Problem The nightly leg of [`ci` on `ac3342a4`](https://github.com/max-sixty/leaf/actions/runs/34069973701) went red on ten readings. Four are already held by open branches — `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` by #367, and `test_the_composed_corpus_declares_every_control_row_archetype` plus `test_the_render_gate_applies_every_standing_action_a_second_time` by #366 — and this branch leaves them there. The other six all reproduce deterministically on `4cbef417`, and one of them is the product's. **A recovered draft loses the control that would send it.** `test_an_empty_draft_survives_reload_and_blocks_a_version_switch` timed out waiting for Save. `lf-draft` reserves the width of its engaged Save + Cancel pair through `measure`, whose take runs whenever the row is first drawn — which since #362 is at presentation rather than at connection. A draft holding an unsent edit opens its editor in `connectedCallback`, before that. The take then ran `replaceChildren(this.#pencil)` over an editor that was already open, so the reader was left with their words in a live textarea, the resting ✎ beside it, and no Save at all. **Five readings written against shapes #347 replaced.** Its icon actions moved Send inside its field, gave Resolve the accessible name `Resolve thread`, withdrew the page-level `x` resolution, and gave a spent submit a face of its own: - `test_command_hub_send_and_pause_is_one_thread_fold` — `get_by_role("button", name="Resolve", exact=True)` no longer matches. - `test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline[light,dark]` — pressed `x` for the inline resolution and no event was sent. - three `test_render_drafts.py` readings — the response bar is 28px wider now that its submit sits inside the field, so its left edge crossed `#p2`'s centre and Playwright's centre-aimed triple-click landed on the textarea instead of on the passage. It had been clearing that centre by 9px. - `test_a_control_a_widget_built_is_told_from_a_label_it_wrote` — the option group's Add is now `.lf-compose-submit`, whose disabled rule deliberately keeps `opacity: 1` and swaps the accent disc for a muted ring on paper, so a field with nothing in it reads quiet rather than broken. The same design is asserted from the other side in the diff-surface test above (`assert quiet["opacity"] == "1"`), so the two readings had come to contradict each other. ## Solution `lf-draft` gains one `#paintRow`, which states the whole row from `this.#ta` — the editor itself — and is what the reserve take, `#open`, and `#close` all call. Read that way the take cannot arrive with a stale idea of which mode the widget is in. The five readings are restated at the surfaces the layer now draws. Resolve is named exactly; the inline resolution goes through the control's own keyboard route, which is what #347 left it. Passage selection moves to a `select_words` helper that aims at the passage's first line rather than at its box, since a short paragraph in a wide column is mostly empty at the centre and that empty half is where a float placed to keep *its own* target clear will stand. The spent-face reading is taken as a change against each control's own live face — lifting the disabled fact off it and putting it straight back — for the same reason the wash and the ring in that test are already read as changes rather than as constants: a control is free to dress its own state and outrank the floor. ## Testing - The four touched nightly modules in full (`test_render_drafts.py`, `test_render_widgets.py`, `test_render_anchors.py`, `test_render_projection.py`): 362 passed, 1 failed — the remaining failure is #366's `lf-playground` verb, unchanged on this branch. - The everyday suite: 898 passed, 6 skipped. `pre-commit` on the changed files passes. - Bug-back on the spent-face reading: flattening `.lf-compose-submit`'s disabled rule to bare `opacity: 1` returns the failure, with the live and spent faces printed identical. - The draft repair's own bug-back is the run above: the reading it fixes is the one that timed out on `ac3342a4`, and it passes here. <details><summary>How the composer came to cover the passage below it</summary> Measured on `NOTED_PAGE` at 1200×900, after selecting `#p1` and typing into the bar. `#p2` spans `211…931`, so its centre is `x=571`. | | `.lf-fab-input` left | `elementFromPoint(571, 217)` | | --- | --- | --- | | `b03501fa`, before #347 | 580 | `P` | | `4cbef417` | 552 | `TEXTAREA.lf-fab-input` | `placeClear` bounds its bands by the viewport, the target, and controls carrying `data-lf-offer` — not by other passages — and it prefers the band nearest the target, which on this page is the one directly below `#p1`. So standing over `#p2` is placement working as stated; what changed is only how far left the bar reaches. That is left alone here. </details> --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/34069973701) --------- Co-authored-by: leaf-agent <[email protected]>
Generated interface now stays visually hidden until async page interface and geometry measurements settle, so contents maps and other widgets first appear in their final positions without blanking authored content.
This adds shared page-interface settlement and presentation signals, applies the startup policy across light and shadow DOM, and tests both startup visibility and final ToC geometry.
Optional page-interface failures now report without withholding presentation. Standalone export waits for that same boundary and removes generated grouping semantics when no native control survives.