Repository navigation
Make the layer record's format number the page protocol, at protocol 55 - #6954
Merged
Merged
Conversation
A Leaf read a `layer.json` at another record shape as no record at all. After #6900 moved the layer record from `leaf-layer/36` to `leaf-layer/53`, every page an older Leaf had initialized read as uninitialized: the hooks never renewed it, `leaf page state` said it had no layer.json, and `leaf page init` with no `--package` selected no packages. Only a newer shape had a guard (`Record.newer`), and the failure would come back at each change to the record's shape. The layer record's format number is now the page protocol: `page init` writes `leaf-layer/<protocol>`, and the record's `protocol` field is gone. `registry.storage.layer_record` returns only a record at this Leaf's format. A record at another number refuses the page, as `newer-layer` where the number is higher and as `foreign-layer`, naming the number, where it is lower; any other file reads as absent, as before. Every reader of a page's layer goes through that one reading, so none composes another Leaf's record or crashes on a field a newer shape moved. `layer.incompatible_layer` and its comparison of the `protocol` field are deleted, and the page endpoint, server reuse, `page check`, the hooks' `write_refusal` and the website's page binding refuse through the one reading. The build's existing rule for a record's `since` now holds the layer record to the protocol: its `since` is the current protocol, so its shape changes only with a bump. Dropping the field is itself such a change, so the page protocol moves from 54 to 55. Renewal is the one read across versions left. It reads only `packages` from an older Leaf's record (`registry.storage.layer_packages`), under a rule `layer-registry.md` now states: a change to the layer record's shape keeps `packages` as the page's selection, with the same meaning. The leaf-dev code that reads a page another Leaf initialized uses the same reader: the fixtures that read a page another arm prepared, so a comparison across a protocol bump still finds the page's media, the eval report, and the usage survey, which would otherwise count only pages initialized since the latest bump. `Record.read` decides by the same parse of `format` as `layer_record`. `leaf page state` now refuses a page at another protocol and names its repair, where it printed a reading with the refusal as `source.error`. Its `layer` field comes from the layer record, which this Leaf no longer reads at another format, and a reading of a log at another protocol may be wrong. The `agent_state` header and `serving-pages.md` say so. The turn-end clerk leaves such a page out of its check, since it could write nothing there. A page written before #6900 (`leaf-layer/36`, where a default page was `packages: []` with `theme: {"name": "reading", ...}`) renews keeping its `packages` but loses its theme, because #6900 changed what `packages` means, and its refusal names 36, its shape's number, as its protocol. A page initialized at protocol 54 is likewise refused as protocol 53 until it renews. Those pages are a one-time population, and AGENTS.md "Stage" rules out code for them. How it works now says what the page protocol is: the protocol number of the Leaf that last initialized a page, covering the page's log and the records Leaf keeps, and moved by the build's schema checks. Tests: an older shape's page is refused as `foreign-layer` by the hooks' check and renewed by `page init` with its packages; a newer shape's page, with `packages` moved, is refused as `newer-layer` by `page check`, `page init`, `page state` and `page vocabulary`, which leave the file alone. The newer-Leaf command test folds into the second. The page-state test now expects the refusal, and the tests that set another protocol write the format instead of the field.
leaf-agent
approved these changes
Nov 24, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 24, 2026
Main took protocol 55 for the layer record's format (#6954), so the plan event's schema change here moves the page protocol to 56.
leaf-agent
added a commit
that referenced
this pull request
Nov 25, 2026
#6954 made the layer record's format number the page protocol. Its description says `leaf page state` now refuses a page at another protocol in both directions, where before it printed a reading with the refusal under `source.error`. `test_a_command_re_vendors_its_sessions_page_an_older_leaf_vendored` still expected that reading. It also read the layer's `generation` through `layer_record`, which now refuses the older record as well. Since #6954 the test fails in the scheduled run on Linux and macOS. The journey now expects `page state` to exit non-zero and name the page protocol, as `tests/model/test_interact_layer.py::test_page_state_refuses_a_layer_this_leaf_cannot_serve` already does. Its check that reads don't renew the layer now compares `layer.json` byte for byte before and after `page state` and `page export`. The rest is unchanged: the reply refused with the re-vendor named, then the next write re-vendoring and the reply going through. This repair keeps #6954's intent, and no product code changes. The test fails on `main` at `32dc564a8` with `assert 1 == 0` at the `page state` read, and passes with this change (`uv run pytest tests/journeys/test_interact_layer.py::test_a_command_re_vendors_its_sessions_page_an_older_leaf_vendored --run-nightly`). Closes #7177 — automated triage Co-authored-by: leaf-agent <[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.
Makes the format number of a page's
layer.jsonits page protocol, so one comparison decides whether a Leaf serves, renews or refuses a page, and bumps the protocol to 55 to do it.Before this,
layer.jsoncarried two versions: the shape number in itsformatand a separateprotocolfield. A Leaf read a record at another shape as no record at all. After #6900 changed the shape, every page an older Leaf had initialized read as uninitialized: the hooks never renewed it,leaf page statesaid "has no layer.json", andleaf page initre-initialized it with no packages. Only the newer direction had a guard, a shape check of its own (Record.newer). This recurs at every change to the layer record's shape.Now the record has one number.
LAYER.sinceis the kernel's page protocol, so the build's existingsincerule refuses a layer shape change until the protocol moves.registry.storage.layer_recordrefuses any other format by its number:newer-layerabove this Leaf's,foreign-layerbelow. No reader composes from another Leaf's record, andlayer.incompatible_layerand its four call sites go. Renewal reads only thepackageskey from an older record (layer_packages), under a rule stated inlayer-registry.mdthat every shape keeps it. How it works also gains a paragraph saying what the page protocol is.Worth weighing:
leaf page statenow refuses a page at another protocol in both directions. Before, it printed a reading with the refusal undersource.error. The reading needs the layer, which another Leaf's record no longer gives.since. A page from before Make a page's theme one of the packages it lists, and remove the theme slot #6900 renews without its theme, since Make a page's theme one of the packages it lists, and remove the theme slot #6900 changed whatpackagesmeans.Requested by max-sixty; independently reviewed twice. Tests:
tests/model/test_interact_layer.pycovers an older shape (renewed, keeping its packages) and a newer shape withpackagesmoved (refused by check, init, state and vocabulary, with the file left unchanged). The focused model and process suites andpnpm run checkpass.