Repository navigation
Acknowledge a fixture's seed with the arm's own Leaf - #3958
Merged
Merged
Conversation
`leaf-dev stills` failed every seeded state on a pull request that bumps the page protocol: `_acknowledge_seed` wrote the seed's receipt with the checkout's Leaf, which refuses a page another arm vendored at a different protocol. The receipt now runs under the runtime the fixture was read for. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 25, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 27, 2026
Main's #3958 runs a fixture's seed receipt with the fixture's own runtime, since another Leaf refuses a page vendored at a different protocol. Seed admission now runs there too: ADMIT_SEED admits each batch of seed events and, after the last stamp, writes the receipt, in one subprocess of the fixture's runtime; a refusal raises RuntimeError carrying the door's finding. The seed logs are main's, rewritten by the same rules this branch applied by hand (drop the derived meaning and attention, give a thread title its thread's agent session). Main moved the seeded-fragment test to the journeys tier (#3926); its docstring takes this branch's edit there, and the new seed test stays in the model tier. Co-Authored-By: Claude Opus 5.5 <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 27, 2026
`prepare_page` used to append an example's `<stem>.jsonl` to `events.jsonl` as raw text, after the first stamp. Every page `leaf-dev preview`, `leaf-dev site` and the suite's `serve` build from an example skipped `event_contracts.append_admitted`, so its log could hold events no writer could send, in a shape real pages never have. Now `_seed_log` admits each seed event through `append_admitted` once the page has stamped the revision the event names. An event a later version answers lands after that version's stamp, in the order a real page records it. Admission runs with the fixture's own runtime (`ADMIT_SEED`, one `uv run --project <runtime>` per stamp that has events to admit), as the seed's receipt already did since #3958, because another Leaf refuses a page vendored at a different protocol; the same subprocess writes the receipt after the last stamp. A refusal raises `RuntimeError` carrying the door's finding and the seed event's id, from the build that lays the seed in. ## What admission found The seed logs are main's as of the merge, rewritten by the rules below; applying the same rewrite to the logs this branch started from reproduces its hand edits byte for byte. I routed every seed (5 examples, 3 regression fixtures, 104 events) through `append_admitted` in a scratch copy before changing anything (`.tmp/measure_seed.py`, not committed): - **Derived fields copied in by hand.** 9 actions carried a hand-written `meaning` and 2 comment/reply lines in `feature-gallery` carried `attention`. Admission writes both fields itself and refuses them in a command. Each stale `meaning` differed from what admission now derives: it was missing `minLength: 1` on option values, and for the board move, `minLength` on `value`/`unit` and the rank `pattern`. The seeds now leave both fields out. - **Unvoiced thread titles.** 8 `thread_title` lines in the two developer galleries had no `session`, which the record contract requires. Each now carries the session of its thread's agent replies where they have one (`01a0bfe4-…`), else `gallery-agent`, the session the feature gallery's pickup already names. Nothing reads a title's session, so nothing on screen changes. - **Revisions not yet stamped.** 3 `review-a-plan` events and the last reply in `feature-gallery` name revision 2 or 3 but were written right after the first stamp. Admission refused them there ("reply revision must be one of [1]"), so seeds now wait for their revision. - With those fixed, admission keeps every seed's ids, order and fields. It adds `attention` to every event and the current `meaning` to actions, as on every real page. Thread ids and their order are unchanged, so the gallery's `t` walks and pinned ids still hold. I diffed each fixture's served state (`full_state`) between the old raw append and the new path, ignoring timestamps and note ids. The only differences are the added `attention` flags, the refreshed `meaning` schemas, the thread-title sessions, and the later seq of the events that now follow their revision's stamp (which also makes the page's latest agent voice Codex instead of the preparing session on `review-a-plan`). Queues, obligations and thread state are identical. ## The corpus `leaf-dev corpus` ran `sample_events` over the raw seed files, which only worked because the seeds were in stored form: closures read each action's `meaning`. `build_events` now builds the source's page in a temporary directory, takes the closures from its admitted log, and writes them without the derived fields, so the corpus's own seed goes through the door as commands too. Today the only source this builds is the feature gallery. It adds about 2 s to each `corpus.generate` (0.33 s before, 2.4 s after for `build_events`, measured in-process), which corpus previews pay on each source edit. Max may prefer another trade-off here. ## Tests - New `test_a_seed_no_writer_could_send_stops_the_page_it_seeds`: a seed carrying a derived `attention` is refused by `prepare_page` (`RuntimeError` naming `attention`), and the same comment without it is admitted with `attention` written. It fails on the old `page_fixtures.py` (`DID NOT RAISE EventRefused`). - `test_page_fixtures_pass_check` for every seeded fixture and the corpus (9 passed). These now admit every seed, so a bad seed fails here. - `tests/model/test_interact_product.py`, `tests/model/test_product_page.py`, `tests/model/interact_contract/test_layer_contract.py`, `test_revendoring.py`, `dev/tests/model/test_interact_preview.py`, `dev/tests/model/test_interact_product.py` (162 passed). - Browser: `test_a_shipped_log_replays_its_example_state`, `test_the_layer_traps_no_margin_in_the_panel_it_draws`, `tests/browser/test_render_sample_delivery.py`, `tests/browser/threads/test_rewrites.py`, the feature gallery's core journeys, the thread-panel gallery, the chrome-key axe check, the gallery's stamped embed, the corpus whole-page rules, and the nested primary reader (46 passed). Not run: the `test_site.py` builds, `leaf-dev pins` (whose generated seed is plain comments), and the nightly files outside that selection. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
leaf-dev stillscouldn't compare base and candidate on a pull request that bumps the page protocol, such as #3927 (24 to 25): every state built on a seeded example (review-a-plan, ship-review, log-retention) failed on the arm whose protocol differs from the checkout's.page_fixtures._acknowledge_seedwrote the seed's receipt in-process with the checkout's Leaf, whose admission refuses a page vendored at another protocol:The fix
A
PageFixturenow keeps the runtime and environmentread_fixturewas given, which already chose each arm's package producers and data contracts._acknowledge_seedruns the receipt with that runtime's own Python (uv run --no-dev --project <runtime>, asbin/leafdoes), so the arm that vendored the page admits its receipt, in its own event shape. A fixture read for the checkout, as the render harness's are, now runs the same few lines in a subprocess of the checkout's project: one more subprocess beside thepage init,stampandopencalls preparation already makes, and only for a seeded fixture.leaf-dev previewreads fixtures for a selected runtime the same way, so its paired previews across a bump get the same fix.Checks
uv run leaf-dev stills origin/image-difference-out-of-core --state plan, run from a checkout at protocol 24: the base arm failed with the refusal above before the change, and both arms now capture ("1 of 1 states unchanged").test_a_fixture_acknowledges_its_seed_with_the_runtime_it_was_read_forbuilds a seeded example with an extracted payload whose protocol is one ahead and checks that the log ends with the seed's receipt. It fails on main withEventRefused.test_fixture_captures_use_the_selected_runtime_producer(both parametrizations),test_page_fixture_renders[review-a-plan]and[ship-review], and pre-commit on the changed files pass.