Skip to content

Derive recorded payloads from effect declarations - #1971

Merged
max-sixty merged 3 commits into
mainfrom
codex/prose-review
Oct 7, 2026
Merged

max-sixty merged 3 commits into
mainfrom
codex/prose-review

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Recorded verbs currently repeat their payload schema and map payload fields back to the effect they declare. Derive that schema from the effect instead: body, attribute, and scalar-value records take {value}, position records take {unit, value, rank}, and agent updates also require text.

This cuts over the Python admission and projection owners, browser producers and readers, CLI, package declarations, authoring contracts, examples, and evaluation fixtures together. Scalar records inherit the destination property's constraints. Shared applicability checks reject invalid effects through both action and report admission, including duplicate or foreign members in attribute sets.

Recorded verbs no longer accept auxiliary payload fields or independent input refinements. Unrecorded commands retain custom schemas for interactions that need them.

Validation: 104 affected browser cases passed before integration; after integrating main, the retained options controls, report presentation holds, both admission writers, reading fixture, and CLI help passed their focused checks. Detached and frozen widget presentation tests also pass through the fixed scalar payload, and the generated registry reference matches its source. All 228 runtime tests, 81 browser model/build tests, pre-commit checks, and committed bundle verification passed. An authoring comparison used one Codex sample per arm: the candidate used the new contract successfully; the baseline used old payload aliases.

This was written by Codex on behalf of max-sixty

# Conflicts:
#	build/browser/generated/browser-runtime.js.map
#	build/browser/generated/browser-runtime.manifest.json
#	docs/how-it-works.html
#	skills/leaf/assets/vendor/browser-runtime.js
#	skills/leaf/packages/default/widgets/lf-options.js
leaf-agent
leaf-agent previously approved these changes Oct 7, 2026

@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.

CI found two unfinished parts of the payload cutover, so this head should not merge yet.

  • The lf-local fixture in tests/test_render_application_boundary.py still supplies detail: {"choice": "chosen"} at two action records. Its three controller cases are refused because value is required; the frozen-thread case times out after /api/state returns 500. Those fixture records need detail.value to match the new declaration.
  • The changed $keys.x-state text has not been regenerated into docs/registry.html. test_the_key_reference_is_generated_from_the_registry fails; leaf-dev keydocs updates that generated reference.

These are mechanical repairs. I can push them if useful. Failing test job.

@leaf-agent
leaf-agent dismissed their stale review October 7, 2026 07:40

CI failed: two stale action payload fixtures and the generated registry reference

@max-sixty
max-sixty merged commit 8ca27a7 into main Oct 7, 2026
6 checks passed
@max-sixty
max-sixty deleted the codex/prose-review branch October 7, 2026 08:19
leaf-agent added a commit that referenced this pull request Oct 7, 2026
The draft edit browser journeys now check the recorded `value` payload
required by the effect-derived event contract from #1971. Their user
behavior is unchanged: an empty draft survives reload, and a refused
edit retains the revised words through Retry. The [main CI
run](https://github.com/max-sixty/leaf/actions/runs/37596375818) failed
because both journeys still expected the old `text` field even though
the admitted events contained the correct `value` field.

Both named tests failed before this change and pass afterward (`uv run
pytest
tests/test_render_drafts.py::test_an_empty_draft_survives_reload_and_blocks_a_version_switch
tests/test_render_drafts.py::test_a_refused_draft_keeps_text_and_offers_retry_without_a_details_pane
-q -n0`).

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 10, 2026
After #1971 changed how a pick is recorded, a page whose log held
earlier picks (`detail.options`, no `meaning.state`) crashed `leaf page
state` and `leaf status` with `KeyError: 'value'` in `projection.py`'s
`folded_value`. That broke the state-home rule in `AGENTS.md`: a record
lacking fields this version expects is ignored where it is loaded, and
never takes a session down.

#2020 already fixed it: `state_projection` now leaves out any event
whose recorded state operation doesn't match the current widget's, and
an event with none recorded never matches. The page that crashed
(`message-edit-survey`, six old-format picks) reads cleanly on `main`,
as do copies of 24 other pages on this machine whose logs hold
old-format picks. Nine more stop earlier, on an older `data.json` shape,
before reaching the fold. Nothing held the behaviour, though, so this
adds a test.

The test appends the old shape after a current pick on the same widget,
so the old one would win if it were folded, and checks that `leaf page
state` exits 0 and reports only the current pick. With the gate removed,
as #1971 had it, the test fails.

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