Repository navigation
The keymap guard is zero everywhere; links click as themselves - #1555
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
debt-src at 8a38d6e passes. |
Every KeymapMeasure asserts zero and `ceiling` is gone: a tolerated count of keys written outside their owner was a ratchet on slop. ActionMethods exempts exactly the operations Textual declares (a navigation contract's methods, a MethodBinding's), read from the classes. With OpenHCSDev/textual#244, the eleven `def action_*` sites are operations, not names: HistoryWindow overrides ScrollsView, TargetTree implements MovesHorizontalCursor, the prompt overrides TextArea's declared editing methods. The two link actions are deleted: - a drawn link's style meta carries OpenLineLink(link), a StyleAction in the new toad/link_click.py; LineLink.click and its "open" action name leave line_blocks, which declares that nothing in it imports a frontend; - OpensLinks inherits Textual's OpensMarkdownLinks, and open_link decodes a toad-link href once; the right-click menu reads OpenLineLink.link_of, and the app's inline import is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… open through Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or hidden imports The NRA gate on this PR found five: link_of matched OpenLineLink by type (OwnTypeTest) on a StyleAction | None (NoneAbsence), two TYPE_CHECKING imports with no cycle, the app's nested right-click if (SIM102), and the new file unformatted. With textual#245, OpenLineLink.secondary opens the link's menu and OpensLinks.link_menu decodes a toad-link href into its link's menu; the app asks handler.action.secondary once. link_of is deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
trissim
force-pushed
the
keymap-guard-zero
branch
from
November 6, 2026 05:55
fc27736 to
8a38d6e
Compare
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.
1 commit, 8 files, +82/-54. Lands after OpenHCSDev/textual#244 (CI installs Textual from
main).Why
tests/guards/test_keymap_owner.pygave every measure aceiling, a tolerated count of keys written outside their owner.ActionMethodsallowed 9, main had 11, and main went red. Raising the ceiling would have been the wrong fix, and so is the ceiling: it's a ratchet on slop. Paper1 §1: a fact supplied outside its declaration is slop, and the count of copies we agree to keep is still that count. Every measure now asserts zero.RawBindings(4),HandBindings(5) andKeyHandlers(1) already had 0 sites under their slack.The 11 sites
history_anchor.py×5action_scroll_*andaction_page_*, reached byScrollableContainer's stringBINDINGSScrollsViewoperations, whose keys are theScrollCommandfamily (textual#244)sidebar_tree.py×2action_cursor_left/right, already theMovesHorizontalCursorcontract. The guard exempted onlyMovesCursor.prompt.py×2delete_left/cursor_line_end, the first reached by a string bindingMethodBinding.declare(textual#244)linked_rows.py×2action_open(link)reached by the meta("open", (link,)), andaction_link(href)reached by Markdown's"link('…')"ActionMethodsexempts exactly the operations Textual declares: methods of aNavigablecontract and methods carrying aMethodBinding. The set is read from the classes, not a hand-kept list.Links
OpenLineLink(link), aStyleActionin the newtoad/link_click.pywhoserundispatches the link on the widget that drew it.LineLink.clickand itsopen_action = "open"leaveline_blocks.py. That module's docstring declares that nothing in it imports a frontend, yet it was holding a Textual action name.OpensLinksinherits Textual'sOpensMarkdownLinks, andopen_link(href)decodes a toad-link href once.OpenLineLink.link_of(handler.action), the single boundary decode, and the app's function-local import is gone. The keyboard path dispatches the link directly.Proof
test_no_key_is_written_outside_the_action_familypasses against textual#244.🤖 Generated with Claude Code