Repository navigation
Name an Ask's answer from its widget's semantic state - #1769
Merged
Merged
Conversation
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
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]>
leaf-agent
approved these changes
Oct 4, 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.
The Asks drawer and a side-list queue's rows say what each answered Ask
was answered with. Those words came from an
answerreader each widgetinstance 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
watchAnswersread a second time afterwhenWidgetsPresentedto coverthat race.
lf-tabscaught a "more than one answer reader" TypeError perrow, which only a module bug, or the test that injected a second reader
by hand, could raise.
Each
x-awaitswidget class now declaresstatic answerWords(state, element): words from the widget's state in the application publicationand from its authored markup.
askAnswersreads it synchronously fromthe publication that carries the Ask inventory, so:
watchAnswersis gone, andlf-tabsrepaints its rows onwatchAsks.TypeError and its test, the per-row catch, the command scope's
answeroption, andcommandScopesWithinare gone.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:
choosesent, not the one itscontrols show now.
local edits.
addcarries, not read off the node the widget generated for it.
lf-options also stops dispatching
lf-answered, which nothing haslistened to since #746.
test_an_answered_asks_words_are_its_widgets_semantic_statecovers thedraft, playground, and added-option words, and a
multiplegroupanswered by Done with only its authored
chosenoption; its playgroundcase fails on main.
answerWordsreads each verb's state without afallback because every captured widget's state holds each declared verb
from its authored markup (
initialStateinprojection/authored.js).test_a_queue_row_names_an_answer_whose_widget_module_arrives_lastholdslf-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
settleddrops its Ask from the inventory, so the queue row loses itscheck (reproduced by extending
test_a_side_list_is_a_queue_beside_the_item_it_opens). Admission stampsmeaning.answeronly while the group still asks (answering_actioninevent_meaning.pyreadsx-awaits.when, whichsettledturns off), andthe inventory's interim "decided" reading (
_answered_by_userinasks.py) keeps an Ask only while its standing action carries thatstamp. 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 (
-kselections intest_render_widgets.py,test_render_navigation.py, andtest_render_controls.py),npm run test:runtime, and pre-commit.test_live_samples_keep_real_gestures_and_drafts_inside_the_childfailsthe same way on this branch and on main.