Skip to content

Let a restated element leave the rest of the decision in force - #7452

Closed
max-sixty wants to merge 2 commits into
mainfrom
agent-a1eccca0506f037e7
Closed

max-sixty wants to merge 2 commits into
mainfrom
agent-a1eccca0506f037e7

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

A prototype for the maintainer to decide on. A version that marks an element restated now reads each decision resting on it without that element, instead of taking the decision out of force and letting its key fall back to the decision the user had replaced.

The user's acts Version restates Before Now
single choice: a, then b b a picked again, question asks nothing picked, question asks
multiple: a; then a, b b a a
multiple: a; then a, b; then b b a nothing picked
card to Later, then to Next Next card in Later card where the markup has it
accept, then reject resting on a paragraph the paragraph accepted, thread closed again undecided, thread open

The last two rows are reachable only through a log written by hand: page check refuses restated on an lf-column, and admission rests a suggestion's decision on the suggestion alone. In use, the change reaches lf-options picks, including a board card that shows one.

How

events.InForce reads each action a note reaches through restated_reading. An attribute set loses the rewritten members and keeps standing under the action's id, without its answer or facts. Any other decision no longer applies, and every action before it at its key goes too. A decision made on an older version that lands after the note is read the same way, except that one which no longer applies never comes into force and takes nothing out. Every reader of what stands takes that one walk:

  • the projection fold now walks undos and notes where they fall, so InForce's second mode (floors and withdrawals given up front) and the withdrawn/floors arguments threaded to state_projection, page_reading and thread_markup_reading are gone;
  • the served undo list and sample_events read the walk, and action_retracted is gone;
  • a served entry's value is the record as it stands, and the browser's fold (state/projection/model.ts) draws it rather than the event's detail.

#2515's restored-answer filing was never separate code: memberships name the answers of the winner before and after each change, so they follow the new fold with no edit.

told_facts stays

Its reopen-only rule still guards two cases this change doesn't reach, both pinned in test_a_tabs_word_reopens_a_question_but_never_answers_it:

  • Done (answer) rests on its widget alone, so a version that takes back a pick made after Done leaves the Done standing on the picks before it, and lf-options works out "answered".
  • lf-options compares Done with the markup's selected where no pick stands, so a version that writes the pick Done covered into the markup reads as answered.

Letting it go needs Done to rest on the options it names, which takes a declaration for detail fields that name members, and an answer for the second case.

What a user sees differently

  • A rewritten option leaves the group's other picks, and never brings back a pick the user replaced or unpicked.
  • In the single-choice row, Undo takes back the pick of b and brings a back.
  • A pick's ids reach the widget sorted, as the server lists a set, rather than in click order.

Size

added removed
Python code (11 modules; 6 change logic, 5 drop a dead argument) 117 82
Python docstrings and comments 99 58
Browser fold, model.ts 8 2
Docs: events.md, the $restated string, package-data.md, the lf-options header, a schema description 31 9
Tests, code (Python and the runtime fixture) 238 39
Tests, docstrings and comments 60 15

uv run leaf-dev interface --base: no name added or removed. No protocol bump: no logged record changes, only how the serving Leaf folds one.

Checks

tests/model (3679 passed), the undo and restatement tests in tests/process/test_interact_server.py, pnpm run test:runtime (1219 passed), node build/browser/build.mjs --check, pre-commit, and by node id the 31 browser tests that touch restated, options, suggestions, boards and undo (all passed once test_an_answer_carrying_an_older_pick_cannot_undo_a_newer_one stopped pinning click order). A served page built with each case drew the three lf-options rows as the table says.

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

A version that marks an element `restated` now reads each decision resting on it
without that element, instead of taking the decision out of force and letting its key
fall back to the decision the user had replaced.

| The user's acts                          | Version restates | Before          | Now                     |
| ---------------------------------------- | ---------------- | --------------- | ----------------------- |
| single choice: a, then b                 | b                | a picked again  | nothing picked          |
| multiple: a; then a, b                   | b                | a               | a                       |
| multiple: a; then a, b; then b           | b                | a               | nothing picked          |
| card to Later, then to Next              | Next             | card in Later   | card where markup has it |
| accept, then reject resting on a paragraph | the paragraph  | accepted, c1 closed again | undecided, c1 open |

The last two rows are reachable only through a log written by hand: `page check`
refuses `restated` on an `lf-column`, and admission rests a suggestion's decision on
the suggestion alone.

`events.InForce` reads each action a note reaches through `restated_reading`: an
`attribute` set without the rewritten members, which keeps the action's id and drops
its `answer` and `facts`, or nothing, and then every action before it at its key goes
too. Every reader of what stands now takes that walk: the projection fold walks undos
and notes where they fall, so InForce's second mode (floors and withdrawals given up
front) and the `withdrawn`/`floors` arguments threaded to it are gone, and the served
undo list and `sample_events` read the walk rather than `action_retracted`, which is
gone. A served entry's `value` is the record as it stands, and the browser's fold
draws it rather than the event's detail.

`obligations.told_facts` is gone: a tab's `facts` word may now answer a question as
well as reopen it. It was there so a replaced pick that won again could not answer;
no replaced pick wins again now. The two cases that waited on a second press of Done
now converge once a tab speaks: a version that takes out the one option Done didn't
cover, and two tabs whose acts cross.

What a user sees differently:

- A rewritten option leaves the group's other picks, and never brings back a pick the
  user replaced or unpicked.
- In the single-choice row, Undo takes back the pick of b and brings a back, as it
  would have before the version.
- A pick's ids reach a widget in sorted order, as the server lists a set, rather than
  in the order the user clicked; the set is the same.

Tests: `tests/model/test_restatement.py` holds the five rows through admission and
the served reading; `test_obligations.py` shows both Done cases converging; the
#2515 membership and sample tests now expect no fallback; a runtime case holds the
browser to the served `value`.

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

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

One defect on the stale-tab path through InForce.admit (inline). Otherwise the walk agrees with the PR's table: undo of the narrowed single-choice pick brings a back because the pick of b stands as an empty set rather than being cut. tests/model/test_restatement.py and tests/model/test_obligations.py pass locally at this head.

Comment thread src/leaf/log/events.py Resolved
Two review findings on the first commit:

- A decision made on an older version that lands after the note restating what it
  rests on took out every decision at its key, including the user's pick on the new
  version. It now never comes into force and takes out nothing, as before this
  branch; a set still stands without the rewritten members.
- `obligations.told_facts` still guards two cases the fold change doesn't reach, so it
  stays. Done rests on its widget alone, so a version that takes back a pick made
  after Done leaves the Done standing on the picks before it; and lf-options compares
  Done with the markup's `selected` where no pick stands. A tab works out `answered`
  in both, and only the reopen-only rule keeps the question asking.

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

Copy link
Copy Markdown
Owner Author

Superseded by #7469, which carries this branch's two commits, without the rule that cut every action before a removed one at its key, together with the three-rule model that replaces #7425's facts.

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

@max-sixty max-sixty closed this Nov 27, 2026
max-sixty added a commit that referenced this pull request Nov 28, 2026
)

Three rules now decide whether a widget's question is answered, and what
the user's decisions on it come to when a version restates something
(`events.md`, "Widget answers"):

1. **A gesture carries its word.** Each act and undo carries the
widget's `answered`, worked out by its class in the gesture's task, and
the latest gesture in force decides. This is #7325's shape.
2. **A rewrite takes back only itself.** A version marking an element
`restated` takes it out of the user's decisions resting on it. A pick
set loses that option and keeps the rest, and restating the `lf-options`
itself keeps every pick. Any other decision resting on it goes, such as
a draft's words or a Done, and no key falls back to a decision the user
replaced. This is #7452, which this PR replaces, minus its rule that
also took out the decisions before a removed one, which only a
hand-written log reached.
3. **A restating version asks again.** A note marking a widget or an
element inside it reopens the widget's question until the user's next
gesture on it, read from the version alone. A version that edits markup
without restating asks nothing again.

What goes: the `facts` declaration key and bookkeeping event, with
`through`, the `stale-facts` and `unchanged-facts` refusals,
`told_facts`, the rule that a gesture on an older version leaves kept
facts standing, undo's `revision`, `host/widget-facts.ts`, the served
and `page state` facts, and lf-options' "Done covers the set shown".
`InForce`'s up-front mode and `action_retracted` go too, as in #7452.
Page protocol 64.

## Why restate only

Across the state home's 458 page logs, 884 versions changed the markup
of an answered `lf-options`. 574 settled it, 260 wrote the user's pick
into `selected`, and 34 changed wording or a label. Only about 3 added
options without restating and might have meant to ask again. Every
version whose note says it asks again used `restated`. Reopening on any
markup change would have reopened about 300 answers the agent had just
recorded.

## The case table

| The user's acts | The version | Result |
| --- | --- | --- |
| single choice: a, then b | restates b | nothing picked, asks again |
| single choice: a, then b | restates a | b picked, asks again |
| multiple: a, a+b, Done | restates b | a picked, asks again |
| multiple: a, a+b, then untick a | restates b | nothing picked, asks
again |
| multiple: Done, then a pick changes | — | stays answered |
| checklist answered | adds a step, restates nothing | stays answered |
| checklist answered | adds a step, restates the group | every pick
kept, Done gone, asks again |
| two tabs: B picks a and presses Done; A, behind, picks a last | — |
A's word stands: asks again, Done still pressed in B |

Each row is a test in `tests/model/test_restatement.py`.

## What a user sees differently from #7425

- A checklist given a step stays answered unless the version restates
the group, which asks again and keeps every pick.
- A pick changed after Done keeps the question answered.
- Restating an option of a `multiple` group whose Done stands asks again
while Done still shows pressed, so answering takes two presses, as with
the two crossing tabs. No log in the state home has restated an option
of a `multiple` group with Done standing.
- A restated single choice keeps its pick, which takes two presses to
confirm, so `$restated` tells authors to mark the picked option where
the user should choose afresh.

## Size

Against the merge base: Python +274 −428, browser TypeScript +79 −293
and its compiled JavaScript +67 −250, package JavaScript +26 −88,
registries and schema +23 −99, tests +680 −1104, docs +136 −185.

`uv run leaf-dev interface --base`: Declaration keys: removes `facts`.

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