Skip to content

Name an Ask's answer from its widget's semantic state - #1769

Merged
max-sixty merged 2 commits into
mainfrom
ask-answer-words
Oct 5, 2026
Merged

max-sixty merged 2 commits into
mainfrom
ask-answer-words

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

The Asks drawer and a side-list queue's rows say what each answered Ask
was answered with. Those words came from an answer reader each widget
instance registered on its command scope as it rendered, over instance
state, so semantic words lived on a renderer. On a settling revision the
publication arrived before the widget re-registered its reader, and
watchAnswers read a second time after whenWidgetsPresented to cover
that race. lf-tabs caught a "more than one answer reader" TypeError per
row, which only a module bug, or the test that injected a second reader
by hand, could raise.

Each x-awaits widget class now declares static answerWords(state, element): words from the widget's state in the application publication
and from its authored markup. askAnswers reads it synchronously from
the publication that carries the Ask inventory, so:

  • watchAnswers is gone, and lf-tabs repaints its rows on watchAsks.
  • A tag has one class, so an Ask has one way to say its answer. The
    TypeError and its test, the per-row catch, the command scope's
    answer option, and commandScopesWithin are gone.
  • All six families cut over: lf-options, lf-draft, lf-suggestion,
    lf-playground, lf-targeting, and lf-swipe-deck.

Where an old reader read instance or rendered state rather than what was
answered, the words change:

  • A playground says the instruction its choose sent, not the one its
    controls show now.
  • A visual-targeting Ask counts the submitted configuration, not unsent
    local edits.
  • An option the user added is named by the rendered words its add
    carries, not read off the node the widget generated for it.

lf-options also stops dispatching lf-answered, which nothing has
listened to since #746.

test_an_answered_asks_words_are_its_widgets_semantic_state covers the
draft, playground, and added-option words, and a multiple group
answered by Done with only its authored chosen option; its playground
case fails on main. answerWords reads each verb's state without a
fallback because every captured widget's state holds each declared verb
from its authored markup (initialState in projection/authored.js).
test_a_queue_row_names_an_answer_whose_widget_module_arrives_last holds
lf-options' module until after lf-tabs upgrades and checks the row still
names an answer recorded before load: startup imports every module the
document names before the state feed starts, and the Ask inventory is
empty until that first reading.

Not fixed here: re-picking an option on a group a later version marked
settled drops its Ask from the inventory, so the queue row loses its
check (reproduced by extending
test_a_side_list_is_a_queue_beside_the_item_it_opens). Admission stamps
meaning.answer only while the group still asks (answering_action in
event_meaning.py reads x-awaits.when, which settled turns off), and
the inventory's interim "decided" reading (_answered_by_user in
asks.py) keeps an Ask only while its standing action carries that
stamp. The re-pick replaces the stamped action with an unstamped one.
That is the Python Ask inventory, a separate mechanism from the words. It stays for the Tasks model, which replaces that interim reading; #1779 notes it in place.

Verified locally: the Ask, queue, swipe, drawer, playground, targeting,
draft, suggestion, and options browser tests (-k selections in
test_render_widgets.py, test_render_navigation.py, and
test_render_controls.py), npm run test:runtime, and pre-commit.
test_live_samples_keep_real_gestures_and_drafts_inside_the_child fails
the same way on this branch and on main.

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

The Asks drawer and a side-list queue's rows say what each answered Ask
was answered with. Those words came from an `answer` reader each widget
instance registered on its command scope as it rendered, over instance
state, so semantic words lived on a renderer. On a settling revision the
publication arrived before the widget re-registered its reader, and
`watchAnswers` read a second time after `whenWidgetsPresented` to cover
that race. `lf-tabs` caught a "more than one answer reader" TypeError per
row, which only a module bug, or the test that injected a second reader
by hand, could raise.

Each `x-awaits` widget class now declares `static answerWords(state,
element)`: words from the widget's state in the application publication
and from its authored markup. `askAnswers` reads it synchronously from
the publication that carries the Ask inventory, so:

- `watchAnswers` is gone, and `lf-tabs` repaints its rows on `watchAsks`.
- A tag has one class, so an Ask has one way to say its answer. The
  TypeError and its test, the per-row catch, the command scope's
  `answer` option, and `commandScopesWithin` are gone.
- All six families cut over: lf-options, lf-draft, lf-suggestion,
  lf-playground, lf-targeting, and lf-swipe-deck.

Where an old reader read instance or rendered state rather than what was
answered, the words change:

- A playground says the instruction its `choose` sent, not the one its
  controls show now.
- A visual-targeting Ask counts the submitted configuration, not unsent
  local edits.
- An option the user added is named by the rendered words its `add`
  carries, not read off the node the widget generated for it.

lf-options also stops dispatching `lf-answered`, which nothing has
listened to since #746.

`test_an_answered_asks_words_are_its_widgets_semantic_state` covers the
draft, playground, and added-option words; its playground case fails on
main.

Not fixed here: re-picking an option on a group a later version marked
`settled` drops its Ask from the inventory, so the queue row loses its
check (reproduced by extending
`test_a_side_list_is_a_queue_beside_the_item_it_opens`). Admission stamps
`meaning.answer` only while the group still asks (`answering_action` in
`event_meaning.py` reads `x-awaits.when`, which `settled` turns off), and
the inventory's interim "decided" reading (`_answered_by_user` in
`asks.py`) keeps an Ask only while its standing action carries that
stamp. The re-pick replaces the stamped action with an unstamped one.
That is the Python Ask inventory, a separate mechanism from the words.

Verified locally: the Ask, queue, swipe, drawer, playground, targeting,
draft, suggestion, and options browser tests (`-k` selections in
`test_render_widgets.py`, `test_render_navigation.py`, and
`test_render_controls.py`), `npm run test:runtime`, and pre-commit.
`test_live_samples_keep_real_gestures_and_drafts_inside_the_child` fails
the same way on this branch and on main.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 4, 2026
Two cases the move to `static answerWords` could have broken, both
passing as written:

- A `multiple` group answered by Done with only its authored `chosen`
  option names that option. `answerWords` reads `state.choose` without a
  fallback because every captured widget's state holds each declared
  verb from its authored markup (`initialState` in
  `projection/authored.js`, folded by `foldWidgetStates`), so an Ask can
  be answered without a `choose` event but never without `choose` state.
- A queue row whose Ask was answered before load names the answer when
  lf-options' module arrives after lf-tabs has upgraded. Startup imports
  every module the document names before the state feed starts, and the
  Ask inventory is empty until that first reading, so no consumer reads
  answer words before the answering class is defined.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit e9f838e into main Oct 5, 2026
4 checks passed
@max-sixty
max-sixty deleted the ask-answer-words branch October 5, 2026 00:14
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