Skip to content

Keep decisions an earlier Leaf recorded standing across a re-vendor - #2431

Merged
max-sixty merged 1 commit into
mainfrom
fix-earlier-recorded-operation
Oct 11, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix-earlier-recorded-operation

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A user's lf-options picks, and the Question they answered, stopped standing
after leaf page init moved a page onto a newer layer. AGENTS.md says a later
version keeps a user decision unless it explicitly retracts what the decision
rests on.

Cause. Each admitted action records its operation's definition in
meaning.state, and state_projection folds an event only while
same_state_operation finds the recorded definition equal to the one the
current widget declares. That comparison required every key but detail to
match exactly. #2329 renamed the recorded update flag to report, so every
action admitted before it, on every page, carried a key the current
definition lacked and silently stopped standing, with its Question reopened.
The re-vendor only mattered because it let the new Python read the old log.

Fix.

  • The operation is now the fields state_definition writes, detail aside,
    each required and equal. A field an earlier Leaf recorded beside them no
    longer retracts a decision; a missing or different field still does.
    Python (registry/contract.py) and the browser (registry-contract.js)
    hold the same rule.
  • The domain check that decides whether to re-validate a payload compares
    detail only, in state_projection and in the browser's pending-gesture
    check, so an undo of an older decision also draws at once.
  • The recorded definition no longer carries report: its only effect is the
    required text that detail already records. The event admission schema
    in registry.json, the generated event-contract.d.ts, the committed
    example and fixture logs, and docs/event-log.html follow.

Tests. test_a_decision_stands_when_an_earlier_leaf_recorded_its_operation
rewrites an admitted pick into the pre-#2329 form and checks that it stands
and keeps its Question answered; it fails with the old comparison. Node tests
cover sameStateOperation and a pending undo of such a decision. The
affected page, copied to scratch, reads its revision-7 picks and answered
Question again.

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

A user's lf-options picks, and the Question they answered, stopped standing
after `leaf page init` moved a page onto a newer layer. AGENTS.md says a later
version keeps a user decision unless it explicitly retracts what the decision
rests on.

**Cause.** Each admitted action records its operation's definition in
`meaning.state`, and `state_projection` folds an event only while
`same_state_operation` finds the recorded definition equal to the one the
current widget declares. That comparison required every key but `detail` to
match exactly. #2329 renamed the recorded `update` flag to `report`, so every
action admitted before it, on every page, carried a key the current
definition lacked and silently stopped standing, with its Question reopened.
The re-vendor only mattered because it let the new Python read the old log.

**Fix.**
- The operation is now the fields `state_definition` writes, `detail` aside,
  each required and equal. A field an earlier Leaf recorded beside them no
  longer retracts a decision; a missing or different field still does.
  Python (`registry/contract.py`) and the browser (`registry-contract.js`)
  hold the same rule.
- The domain check that decides whether to re-validate a payload compares
  `detail` only, in `state_projection` and in the browser's pending-gesture
  check, so an undo of an older decision also draws at once.
- The recorded definition no longer carries `report`: its only effect is the
  required `text` that `detail` already records. The event admission schema
  in `registry.json`, the generated `event-contract.d.ts`, the committed
  example and fixture logs, and `docs/event-log.html` follow.

**Tests.** `test_a_decision_stands_when_an_earlier_leaf_recorded_its_operation`
rewrites an admitted pick into the pre-#2329 form and checks that it stands
and keeps its Question answered; it fails with the old comparison. Node tests
cover `sameStateOperation` and a pending undo of such a decision. The
affected page, copied to scratch, reads its revision-7 picks and answered
Question again.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 67811f0 into main Oct 11, 2026
6 checks passed
@max-sixty
max-sixty deleted the fix-earlier-recorded-operation branch October 11, 2026 21:02
max-sixty added a commit that referenced this pull request Oct 12, 2026
…port: true` (#2645)

The x-state flag that makes an agent verb's reports carry non-empty
`detail.text` was called `report: true`. Every verb that can declare it
already writes reports (`writer: "agent"`), so the name said nothing;
`text: true` names what it requires.

The rename covers the three Python readers (`registry/contract.py`'s
detail schema, the report feed in `projection.py`, the excerpt in
`history.py`), `schema.py`'s `STATE_SCHEMA`, the `ActionSpec` type, the
references and `$` docs, `docs/registry.html` (regenerated with
`leaf-dev keydocs`), the two registries that declared it (the
command-hub example's `lf-atlas-worker` and the test fixture
`lf-test-worker`), the corpus, and the `recorded-effect-payloads` eval
rubric.

Behavior change: `page check` now refuses a registry that declares
`report: true` ("'report' was unexpected"). No shipped package declared
it. The event log is unchanged, because since #2431 `state_definition`
records neither name in `meaning.state`, so this needs no protocol bump;
an older page whose own registry still says `report: true` is drift,
fixed by re-vendoring or renaming the key.

Two seeded test events carried a stale `"report": False` in
`meaning.state` that admission no longer writes; it is removed.

Touching `tests/journeys/test_render_gate.py` selected it, and it was
already failing on main: since #2634, the options under an unsettled ask
are joined cells with no transition, so its check that the arrival guard
releases package transitions read `all` on `#wait-day`. It now reads the
suggestion fold's `padding` transition instead.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 20, 2026
An audit of Leaf's boundary data structures found five places where code
and records disagreed. This change fixes each one.

**Reads of records only an older Leaf wrote are deleted** (root
AGENTS.md, "Stage"):

- `data.read_source` reads a value file as a publication. A file holding
a bare value now fails like any other malformed file instead of reading
as that source's error.
- `registry.storage.layer_metadata` requires `$layer.server`. A layer
without it is refused as `layer-identity`, whose message names the
re-vendor.
- `thread.is_answer` no longer excludes progress addressed to an input.
Only logs from before #1727 held that, and the kernel schema refuses an
ephemeral reply with `responds`.
- `events.build_threads` reads a reply's thread directly. Admission
keeps every reply's parent in force, so the branch that skipped a reply
to a withdrawn message read only logs from before that rule.

The tests that built those old records are deleted. A data test that
rewrites a value file now writes an invalid value inside a publication.

**`GET /api/user-view` is deleted**, along with the page sources'
`user_views()` and the leaf.page snapshot's saved copy of the route. The
browser's POST stays. The feature gallery's "Read observed views" button
was the route's one caller. Its section now says that the agent reads
the observations under `user_views` in `leaf page state`, and the corpus
is regenerated.

**`$state` and `$awaits` now document every field their schemas admit.**
`$state` gains `detail`, `writer` and `text`, and `$awaits` gains
`retired`, `reply` and `encloses`, each with a description. The check
that held `$keys` to `EXTENSION_SCHEMA` now holds all three facts to
their schemas (`registry.layer.DOCUMENTED_KEYS`: `EXTENSION_SCHEMA`,
`VERB_SCHEMA`, `AWAITS_SCHEMA`), and the `keys-documentation` finding
names the fact.
`test_the_field_docs_hold_to_the_fields_their_schema_admits` covers it.

**`event-batches.md` now describes the envelope `delivery.py` writes**:
`was` and `suggestion` on an event that rewrites a user's message, the
`correction` that a refused answer's retry carries, and the paged
reading (`part`, `parts`, `text`, `next`, and `acknowledge` on the last
part).

**The state home now stays owner-only.** `state.state_home` replaces
both `state_home_path` and `machine.state_home`, so every path into the
state home goes through it. It creates the home with mode 0700 and
resets an existing home to 0700. `server.host_key` keeps `access.json`
at 0600 even when the file already existed. Both write the mode only
when it differs, so a sandboxed command that can only read still
resolves its paths. `test_the_state_home_and_its_key_stay_owner_only`
covers both, and fails with either reset removed.

Two older-Leaf reads remain on purpose. `server.read_service` and the
stop path in `hosting` handle a `service.json` that another installed
Leaf wrote, which can happen while that Leaf's server is still running.
`registry.contract.same_state_operation` keeps a user's decision through
a re-vendor (#2431).

> _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