Skip to content

Name commands whose context keys the page never shows - #2441

Merged
max-sixty merged 4 commits into
mainfrom
context-keys-check
Oct 12, 2026
Merged

max-sixty merged 4 commits into
mainfrom
context-keys-check

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A widget's command can declare contextKeys, keys that press its control from elsewhere such as its Question, and leave out bindingBadge, so the key works with nothing on the page showing it. That is how a multiple-choice Question's Done lost its digit (fixed in #2434) without any check noticing.

leaf package check --render gains a shows-context-keys widget quality check. It reads the command declarations in each worked example and names a command with context keys and no bindingBadge, as advice for the widget's author; it puts nothing on the page. A worked example shows one state, and Done appears only in a multiple-choice one, so the corpus sweep in test_render_gate.py runs the same reading over every example page. Before #2434 that sweep failed on Done in ideas-to-implement and ship-review.

lf-draft was the one bundled widget the check named: Edit, Save and Cancel declared Ask digits (1, 1 and 2) with no badge. They now declare no context keys. Tab reaches the buttons, Save keeps Mod+Enter and Close keeps Escape, so a user standing on a draft's Ask no longer edits, saves or cancels it with a digit. The digit test now asserts a digit is not a command there and that Tab, Enter and Mod+Enter answer the Ask. test_numbered_ask_routes_follow_replaced_controls is deleted: the draft was its only widget, and with no digits it has no route to follow.

check-api.js exports commandDeclarationsWithin and commandRoutes for the probe; packages.md and module-authoring.md describe the check.

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

max-sixty and others added 3 commits October 11, 2026 14:54
A widget's command may declare `contextKeys`, keys that press its control
from elsewhere such as its Question, and leave out `bindingBadge`, so the
key works with nothing on the page showing it. That is how a
multiple-choice Question's Done lost its digit in #2064 without any check
noticing.

`leaf package check --render` gains a `shows-context-keys` widget quality
check that reads each example's command declarations and names such a
command, as advice for the widget's author; it puts nothing on the page.
The corpus sweep in test_render_gate.py runs the same reading, since a
worked example shows one state and Done appears only in a
multiple-choice one. lf-draft's Edit, Save and Cancel join
known_widget_findings.py.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Edit, Save and Cancel declared Ask digits (1, 1 and 2) and no binding
badge, so the keys worked with nothing on the page showing them, which
the new shows-context-keys check names. They now declare no context
keys: Tab reaches the buttons, Save keeps Mod+Enter and Close keeps
Escape, and lf-draft leaves known_widget_findings.py.

A user standing on a draft's Ask no longer edits, saves or cancels it
with a digit. The digit test now asserts that a digit is not a command
there and that the Tab, Enter and Mod+Enter route answers the Ask.
test_numbered_ask_routes_follow_replaced_controls is deleted: the draft
was its only widget, and with no digits it has no route to follow.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

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

The new probe can attribute a dependency widget's command to the package being checked. The ownership boundary and a suggested correction are inline.

A dependency's widget nested in one of the package's own was skipped by
the walk, so its unbadged command was reported against the outer widget.
Stop at the nearest Leaf widget first, as heldScrollers does.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit e1f52ba into main Oct 12, 2026
3 checks passed
@max-sixty
max-sixty deleted the context-keys-check branch October 12, 2026 00:19
leaf-agent added a commit that referenced this pull request Oct 12, 2026
The [main CI
run](https://github.com/max-sixty/leaf/actions/runs/38187553140) failed
because a widget test still expected `1` to open a needed draft. #2441
intentionally removed draft context digits and put the supported Ask
route in
`test_a_draft_in_an_ask_takes_no_digits_and_answers_from_its_controls`.
This removes the conflicting older test; the draft suite retains
coverage for Tab to Edit, Enter to open, and the save shortcut.

Verified locally: the old widget test failed on current main, while the
draft suite test passed. The file-row failure in the same run was
already addressed by #2437 and its current test also passed locally.

Co-authored-by: leaf-agent <[email protected]>
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