Skip to content

Let a widget say when its question is answered, so a press moves the deck on at once - #7325

Merged
max-sixty merged 8 commits into
mainfrom
choice-walk-fixes
Nov 27, 2026
Merged

max-sixty merged 8 commits into
mainfrom
choice-walk-fixes

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

A widget that asks now says itself whether its question is answered, and a press that answers it moves the question off On Me, and a deck to its next card, in the press's own task instead of after the server's reading. Each act and undo of such a widget carries the widget's word as answered: its class's static answered(state, element), or, without one, whether the user's acts in force hold a state at its awaits.value verb. Only the user's acts count, never a value the markup holds. Admission requires the word on every act and undo of a widget that asks, and refuses it elsewhere. The server stores the word and reads it back rather than deciding again, so the registry's awaits.answered rule and its four forms go, with their schema, checks and evaluation. lf-options implements answered from the check its Done button already made. The page protocol moves to 61 for the new field.

Worth weighing: an answer written only into the markup no longer answers, so a version retires such a question with awaits.retired. A version that restates any of a widget's decisions asks again until the user's next gesture, so a version adding a step to a checklist can't reopen the ask while keeping the other steps' decisions. Root AGENTS.md's "Responsiveness" now counts a widget's own answer among what the act alone decides. Two tabs acting at once, and whose move a reopened question is before the reading arrives, are left for the maintainer.

The maintainer approved this on the deck-fixes page. In a Firefox probe of examples/catch-up.html with the event POST held for 1.5 s, the next card came up 40 ms into the press; on main it waited for the POST. Checked with the model and process tests, pnpm run test:runtime, pnpm run check, pre-commit, and the two edited browser tests by node id.

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

…s the deck on at once

A press that answers a question now takes it off On Me, and moves a deck to its next
card, in the press's own task, before the server has read it. On leaf.page that saves
a visitor the server's whole round trip per answer (12 s on a first answer while its
container starts, about 1 s after). In a Firefox probe of examples/catch-up.html with
the event POST held at the wire for 1.5 s, the next card came up 40 ms into the press,
while the POST was still held; on main it came up 26 ms after the POST was let through.

Whether a widget's obligation is answered is now the widget's own word. Its class may
define `static answered(state, element)`; without one, the obligation is answered while
the verb `awaits.value` names holds a state. After each action of a widget that asks,
and each undo of one, the runtime reads that word from the state the gesture leaves,
sends it on the event as `answered`, and the publisher draws the obligation answered or
open from it until the server's reading takes over. The server stores the word and
reads it back (`obligations.gesture_answers`): the newest word among the widget's
actions in force and the undos of them, an undo's only while an action stands, so a
version that restates the decision asks again. Admission refuses `answered` on a
gesture of a widget that asks nothing. `lf-options` implements `answered` from the
check its Done button already made. The action and undo records gain the field, so the
page protocol moves to 61. Root AGENTS.md's "Responsiveness" now counts a widget's own
answer among the results the act alone decides; the maintainer approved the rewrite
with the proposal on the deck-fixes page.

Removed: the registry's `awaits.answered` rule and its four forms (`{}`/`when`,
`detail`, `every`, `empty`), their schema, registry checks and finding codes, and their
evaluation in obligations.py. The tests they took with them protected those forms'
registry refusals (an `every` on a position verb, a part-scoped verb without `empty`,
an unknown answering verb, a detail value its verb can't hold) and the server's
reading of a checklist and a queue by rule; the checklist's behaviour is now covered by
the widget's word on each gesture. Two behaviours change: an answer written only into
the markup no longer answers (a version retires such a question with
`awaits.retired`), and a version that adds a step to a checklist no longer reopens it by
itself (the agent marks the decision `restated`). A pick changed after Done now carries
the answer's provenance where it had none.

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

Some user actions are written from Python rather than sent by the browser, and those writers still leave out answered. So the questions they answer now stay on On Me, even though the fixture says the user answered them. tests/interact_support.py and tests/served_records.py were updated, but these weren't:

  • dev/leaf_dev/usability_eval.py: build_plan_resume admits choose on first-region, a single-choice lf-options in evals/usability/fixtures/rollout.html. Its docstring says "the user's first-region choice in", but the page now shows that question still waiting on the user. The resume fixture's choose on rollout has the same gap. An eval agent then reads a page that contradicts the scenario it is scored on.
  • dev/leaf_dev/commands/bench.py: pick() seeds choose actions on the o{g} asks with no word. The seeded obligations stay open, so the bench no longer measures a page where the picks have answered them.

The narrow fix is "answered": True on each of these admits.

The underlying gap is that admission now refuses answered on a widget that doesn't ask (answered-unasked), but it still admits an action on a widget that does ask when the action carries no word. That action silently answers nothing, and the obligation is something the user relies on. Root AGENTS.md, "Leaf's role", asks for a check in exactly that case. Requiring the word on actions and undos of asking widgets would have made each of these fixtures fail loudly. That check would need widgetAnswered to return a boolean whenever the widget asks. Today it returns undefined when the descriptor is missing.

…again on any restatement

Review findings on the `answered` change, folded in.

A gesture of a widget that asks now must carry its word: admission refuses an action
or an undo of a widget whose tag declares `awaits` when it leaves `answered` out
(`answered-missing`), whether the browser or a command wrote it, as it already refused
the word on a widget that asks nothing. An act that left the word out answered nothing
however the user acted, with nothing to say so. The runtime always says: an undo finds
the widget of the action it takes back wherever this tab holds it, and
`widgetAnswered` returns a boolean for every widget that asks. Every writer of
actions and undos in dev/, tests/, examples/ and evals/ now sends the word, among them
`usability_eval.py`'s resume and plan fixtures and `bench.py`'s picks.

Markup answers nothing, decided in one place: lf-options' `static answered` and the
default rule (`holdsState`) read only the user's acts in force, never a value the
authored capture holds, so the browser and the server read the same word. A
markup-only pick no longer makes an `add` answer a question. The gallery's stove
question, which the markup alone answered, is `settled`; the instructions that put an
answer given elsewhere into the markup now retire the question instead.

A version that restates what any of a widget's actions rests on asks again until a
later gesture's word, whichever member it names (`gesture_answers`), which replaces the
rule that an undo's word stood only while an action did. package-data.md now states
the cost: a version that adds a step can't reopen the ask while keeping the other
steps' decisions.

A class's `answered` that throws is reported as the widget's failure and the gesture
goes with the default rule's word, so it is never stranded. `widgetAnswered` shares the
class and markup lookup with `answerWords` (`widgetStatic`) and never lets the default
rule speak for a class that says. The publisher's `answerWithdrawn` goes, since a
pending undo's word now says whether the answer stands. Stale prose in the registry,
the docs, root AGENTS.md and obligations.py is corrected, and `answered` is declared on
`CustomElementConstructor`.

Tests: the restatement of a step decided before the last one, the missing word at the
door, and fast-tier tests of `widgetAnswered`, `holdsState` and lf-options' `answered`,
markup-only picks and a multiple choice without Done included. The pending-undo
publisher test now expects the undo's word to reopen the answer at once.
…iling widget's question open

The reading of a widget's word took a version note's retraction from a hand-made index
of the actions resting on each id, tested against the final fold. A view of an earlier
revision then read a later version's note as retracting the picks it holds: with picks
on revisions 1 and 2 and a revision-3 note restating the group, revision 1's view
showed the question open. `gesture_answers` now walks the log with `InForce`, the
fold's reading of survival, bounded to the reading's revision, and a note reopens a
question only where it moves a coordinate's winner. The copy of the retraction rule
is gone.

A widget whose `answered` throws now says its question is open, so the failure leaves
the question on On Me instead of the default rule closing it.

The feature gallery's stove question is open again in its markup, its pick logged with
its word, so the board demo's section no longer collapses. `authoring-on-me.md` says to
retire a question by removing its widget or setting its `awaits.retired` attribute,
since marking it `restated` asks it again.

The browser and journey tests that append an act on an asking widget through the
command door now send its word; `test_authored_page_paints_but_durable_controls_wait_for_first_replay`
was refused for leaving it out.
…m, and hand the gallery's stove pick to the agent as already picked up
leaf-agent
leaf-agent previously approved these changes Nov 27, 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.

This approves the PR: the push requires answered on every act and undo of a widget that asks, and it fixes the bench and usability fixtures. One wording fix is inline.

Comment thread AGENTS.md Resolved
…question, and give Responsiveness's reopened-question rule a sentence of its own
@max-sixty
max-sixty merged commit 1021cb9 into main Nov 27, 2026
7 checks passed
@max-sixty
max-sixty deleted the choice-walk-fixes branch November 27, 2026 01:06
max-sixty added a commit that referenced this pull request Nov 27, 2026
…ts pause records can't stall the test (#7333)

The playground drafts journey held every `api/event` POST to catch "Use
these settings". When the playground's one-second pause recorded the
field edit after the route armed but before `expect_request` listened,
the route held that edit instead, so the choice queued behind it and the
test timed out after 120 s. This made the test fail about 2 runs in 30
under load, on main as on #7325. The test now holds only the choice and
lets the edit through, which is what its `holding(…, "the query
configuration")` says it holds. That also closes a second race, where
the released choice could reach the route again before `unroute`.

Found while checking whether #7325 caused the flake. Forcing the pause
into that window failed the old test on main and on #7325 alike, and the
new test passes with the pause forced before the route, after it, or not
at all. Run here by node id.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 27, 2026
… journey post

Main now requires every act and undo of a widget that asks to carry the
widget's word on whether its question is answered (#7325). The picks this
branch's tests and the journey's `answered-twice` step post carried none,
so admission refused them. Each pick now says it answers, and each undo
says what the pick it leaves standing says: answered where an earlier pick
comes back, open where it takes back the only one.
leaf-agent added a commit that referenced this pull request Nov 27, 2026
…ress to answer at once (#7350)

This fixes the 22 browser tests that #7325 left red on `main` and
changes no product code. #7325 made a widget that asks say whether its
question is answered (`answered` on each act and undo) and stopped
markup alone from answering. These tests still followed the old rule,
and since `tests/browser` runs only on pushes to `main`, #7325's own CI
never ran them. Each fix follows #7325's intent, so no behavior it
introduced is given back.

- **Answers written in markup.** Some fixtures answered a question only
with `selected` on an option: `OBLIGATIONS_PAGE`, the picked group in
the commenting test and the side-tabs page. They now log the user's pick
through `append_command` instead, the way admission takes it.
`OBLIGATIONS_PAGE` gets its pick from a new `serve_obligations` helper,
and all of its callers use the helper, so the page always holds four
open obligations and one answered one. Logging the pick also hands the
agent an update, so the commenting test now looks for the comment's row
on On Agent instead of counting every row there.
- **Posted events without `answered`.** The draft edit now sends
`answered: true`. The async-body widget doesn't declare `awaits`, so its
edit still sends nothing. The playground's `tune` sends `answered:
false`, matching how #7325's own `test_on_panel` edit treats a tune.
- **Tests of the old wait.** Three tests asserted that a press leaves
its question open until the server's reading arrives, which is the wait
#7325 removed (root `AGENTS.md`, "Responsiveness"). They now check that,
while the event is held, the count moves, On Me drops the row and the
question reads as answered. The answered row keeps the agent's reply it
carries in `done`, so nothing drops out of the queues before the reading
arrives.
`test_admission_keeps_the_obligation_open_until_the_answer_is_in_the_log`
is renamed
`test_a_press_answers_its_obligation_before_the_log_admits_it`.

**Verification.** I ran all 22 tests by node id. They failed on
`983d688fe`, the same 22 as [run
45920651738](https://github.com/max-sixty/leaf/actions/runs/45920651738),
and pass on this branch. The 12 other tests whose fixture moved to
`serve_obligations`, two of them journeys, pass too, as does
`test_render_aim`'s test that serves a variant of `OBLIGATIONS_PAGE`
without the pick. Pre-commit passes on the changed files.

Closes #7346 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 27, 2026
…uires (#7392)

`test_server_admits_an_action_using_its_captured_vocabulary_after_revendoring`
has failed since #7325, which made admission require `answered` on every
act and undo of a widget that declares `awaits`. #7325 updated the other
tests that post events but missed this journey, which runs only in the
scheduled suite. The journey's `lf-local-draft` copies `lf-draft`'s
declaration, which awaits a value at `edit`, so the server refused the
posted edit with `answered-missing`. An edit that holds a value answers
that question, so the event now carries `answered: true`. What the test
protects is unchanged: the server admits an action through the
vocabulary it captured before a re-vendor.

The test fails on `main` at `3fa2e5a17` with the same `answered-missing`
refusal as macOS in scheduled run
[45985529285](https://github.com/max-sixty/leaf/actions/runs/45985529285),
and passes on this branch (run by node id on Linux).

Refs #7391 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 27, 2026
…res (#7419)

Four of the five journeys in #7401 still expected behavior that #7325
deliberately replaced. One of them, the side list's journey, also still
expected the tab names from before #7403. #7325 made a widget that asks
say whether its question is answered, so a press answers or reopens the
question at once. It also stopped an answer written only into markup
from answering. This PR changes only the four tests and keeps all of
#7325's and #7403's intent, so no product behavior moves.

- **`test_a_link_into_the_page_previews_where_it_points`** (both
engines): the decision's answer came only from `selected` in
`LINKS_PAGE`'s markup. The test now logs the user's pick through
`append_command`, as #7350 did for `OBLIGATIONS_PAGE`.
- **`test_a_side_list_is_a_queue_beside_the_item_it_opens`**: an undo
now reopens the question in its own press. So while the undo's POST is
held, the row shows On Me's symbol and no answer. The test used to
expect the answer to stay until the log admitted the undo.
- The same side-list journey also asserted each row's accessible name as
its label alone, with descriptions such as `sev a · suggested fix.
Answered: Fix`. #7403 names an `lf-tabs` row by the words it shows
(label, summary, answer line) and describes it by the state those leave
out, but it updated only the browser tests. The journey now expects
names such as `Ticket a sev a · suggested fix Fix` and descriptions `To
answer` / `Answered`, and finds rows by those names.
-
**`test_a_settled_delivery_activates_one_fresh_document_with_continuity`**:
the held pick answers the page's only question at once, so nothing waits
on the user and the tab title has no `(1)` count. The test now expects
`Live first`, which still proves the first document's head stands while
the delivery is held, since the second revision's title is `Live
second`.
- **`test_a_finger_reaches_the_page_commands_its_keys_reach`**:
`UNDO_PAGE` answers its question only through markup, so the undo
reopens it. While a question waits on the user, a tap on the leaf opens
On Me (`leafOpens`), not the menu. The test now picks again before it
reaches the leaf's menu.

**Verification.** All five node ids failed on `15536dfc8` with the
errors the issue lists. At `e76edf860`, after #7403's naming change, all
four of this PR's tests pass locally, and pre-commit passes on the
changed files.

**What this leaves.** The fifth journey,
`test_presses_and_fills_leave_no_element_naming_stale_keys[data-explorer]`,
shows a panel layout defect, not a stale test. Pressing *Build query* on
the On Me card replaces the press-height commit button with a three-line
`Answered: …` text, which grows `.lf-fp-answers` from 37 to 93 px. The
card keeps its height, so the third line is clipped. Before #7325 the
same growth happened at `849f305d2`, but it arrived with the server's
reading, so the swap watch didn't count it as part of the press. How the
panel should fit a long answer is a design choice, and it stays on
#7401.

Refs #7401 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 27, 2026
…ther tab moves them (#7425)

A widget's declaration now lists, under a new key `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`,
replacing the top-level `answered` from #7325. Where the widget's 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 event, `facts`, with the values that differ from the kept
ones and `through`, the seq of the reading it worked from. It wakes no
one. The server keeps each widget's latest values, lapses them when a
version restates the widget's decisions, reads `answered` from them,
serves them per view, and `leaf page state` shows them on each element.
A widget that declares `awaits` must list `"answered": {"type":
"boolean"}`. Page protocol 63.

This closes what #7325 left open: a checklist given a new step asks
again with its decided steps kept, and restating a picked option of a
`multiple` group after Done asks again. When two tabs act at once, the
page takes up the word they agree on once one tab reports it, if that
word reopens the question. If they agree it is answered, the question
asks until Done is pressed again (first rule below).

Rules that keep a stale word from overriding a fresh one
(`obligations.widget_facts`, `event_contracts._facts_event_error`):

- A `facts` event may say a question is open again but never that it is
answered (`obligations.told_facts`): an answer is the user's act, and
its word travels on that act. So when a version restates the pick the
user made in place of an earlier one, and the earlier pick decides the
widget again as it did before this PR, the question still asks. The cost
is a question that asks until Done is pressed again, although every tab
works out that it is answered. Two cases reach it:
  - A version removes the one option Done didn't cover.
- Tab B picks a and presses Done on {a, b}, while tab A, which has seen
neither act, picks a. A's act lands last carrying `answered: false`.
Every tab then works out true, `told_facts` drops that word, and the
question waits on Done again.
- A gesture or undo made on a version older than the one the kept facts
were said on leaves those standing, so a tab still on v1 can't answer a
question v2 reopened. An undo now names the revision it was made on
(`revision`, optional on the record), as an action does.
- Admission refuses a `facts` event naming an older revision, or worked
out before a gesture or another word on the widget landed
(`stale-facts`), so a word sent just before a press can't land after it.
It also refuses one that changes nothing, so tabs that agree leave one
event. A tab says a word again only after such a refusal, once the
widget moved, or after a send that never arrived, and it looks at a
widget again when a reading, a version or one of its own gestures
leaving the ledger moves it.

What a user sees differently: `lf-options multiple` records on Done the
options it covered and the picks among them, and answers only while Done
stands on the set the group shows. So a pick the user changes after Done
also waits on Done again, where before it stayed answered: a user
unpicking after Done and a version taking a pick back leave the same
widget state.

Worth weighing: Leaf still says `answered` for a class with no `static
answered`, so a plain element asks without one. A value stays stale
while no tab shows the version that moved it, the cost the C design
accepted. Root `AGENTS.md`'s "Responsiveness" is unchanged: a press
still answers in its own task. An Effect UI widget lists its fact
statics in `defineWidget`'s `statics`, which it assigns to the class as
it does `lfPatch`, so lf-options, now on Effect UI (#7417), keeps
`static answered` there and `widgetFacts` finds it.

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

Tests: model tests for each case above and for undeclared facts, invalid
values and `page state` showing facts; runtime tests for lf-options'
rule and `reportFacts`; the browser and journey tests that post events
or read answers, obligations or restatements, by node id.

> _This was written by Claude Code on behalf of max-sixty_
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