Skip to content

Survey smalls: drawing bounds from the registry, gesture faults to the agent, one browser for page check - #2447

Merged
max-sixty merged 11 commits into
mainfrom
agent-adc0405bdcfd6a0c4
Oct 12, 2026
Merged

max-sixty merged 11 commits into
mainfrom
agent-adc0405bdcfd6a0c4

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Nine small cleanups from the code-quality survey, each its own commit.

  • Drawing bounds come from the registry. build:browser writes runtime/composing/drawing-schema.js from registry.json's comment drawing schema, and drawing-record.js reads every bound from it instead of hand-writing them; check:browser refuses a stale copy. The runtime test now says the page also accepts a draft's shape (optional box, at), and covers at.
  • Gesture settlement faults reach the agent. A failed pending release, a throwing optimistic announcement or key paint, a refused event's state that fails to apply, and a throwing settlement now report through reportCarried/reportPageError instead of the console alone. createDelivery loses its reportApplicationError callback, and application.js imports the reporter instead of taking it from leaf.js.
  • page check --render serves the candidate once. render_gate.command.browser_check runs the page-code run and then the render reading in one browser on one preview server. Output is unchanged, except that with no browser the one line names both gates.
  • Dev page posts read the server's answer. PageClient.post returns the state /api/event answers with, so the review scenario reads state twice per comment instead of three times; PageClient.state_url replaces the journey's own token regex.
  • LeafRunner types the runner prepare_page takes.
  • rect.js intersections replace hand-written ones in key-badge placement, read tracking's frame band and navigation's reading step.
  • Address and delivery facts move from storage.js to context.js (LIVE_ROOT, PAGE_ROOT, DELIVERY, WEBSITE_DELIVERY, layerRoot, SHARE_ROOT, shareUrl); storage.js keeps the stores and PAGE_SCOPE.
  • one_user, live_leaf and other_leaf move to render_harness.py, so conftest no longer registers two render_cases_* modules as plugins.
  • developing-leaf defers probe's recording flags to --help, and dev/AGENTS.md's "Journeys" points at the skill for what the journey checks.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 10 commits October 11, 2026 15:45
The runtime's drawing validator hand-wrote every bound admission's schema states
(stroke and point counts, the coordinate limit, `says` length, frame-path depth,
tag length and pattern, step index and sibling ranges, schemes). `build:browser`
now writes `runtime/composing/drawing-schema.js` from registry.json's comment
drawing, and `drawing-record.js` reads its bounds from it, so a bound changes in
the registry alone and `check:browser` refuses a stale copy. The hand validator
and its per-object memo stay, since a draft's shape differs on purpose.

The runtime test's claim now says the page accepts a draft's shape too, and
covers a drawing carrying `at`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Four faults in the application's handling of a gesture went to the console alone:
a pending release that failed, an optimistic announcement or key paint that threw,
state in a refused event's answer that failed to apply, and a settlement that
threw. Each leaves the page out of step with its log, which layer-client.js's
rule says the agent hears of, so they now report through `reportCarried` (or
`reportPageError` for the optimistic paint, which no producer reported first).
The settlement fault is reported by delivery.js itself, so `createDelivery` no
longer takes a `reportApplicationError` callback, and application.js imports the
reporter rather than taking it from leaf.js.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`page check --render` on a page with code of its own served the candidate twice
and launched two browsers: one for the page-code run and one for the render
reading. `render_gate.command.browser_check` now serves it once and runs both in
one browser, the page-code run first; page code that fails still ends the check
before the render reading, and each gate prints what it printed before. Where no
browser launches, the one line names both gates ("page code and render check:
not run, ...").

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`PageClient.post` discarded the `/api/event` answer, so the review scenario read
`/api/state` a third time per comment to find the admitted id. `post` now returns
the state the server answers with, and the scenario reads the id from it: two
state reads per comment instead of three. `PageClient.state_url` names the keyed
state address, and the journey's browser session reads it rather than rebuilding
it from its own token regex.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`prepare_page`, `import_referenced_media` and the data seeding took their leaf
runner as a bare `Callable`. `LeafRunner` now states the shape all three dev
runners (arms, preview, site) already have: positional command arguments and
`input_text`, with the return unread. No behavior changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Three placements still intersected rectangles by hand beside `rect.js`'s
`intersect`: key-badge placement's `clearBox` (the window below the banner) and
its painted-part aims, read tracking's frame band, and navigation's reading step
(a vertical cut). Each now calls `intersect`, and the frame band's emptiness test
is `hasArea`. No behavior changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…text.js

storage.js's header described working-state storage, but the module also held
which address this document is and how a server delivered it (`LIVE_ROOT`,
`PAGE_ROOT`, `DELIVERY`, `WEBSITE_DELIVERY`, `layerRoot`, `SHARE_ROOT`,
`shareUrl`). They now live in context.js beside `pageUrl` and the export payload
they are read with, and its header names them; storage.js keeps the stores and
`PAGE_SCOPE` that scopes them. The keyboard dispatcher's import closure no longer
reaches storage.js. No behavior changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`one_user`, `live_leaf` and `other_leaf` were defined in render_cases_navigation.py
and render_cases_layout.py, so conftest registered both case modules as plugins
only to reach them. They now live in render_harness.py, where tests/AGENTS.md
says browser fixtures go, and pytest_plugins lists only the two fixture modules.
The case modules stay modules tests import from. No test behavior changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…rney

developing-leaf's recording guidance restated what `leaf-dev probe --help`
already says: what the trace and video hold, `--journey`, `--actions`, keeping the
page open for video, the trace-server command, and why `--checkpoint-images`
hides the caret. It now names `--record` and `--journey` and points at `--help`,
keeping when to record, how to review the recording, and where to link it.

dev/AGENTS.md's "Journeys" opened by restating what the journey checks, which the
skill's "Run the agent journey" owns; it now points there and keeps what
journey.py owns and where its evidence goes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The drawing validator still couples independent registry fields. validSize checks both box and viewport against DRAWING_COORDINATE_LIMIT, which now comes from the first stroke coordinate; validFrame also checks frame.root using the path step's tag schema. If the registry changes a size maximum or the root pattern independently, the generated schema changes but the browser can still accept a drawing the event door rejects (or discard one it accepts). Read each field's own bounds from drawingSchema, while keeping the draft-only at rule separate, so the registry is the actual owner of each admitted limit.

The validator checked box and viewport against the first stroke coordinate's
limit and a frame's root against the path step's tag rule, so a registry change
to one of those fields alone would leave the page and admission disagreeing.
Each field now reads its own declaration: points, box and viewport as tuples of
their own bounds, root and step tags by their own length and pattern, step index
and sibling count by theirs, and says by its minimum and maximum length. The
draft-only `at` keeps the stroke coordinates' bound.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit f760877 into main Oct 12, 2026
3 checks passed
@max-sixty
max-sixty deleted the agent-adc0405bdcfd6a0c4 branch October 12, 2026 00:05
leaf-agent added a commit that referenced this pull request Oct 12, 2026
The interaction gallery slow-state test read `LIVE_ROOT` from
`storage.js` after #2447 moved that page-address fact to `context.js`.
The import returned `undefined`, so the test failed after all four
contained pages had reported ready. The test now reads the fact from its
owner and keeps its readiness, storage isolation, and pagehide
assertions.

The exact test failed on current main with `assert None is True` and
passed after this change (`uv run pytest
'tests/test_site.py::test_interaction_gallery_waits_for_slow_contained_page_state'
-n0 -q`). The failure also appears in [main's red CI
run](https://github.com/max-sixty/leaf/actions/runs/38187553140). This
repairs the stale test introduced by #2447; it does not change gallery
behavior.

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 12, 2026
Forty-two browser tests opened the whole feature gallery, a thousand
elements and ten live samples, only for one passage, thread, suggestion
or widget it happens to hold, and spent most of their time waiting for
it to present. They now serve a small page with just that shape, and
each protects the same behavior. Two are folded into tests whose
journeys already covered them. Locally the moved tests take about 210 s
of call time against about 1,150 s on the gallery; in CI run
[38171553443](https://github.com/max-sixty/leaf/actions/runs/38171553443)
they cost 2,748 s.

The commits go by area: margin (`d973d0e5a`), the interaction runner,
which now gets the gallery's `#bg-interactions` section alone
(`8069e4d41`, `8dd02d6e6`), startup (`5c015b24f`), navigation, threads
and widgets (`b644c2566`), and drawing, reactions, drafts, share and
notices (`aa49ace29`). Fixtures several modules share live in
`tests/render_cases_interaction.py`. Each commit message names the page
each test now uses.

Faster pages exposed what the gallery's slow frames had hidden:

- **A runtime fix** (`464799691`, `margin-layout.js` and
`margin-projection.js`). When a layout pass folded a pin whose open face
showed its options inline, such as a suggestion's Accept and Reject at
390px, it seated the toggle by the row's pre-fold
`data-lf-options-open`. The toggle landed about 30px left and jumped
back a frame later without input. The fold now states whether the folded
pin shows its options (`fold.open()`), and the pass seats by that.
- **Timing the gallery had hidden.** Share ignores a press for a second
after a copy, and a paused animation can still be pending right after
Pause; the share and interaction-replay tests now wait for each
(`aa49ace29`, `e8389b1f0`).
- **Coverage the moves would have dropped**, each restored and checked
by planting the fault it guards: Send returning focus to More when a
gesture step displaced Comment (`2848db662`), a thread row with a newer
non-question reply after an open question (`093cefe70`), and a thread
card tall enough to clip (`d280081e9`).

`test_site.py`'s `waits_for_slow_contained_page_state`, which had failed
since #2447, now reads `LIVE_ROOT` from `runtime/context.js`, where
#2447 moved it.

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

---------

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