Repository navigation
Decide a widget's answer by three rules, and drop the facts event - #7469
Merged
Merged
Conversation
…ther tab moves them A widget's declaration now lists, under `facts`, the static functions of its class whose values the page keeps, each with the JSON Schema of its value. Each act and undo carries the values as `facts`, which replaces the top-level `answered` #7325 added. Where the state or markup moves without a gesture of the tab's own (a version, a `restated` mark, another tab's act), a tab showing the newest version works the facts out again (`host/widget-facts.js`) and posts a new bookkeeping `facts` event with the values that differ from the kept ones. Admission refuses one that changes nothing, or that names an older revision, so tabs that agree leave one event, and it wakes no one. The server keeps each widget's latest values (`obligations.widget_facts`), lapses them when a version restates the widget's decisions, reads `answered` from them, serves them per view and shows them on elements in `leaf page state`. A widget that declares `awaits` lists `"answered": {"type": "boolean"}`. Leaf's default word for `answered` stays for a class with no static. Page protocol 63. `lf-options multiple` now records on Done the options it covered and the picks among them, and answers only while Done stands on the set the group shows. A checklist given a step, or a pick restated after Done, asks again with its other picks kept; a pick the user changes after Done waits on Done again too, where before it stayed answered, since the two leave the same widget state. Tests that expected Done's empty detail, a pressed Done after its pick was refused, or `answered` on an event now expect the new shapes. The maintainer chose this design (level C) on the deck-fixes page. > _This was written by Claude Code on behalf of max-sixty_
… field requires > _This was written by Claude Code on behalf of max-sixty_
…mpare only widgets something moved A `facts` event refused as stale left the tab's dedupe holding the same facts, so on the newer version, where the page still kept the old word, the tab said nothing: a checklist given a step by one version and then rewritten by another stayed answered. The dedupe now keys on the version too. Each reading now skips a widget whose state, descriptor, version and kept value all hold their identity, so a reading costs each widget that declares facts one identity check. > _This was written by Claude Code on behalf of max-sixty_
…s word the page has moved past A version that restates an element now takes back every action resting on it together with the earlier decisions each of those had replaced at its coordinate (`InForce`), so no replaced decision comes back to decide the widget. What a user sees differently: a pick the user replaced, or an accept or reject they superseded, no longer returns when the agent restates its replacement, and the question asks again with nothing picked; a board card whose destination column is restated falls back to its markup place rather than to its previous move. This reverses #2515's rule that a note retracting only an answer's superseder gives the coordinate back to that answer; that PR gave no product reason, and SOUL.md keeps a choice effective until the user changes it. Every reader of liveness now reads `InForce`: served undo candidates read the projection's `in_force`, and `sample_events` admits the log through it. Two ways a widget's kept facts could be overridden by a stale word are closed. A gesture made on a version older than the one the widget's kept facts were said on leaves those standing (`obligations.widget_facts`), as a tab still on v1 pressing Done no longer answers a question v2 reopened. A `facts` event now names the seq of the reading it was worked out from (`through`), and admission refuses it as `stale-facts` once a gesture or another word on the widget landed after that reading, so a word sent just before a press can't land after it and reopen the question. A tab says a refused or unreached word again at its next reading. module-state.md points at lf-options' `answered` rather than copying it, and How it works says a version asks again once a tab shows it. > _This was written by Claude Code on behalf of max-sixty_
# Conflicts: # browser/runtime/host/application.js
…facts again as a gesture leaves the ledger An undo's word on a widget was read as said on the version of the action it took back, which is wrong whenever the user undoes on a newer version than the one they acted on: a version-2 undo of a pick made on version 1 lost its word to an older one, so a question could stay open or read answered against the state the undo left. The browser's undo now names the revision it was made on, as an action does, and `widget_facts` reads that revision. `reportFacts` looked at a widget only when a reading or document arrived, so a widget it skipped while a gesture of the tab's own was on its way waited for the page's next event once the gesture left the ledger. Its effect now follows the ledger too. > _This was written by Claude Code on behalf of max-sixty_
# Conflicts: # browser/runtime/state/semantic-application.js
# Conflicts: # browser/runtime/host/widget-state.js # browser/runtime/records/obligations/answer.js # browser/runtime/records/pending/dispatch.js
# Conflicts: # packages/default/widgets/lf-options.js
…ed option `statics.answered` and the commands' Done reading took every `lf-option` child as an authored option, an added one still drawn included. Right after the user undoes an `add`, the gesture's facts are worked out before Effect UI redraws, so the undone option counted as one Done never covered: the undo carried `answered: false` while the view, reading `inputs`, drew Done pressed, and no later word could answer it again. `authoredOptions` now holds the rule `inputs` applied (skip `data-lf-added`), and `shownOptions` and `inputs` both read it.
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_
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_
…ent-a767249b7e5643b4e
Three rules now decide whether a widget's question is answered (`events.md`, "Widget answers"): 1. A gesture carries its word: each act and undo carries `answered`, and the latest gesture in force decides (#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 it as a member, and restating the group itself keeps every pick. Any other decision resting on it goes, and no key falls back to a decision the user replaced (#7452, without its rule that also cut every action before a removed one at its key, which only a hand-written log reached). 3. A restating version asks again: the server reopens the question of each widget whose decisions the note reaches, and of a reached action that lands after it, until the user's next gesture. An edit that restates nothing asks nothing again. This reverts #7425's `facts` mechanism: the declaration key, the `facts` 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 covering the set shown. Page protocol 64. Rule 3 triggers on restate only. Across the state home's 458 logs, 884 versions changed an answered lf-options' markup: 574 settled it, 260 wrote the user's pick into `selected`, 34 changed wording, and about 3 added options without restating. Every note that said it asked again used `restated`. Behaviour that changes 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 stays answered; - restating an option of a `multiple` group whose Done stands asks again with Done still pressed, so answering takes two presses, as two crossing tabs can leave it; - restating an `lf-options` keeps the user's pick and asks again, where #7452 took every pick back, so `test_a_section_and_a_board_answer_one_decision` now restates the picked option to take the pick back; - a pick from a tab behind a version that restated the group stands and asks again, where #7452 never let it in.
leaf-agent
reviewed
Nov 27, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
One finding inline: restating an option that only a replaced pick rests on reopens the question.
Rule 3 now reads a note's `restated` ids and the document's containment: a note that marks a widget or an element inside it asks the widget's question again, and so does an action from an earlier version that lands after it. Before, it walked `InForce` and reopened any coordinate the note reached, so a version rewriting an option the user had moved away from reopened through the replaced pick. That case now asks again because the version marked an element of the widget, which `test_restatement.py` pins. `gesture_answers` no longer walks `InForce`, and `InForce.reaches` folds back into `restate`. The stale passages that said a restated widget takes back every decision now say a restated group keeps its picks and asks again: the `stamp_retractions` header, the `restated` property, the kernel's hint for a pick, the board composition and `package-data.md`. `$restated` tells an author to mark the picked option where a single choice should be chosen afresh, since a kept pick takes two presses to confirm. `test_each_view_offers_only_the_gestures_it_paints` now expects a pick on a restated group to stay undoable in the later view, since the version keeps it.
max-sixty
marked this pull request as ready for review
November 28, 2026 00:03
leaf-agent
approved these changes
Nov 28, 2026
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.
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"):answered, worked out by its class in the gesture's task, and the latest gesture in force decides. This is Let a widget say when its question is answered, so a press moves the deck on at once #7325's shape.restatedtakes it out of the user's decisions resting on it. A pick set loses that option and keeps the rest, and restating thelf-optionsitself 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 Let a restated element leave the rest of the decision in force #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.What goes: the
factsdeclaration key and bookkeeping event, withthrough, thestale-factsandunchanged-factsrefusals,told_facts, the rule that a gesture on an older version leaves kept facts standing, undo'srevision,host/widget-facts.ts, the served andpage statefacts, and lf-options' "Done covers the set shown".InForce's up-front mode andaction_retractedgo 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 intoselected, 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 usedrestated. Reopening on any markup change would have reopened about 300 answers the agent had just recorded.The case table
Each row is a test in
tests/model/test_restatement.py.What a user sees differently from #7425
multiplegroup 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 amultiplegroup with Done standing.$restatedtells 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: removesfacts.