Skip to content

Repair the staged-control test #903 overwrote, and state when deferred widgets have landed - #913

Merged
max-sixty merged 1 commit into
mainfrom
fix/page-arrived-903
Sep 22, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/page-arrived-903

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

#903 merged at 57b00cd without the revision asked for on its thread, and left two things behind. This is both of them.

test_staged_widget_controls_name_the_presses_their_owners_make now contradicts itself on main. main had repaired that case in e291a95 by driving the upgraded wa-comparison handle; #903 still carried the older rewrite of the same case under its previous name, which holds **/vendor/webawesome.esm.js from outside the page so the fallback checkbox never gets hidden. Git combined the rename with the body silently — no conflict, and GitHub reported the branch mergeable — so main now holds the bundle and then waits for the component that bundle defines. It cannot appear, and the case fails on its first read of it. This restores 49952af's version of tests/test_render_anchors.py and tests/render_cases_navigation.py, which is e291a95's test and the NATIVE_CONTROL_PAGE fixture it reaches through. No other part of #903 is touched.

A page can now say when it has stopped arriving. Presentation says the reader may interact; it does not say the page has finished. lf-shot puts Web Awesome's comparison after presentation on purpose (#892), and the interaction gallery's contained documents arrive later still — each moves boxes when it lands. Nothing outside the page could see that, so three tests named a widget of their own fixture by hand and waited for it: two on [data-interaction-frame][data-interaction-ready], and #903 added a third, lf-shot wa-comparison, to stop test_a_settled_page_with_a_standing_reaction_stops_rendering_its_margin counting the comparison's two margin layouts as the render cycle it denies. A widget that wants the reader to have the page first now runs that work through afterPresentation(() => …), which is the wait and the declaration in one call, so there is no way to defer without the page counting it. pageArrived answers whether anything is still outstanding, and open_page waits through it. All three hand-written waits are gone, and the next widget to defer settles every fixture without a fourth.

Verification

tests/test_render_anchors.py, tests/test_render_gate.py, tests/test_render_margin.py and tests/test_render_startup.py ran whole under --run-nightly: 425 passed, covering the restored staged-control case and all three tests whose hand-written waits this removes. The everyday suite is 1,213 passed, npm run test:runtime is 33 passed, pre-commit passes on the changed files, and the shot and Web Awesome cases in tests/test_render_widgets.py and tests/test_render_commands.py pass.

Six cases fail in this CI sandbox on a clean main checkout as well, and were confirmed against one: five everyday cases that need AF_UNIX or a umask the sandbox does not keep, and test_a_shot_still_flips_with_every_script_removed, whose export subprocess cannot launch a browser here.

Why a page-level fact rather than a fourth wait, and what this leaves

What the settled-page case was measuring. Moving the shot's two frames into wa-comparison lays the margin out twice a few milliseconds apart, at whatever moment the module happens to resolve, and the test allows one layout across thirty frames. Measured on #903's branch: without any wait it went red on 2 of 12 local runs, with both layouts landing 6–13ms apart inside the first 700ms of the window; holding **/vendor/webawesome.esm.js from outside the page instead, changing nothing else, was 8 of 8 with no layouts counted at all — which is what identified the upgrade rather than the two-second heartbeat the test's docstring had assumed. On CI it was red in 35650845868 and 35683511692 and green in 35670525383 and 35677461023.

The doubled layout itself is not fixed here. One document change producing two margin layouts on adjacent frames is a doubled render in the thing that test exists to bound; whether the upgrade should lay out once is #892's question. That is unchanged by this PR, and easier to reach now that the page states when the upgrade has landed.

What the new fact does not change. afterPresentation does not move work onto the presentation path — the arrival runs exactly when it ran before, and test_a_shot_compares_its_frames_with_a_direct_divider still holds the bundle's startTime at or after data-lf-presented. What changed is only that the page can be asked whether the arrival has landed.

The other readers of the same fact. leaf version check's probes stop at currentPresented (skills/leaf/scripts/leaf/render-checks/runtime.js), and scripts/example-previews.py, scripts/record-demo.py and scripts/verify_site.py shoot on data-lf-presented alone, so each can still read or photograph a page whose deferred widget has not landed. That is the same missing wait at other readers, now one stage away from each; a gate change alters what a public command waits for and a preview change rewrites generated output, so neither is folded in here. The gate's own pageSettled is a different fact — no finite animation still running — which is why the new one is pageArrived.

…d widgets have landed

#903 merged without the revision asked for on its thread. Git combined
e291a95's rename of the staged-control test with the branch's older
rewrite of the same case silently, so `main` now holds the Web Awesome
bundle from outside the page and then drives the component that bundle
defines. This restores 49952af's `tests/test_render_anchors.py` and
`tests/render_cases_navigation.py`.

It also replaces that branch's `lf-shot wa-comparison` wait, and the two
older waits on `[data-interaction-frame][data-interaction-ready]`, with a
page-level fact. A widget that keeps work off the presentation path runs
it through `afterPresentation`, which is the wait and the declaration in
one call; `pageArrived` answers whether any such arrival is outstanding,
and `open_page` waits through it.
@max-sixty
max-sixty merged commit 5c35533 into main Sep 22, 2026
4 checks passed
@max-sixty
max-sixty deleted the fix/page-arrived-903 branch September 22, 2026 08:29
max-sixty added a commit that referenced this pull request Sep 27, 2026
… reader (#1250)

Four Python readers waited on different subsets of the runtime's
readiness facts.
The suite's `BOTH_STAMPS` required upgrade, an applied stamp,
presentation, the
coordinator's current reading, settled rendering and deferred arrivals
(#913 and
#1145 added the last two, but only there). The render gate's
`wait_for_presentation` waited on data version, log coverage and current
presentation, with neither arrival nor rendering.
`scripts/example-previews.py`
and `record-demo.py` checked the three body stamps alone, and
`record-demo.py`'s
stills waited on upgrade and a count of `action` lines in
`events.jsonl`, with no
presentation, where the gate counts the reading's served coverage
(#1235).

`pageReadiness` in `runtime/presentation.js` now names the first fact a
page has
yet to state, in the order a page reaches them: `upgraded`, then `data`
and `log`
against an `/api/state` reading the caller holds, then `presented`,
`arrived` and
`rendering`. It returns null once the page is ready. The entry script
exposes it
as `lfReadiness`, replacing `lfCurrentPresentationReady` and
`lfPageArrived`;
`lfRenderingSettled` stays for waits after input.
`leaf.render_checks.wait_until_ready(page, state=None)`
is the one Python wait. It raises `PageNotReady` naming the stage, and
every
reader uses it: the suite (`open_page`, `navigate`, `restarting`, the
arrivals
case and each direct wait), the gate's scheme pass and page-code run,
the catalog
stills, and the demo recording. The stills now wait against the server's
reading,
so they count served coverage.

Behaviour that moved:

- `leaf version check` now also waits for deferred arrivals and settled
rendering before it reads a page, and reports either stage by name. A
failure
  at either still keeps the projection findings, as `pageSettled` did.
- The gate requires the applied stamp even when the reading covers no
records;
  before, it skipped the log stage then.
- The page-code run reads `/api/state` straight after navigation, not
after the
  upgrade stamp, since the readiness wait includes upgrade.
- The catalog stills and demo frames are shot after deferred arrivals
land and
  rendering settles, not at first presentation.
- A timed-out wait names its stage in the runtime's own words, and
reports a page
  that cannot answer within 5s as `answering`.

The render-check probes `initiallyPresented`, `currentPresented`,
`dataApplied`
and `logApplied` are gone, along with `validationPresentationReady` and
`pageArrived`. The tests that read them now assert the readiness stage,
or the
coordinator's `applicationPresented` directly. A new gate test holds a
page's
first state answer and checks that the wait fails at `log` with that
wording,
then passes once the answer lands. The scheme pass keeps its `upgraded`
probe as
a barrier before the visual-provider check, which must run before
presentation
can hang on an invalid inventory.

`scripts/verify_site.py` and the MCP app still wait on
`data-lf-presented` alone.
That is the interaction boundary a host shows the frame at, and it stays
their
fact.


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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <[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