Skip to content

Give developer tooling's readiness wait, served state, test helpers and panel selectors one home each - #5297

Merged
max-sixty merged 10 commits into
mainfrom
agent-a6ee085a9bf85c3a5
Nov 4, 2026
Merged

max-sixty merged 10 commits into
mainfrom
agent-a6ee085a9bf85c3a5

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Part of the 2026-11-03 sweep for duplicate implementations (#5291 changes how review and Tend look for them). Developer tooling and test helpers had more than one copy each of the readiness wait, the served-state answer, a lint-rule run, the junit reader, an App Server turn, in-process leaf and the floating panel's selectors. Each now has one home in leaf_dev or tests/, and every caller uses it.

  • Readiness. verify_site.await_presentation, which the release pass, the local Worker pass and the website journey call after every page load, waits through render_checks.wait_until_ready(through="presented"), the readiness wait every other reader outside a page uses, keeping its own error with the browser errors it collected. bench-latency's revision fact asks lfReadiness(null, "presented"), as verify_site_browser.js already did. window.__leafStartup.milestones had no other reader and is gone.
  • Served state in runtime tests. tests/served.mjs gains servedState(changes), a whole /api/state answer for a page with an empty log, made by model_folds.served_answer, which runs the route's own PageStateService.page_state over a page source yielding the inputs served_reading folds. A test names only the fields its case changes, and naming a field the answer lacks throws. queue-walk, state-feed, undo-waits and framework-application built their own answers by hand, and those had drifted from the server's (a stale obligations object, items, an activity with phase, no others); all four now start from servedState.
  • Lint-rule runs. tests/runtime/lint-rule.mjs runs one of eslint.config.mjs's own rules over acorn's tree, giving every node its parent and supplying sourceCode.getText, which only some of the five hand-rolled walkers did. The four *-rule.test.mjs files and the semantic store ownership test, which moves beside them from build/browser/architecture.test.mjs, use it.
  • Junit reports. leaf_dev.suite.junit_cases reads a report into each test's node id and its cases, merging a failed call's teardown case; suite.read_junit (flake, bugback) and suite_profile.read_cases read through it.
  • App Server turns. widget_format_eval.infer drives its turn through codex_task.Task instead of its own connect, handshake and request ids, and still fails after 300 s without a message.
  • In-process leaf. page_fixtures.leaf_in_process is the in-process LeafRunner for prepare_page, replacing the copies in commands/corpus.py, tests/render_harness.py, tests/model/test_interact_product.py and two in dev/tests/model/test_interact_preview.py.
  • The floating panel's open view. panel_view(name), the selector of the panel's view that stands open and isn't on its way out, moves from tests/render_harness.py to leaf_dev.browser with PANEL and PANEL_THREAD. The 26 literal view selectors in leaf_dev (browser.py's Threads helpers, states.py, record_demo.py, verify_site.py, bench_latency.py, and thread_journey.py's THREAD_VIEW copy) and the panel's host literals now go through them.
  • Eval models. evals/ui-review-detection/provider.mjs no longer restates eval_ui_review.MODELS as an allowlist, since only that command writes the provider's configuration.

Behavior changes:

  • The site verifier and the website journey waited for the data-lf-presented stamp, which is set once, stays set while presentation reopens, and is also set when a page presents its offline fallback without applying a server answer. They now also wait for an applied answer and a settled presentation, so a reload whose state read never answers fails at the presentation wait, naming the log stage, instead of later with "stands on revision 1". A page that never presents is described by its readiness stage ("the runtime never started"). In the journey's post-turn reload, followedRevisionMs counts from the first applied answer.
  • bench-latency's revision check read the stamp a page set at its first load, so after that load it passed on every frame; it now waits for the revision.
  • About 20 of the leaf_dev panel selectors lacked :not([data-lf-leaving]), so a driver waiting for a thread or the queue could match a view on its way out. They now wait for the view that stands, as the tests' panel_view always did.
  • In suite-profile, a collection error's file is its module's path instead of .py.

Tests: in dev/tests/process/test_website_server.py the fake deployed page answers the readiness wait and can stall a reload at a stage; the offline-reload case expects the failure at presentation, naming the log stage. dev/tests/browser/test_website_server.py's broken-page case expects the stage words. framework-application's "non-event activity" case changes the served activity's kind instead of replacing it with an invented shape. No other test changes what it asserts.

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

`verify_site.await_presentation`, which the release pass, the local Worker
pass and the website journey call after every page load, now waits through
`render_checks.wait_until_ready(through="presented")`, the readiness wait
every other reader outside a page uses. It keeps its own error, which adds
the browser errors the verifier collected to the stage the page stopped at.
Before, it waited for the `data-lf-presented` stamp on body. That stamp is
set once and stays set while presentation reopens, and it is also set when
a page presents its offline fallback without ever applying a server answer.

Behaviour changes:

- The verifier and the journey now also wait for the page to have applied a
  server answer (readiness's `log` stage) and for the presentation
  coordinator to be settled. A reload whose state read never answers now
  fails at the presentation wait, naming the `log` stage, instead of passing
  it and failing later at the revision wait with "stands on revision 1".
- A page that never presents is described by its readiness stage ("the
  runtime never started") rather than by the startup milestones it reached.
  `window.__leafStartup.milestones` had no other reader and is gone.
- In the journey's post-turn reload, `followedRevisionMs` now counts from the
  first applied answer. For a page that first presented offline, the time
  until a later answer arrived moves into the presentation wait.
- `bench-latency`'s `revision` fact asks `lfReadiness(null, "presented")`, as
  `verify_site_browser.js`'s `revisionAtLeast` already did. It used to read
  the presented stamp, which a page set at its first load, so after that
  load the check passed on every frame.

Tests: in `dev/tests/process/test_website_server.py` the fake deployed page
answers the readiness wait instead of the stamp locator, and can stall a
reload at a stage. The offline-reload case now expects the failure at
presentation, naming the `log` stage, and still protects that the message
tells a never-answered read apart from a stale answer, which keeps quoting
the page's status. `dev/tests/browser/test_website_server.py`'s
broken-page case expects the stage words in place of "no startup milestone".
…each

Served state: `tests/served.mjs` gains `servedState(changes)`, a whole
`/api/state` answer for a page with an empty log. `served_records.py` makes
it with the new `model_folds.served_answer`, which runs the route's own
`PageStateService.page_state` over a page source that yields the inputs
`served_reading` folds, with no other live pages and a news token naming the
fold's log, so the layer, neighbours and reading token come from the code
that adds them to a real answer. The answer is held to the answer schema.

A test names only the fields its case changes. `servedState` changes a record
the empty answer sends with fields field by field, and naming a field that
record lacks throws. Any other value is replaced: a list, a record the answer
sends empty (a map, such as `files`), or a null. Replacing a record or a list
with a value of another kind throws. What a replaced list or map holds, and
what replaces a null, are not checked.

`queue-walk`, `state-feed`, `undo-waits` and `framework-application` built
their own answers by hand, and those copies had drifted from the server's: a
`{all, user, unanswered}` obligations object inside the thread and document
views, `items`, an activity with `phase`, a null `published_at`, an `active`
of only `{revision, version}`, and no `others`, while each omitted different
fields the server does send. All four now start from `servedState`;
`framework-application`'s `state` helper passes other top-level changes, such
as `active`, through it. `queue-walk`'s to-do comes from a new answer folded
through `served_answer`, "user to-do", rather than a hand-written queue row,
which had carried a `title` the server's row lacks.

Lint rules: `tests/runtime/lint-rule.mjs` runs one of `eslint.config.mjs`'s
own rules over acorn's tree, giving every node its `parent` and supplying
`sourceCode.getText`, which only some of the five hand-rolled walkers did.
The four `*-rule.test.mjs` files use it, and so does the semantic store
ownership test, which moves from `build/browser/architecture.test.mjs` to
`tests/runtime/semantic-store-ownership-rule.test.mjs` beside the others; it
still runs under `pnpm run check`.

No behaviour changes. The tests protect what they did;
`framework-application`'s "non-event activity" case now changes the served
activity's `kind`, a field the server sends, instead of replacing the
activity with an invented shape.
… leaf one home each

- `leaf-dev eval --base` is `arms.base_option()`, its base is
  `arms.base_ref`, its head arm is labelled `head`, and its run name is built
  with `arms.describe`, like the seven other A/B commands. Eval keeps
  building each arm with `build_arm` as a payload-only copy, the head's too,
  because a child agent must not read another arm's files and `--from` must
  serve the original runtime later. The check that a REF names a commit moves
  from eval into `base_ref`, so every A/B command now refuses a misplaced
  argument that a bare `--base` swallowed as its REF, with "put arguments
  before --base", instead of failing in `git archive`. Behaviour change:
  provider columns read `claude-code/head`, not `claude-code/candidate`, and
  the run's description reads "base <commit> vs head <commit>".
  `dev/tests/test_evals.py` and `evals/README.md` use the new label.
- `leaf_dev.suite.junit_cases` reads a junit report into each test's node id
  and its cases, merging a failed call's second, teardown case.
  `suite.read_junit` (flake, bugback) and `suite_profile.read_cases` both
  read through it; `suite_profile`'s own node ids and `GROUP_SUFFIX` are
  gone. The xdist group suffix is stripped with `suite`'s `@[^@\]]+$`: a
  parametrized id always ends in `]`, so excluding `]` is what keeps an `@`
  inside the brackets, and also excluding `[`, as `suite_profile` did, only
  failed to strip a group name containing `[`. On a synthetic report both
  readers give what they gave before, except that a collection error's file
  in `suite-profile` is now its module's path instead of `.py`.
- `widget_format_eval.infer` drives its App Server turn through
  `codex_task.Task`, keeping its own notification recorder as `on_message`,
  instead of its own connect, handshake and request ids. Its turn still
  fails after 300 s without a message. Checked against a fake App Server;
  no Codex login was spent.
- `page_fixtures.leaf_in_process` is the in-process `LeafRunner` for
  `prepare_page`, replacing the copies in `commands/corpus.py`,
  `tests/render_harness.py`, `tests/model/test_interact_product.py` (which
  `tests/journeys/test_interact_product.py` imported) and two in
  `dev/tests/model/test_interact_preview.py`.
- `evals/ui-review-detection/provider.mjs` no longer restates
  `eval_ui_review.MODELS` as an allowlist: only that command writes the
  provider's configuration, choosing the model from `MODELS`.
# Conflicts:
#	dev/leaf_dev/arms.py
#	dev/leaf_dev/commands/eval.py
# Conflicts:
#	dev/leaf_dev/widget_format_eval.py
#	dev/tests/model/test_interact_preview.py
#	tests/journeys/test_interact_product.py
#	tests/model_folds.py
#	tests/runtime/framework-application.test.mjs
#	tests/runtime/queue-walk.test.mjs
#	tests/runtime/state-feed.test.mjs
#	tests/runtime/undo-waits.test.mjs
`panel_view(name)`, the selector of the panel's view that stands open and is
not on its way out, moves from `tests/render_harness.py` to
`leaf_dev.browser`, with `PANEL` and `PANEL_THREAD` and the comment that says
what the panel's attributes mean. `render_harness` imports `PANEL` and
`panel_view`, which it uses itself, so tests that import them from it are
unchanged; the 41 test modules that imported `PANEL_THREAD` from it import it
from `leaf_dev.browser`.

Every literal panel-view selector in `leaf_dev` now goes through it:
`browser.py`'s own Threads helpers (`open_threads`, `show_resolved`,
`go_to_threads`), `states.py`, `record_demo.py`, `verify_site.py`,
`bench_latency.py`, and `thread_journey.py`, whose `THREAD_VIEW` was a copy of
`PANEL_THREAD` and is gone. Selectors inside JavaScript now take the selector
as the evaluated function's argument.

Behaviour change: the leaf_dev selectors that named a view without
`:not([data-lf-leaving])` no longer match a view that is closing, so a driver
waiting for a thread or the queue to show waits for the view that stands, as
the tests' `panel_view` always did. Tests: none change what they assert.
The rest of leaf_dev's `.lf-floating-panel` literals now read `PANEL`:
`threads_tab` in `browser.py`, the panel surfaces and refusal watch in
`thread_journey.py`, the open-view check in `commands/journey.py`, the three
stills states whose region is the panel in `states.py`, and `panel_paint`'s
wait for the panel's motion, which takes the selectors as the evaluated
function's argument. `verify_site_browser.js` keeps its own literal, since a
JavaScript file cannot import the constant. No behaviour changes.
leaf-agent
leaf-agent previously approved these changes Nov 4, 2026
# Conflicts:
#	dev/leaf_dev/commands/bench_latency.py
# Conflicts:
#	tests/browser/test_render_anchors.py
leaf-agent
leaf-agent previously approved these changes Nov 4, 2026
# Conflicts:
#	dev/leaf_dev/commands/record_demo.py
#	tests/model_folds.py
@max-sixty
max-sixty merged commit 34851e4 into main Nov 4, 2026
4 checks passed
@max-sixty
max-sixty deleted the agent-a6ee085a9bf85c3a5 branch November 4, 2026 07:46
max-sixty added a commit that referenced this pull request Nov 4, 2026
…sting and suite checkout one home each (#5328)

The last four developer-tool rows from the 2026-11-03 sweep for
duplicate implementations (#5291, #5297). Each capability below was
written more than once in `dev/leaf_dev/`; each now has one home that
every caller uses.

- **An interactive Claude Code session.** `leaf-dev claude-code-session`
repeated the `claude-code` journey's setup: the throwaway home whose
`.claude.json` says onboarding is done and trusts the cwd, the
environment over it, the `claude` command line and the isolation's
layout. `journey_claude_code.claude_code_environment` writes the home
and returns the environment, `ClaudeCode` builds the command line from
the isolation, a model and optional settings, and `Isolation.under` lays
out the state home, cwd and page. Neither command behaves differently.
- **A live copy of a saved page.** The arrangement eval's judge and
captures and the authoring eval's interaction probe each copied a saved
page into a temporary directory and served it plain or through the arm's
Leaf, deciding which in their own words. `arms.live_copies` does it once
and yields a `ServedPage` carrying its arm and state home, so
`restored_page` reads state through `arms.read_page_state`;
`arrangement_eval.is_leaf` is the one test for whether a page is Leaf or
plain HTML.
- **Posting a user move.** Every caller of `arms.PageClient.post` read
the served state for the active revision, posted, then searched the
answer for its event by retry key, and `post` read the state again for
the layer. `post` now does it from one read: it sends a revision only on
the kinds whose record has one in the kernel registry's `$events.kinds`
(comment, reply, seen, action, error), takes the revision a move names
or else the active one, and returns the event the server's answer names,
which is exact for retries and for the page's own `error`. The usability
eval makes each round on one reading, withdraws a previous move by the
event `post` returned, and loses `arms.inputs_received` and its
retry-key bookkeeping.
- **A checkout the suite can run in.** `flake` took a snapshot of the
working tree inline, and `bugback` ran a detached `git worktree` at HEAD
instead. `suite.snapshot` and `suite.checkout` (a clone with each
`node_modules` linked in) are now shared by both. bugback still builds
its reverted tree itself rather than taking `arms.choose_arms`' base,
since that base is the whole tree at the merge base, tests included,
while the reverted run needs the working tree's tests over the merge
base's code; its header says so.

Behavior changes:

- `leaf-dev bugback` runs the working tree as it stands, uncommitted and
untracked files included, where it asked for a commit first, and it can
now run tests that read `node_modules`, such as the Codex App Server
tests. It refuses an empty change in seconds, before snapshotting, and
prints its verdicts before removing its checkout.
- Snapshot clones are made with `maintenance.auto=false` and
`core.fsmonitor=false`. Under git 2.56 the snapshot's commit started
background maintenance that wrote a commit graph into the clone during
its removal, which failed with "Directory not empty" in four of four
tries, and in none of four with these settings.
- Each posted move makes one state read rather than two. Every move of a
usability round, an error's text included, describes and names one
reading's revision. `undoes: previous` works when the previous move has
its own retry key or is an error, where the log search raised
`StopIteration`. Posting an undeclared kind gets the server's
`unknown-kind` refusal.
- The authoring eval's interaction probe serves its plain-HTML
conditions plain, where only `adaptive` was; no case probes an `html`
page today. A served copy keeps its saved directory's name rather than
always `page`.

Tests: `dev/tests/process/test_flake.py`; the Codex App Server test
`test_app_server_delivery_id_reads_only_canonical_delivery_inputs`
inside a bugback checkout; bugback end to end, catching an uncommitted
`src/leaf` edit with an untracked test; `post` against a served page for
every kind, retries and an undeclared kind; and the journey and website
`post` tests. The `claude-code` journey wasn't run, since it spends a
login.

> _This was written by Claude Code on behalf of max-sixty_
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