Skip to content

Every view declares what it shows as a class keyword; prepared choices declare their editors - #1543

Merged
trissim merged 1 commit into
mainfrom
refactor/shows-is-a-class-keyword
Nov 6, 2026
Merged

trissim merged 1 commit into
mainfrom
refactor/shows-is-a-class-keyword

Conversation

@trissim

@trissim trissim commented Nov 6, 2026

Copy link
Copy Markdown

Pairs with OpenHCSDev/formbridge#19. Land formbridge first, then this, then relock the stack. 5 files, +15/−37.

What changed

  • 14 shows = (...) class-body lines become shows=(...) class keywords (editors.py ×8, form_view.py ×2, settings.py, comms_command_dialog.py ×2, test_settings_screen.py).
  • FieldView(DeclaredViews, WidgetView, VerticalGroup): the capability mixin comes first, so shows= is taken before Textual's DOMNode.__init_subclass__, which rejects unknown keywords.
  • Deleted a registry entry written from outside any class: ValueEditor.shown_by[PreparedChoices] = lambda field: ... (comms_command_dialog.py:46). PreparedChoices now inherits formbridge's DeclaredMetadata and declares its parameter's editor_declarations before its own lineage. Same editor chosen, no outside writer.

Why

Membership by vars(cls).get("shows", ()) was a structural probe of a class body (paper1 Proposition 3.3). My toad#1542 review proved showing() couldn't return the abstract FieldView from an absence: "its body doesn't say shows". Called out in #comms. Now each class declares, and the hierarchy answers.

Proof

With formbridge#19 on the path: tests/textual/test_forms.py, tests/textual/test_settings_screen.py, tests/model/test_agent_configuration.py: 16 passed, 2 failed. The 2 are 'ellipsis' == 'clip' checkbox-policy tests already red on main (b-ui is taking them). formbridge: 9 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XbFMSqJMarXn2ZE8iAL7Sd

…s declare their editors

Pairs with OpenHCSDev/formbridge#19, where DeclaredViews stops probing class
bodies (`vars(cls).get("shows", ())`) and the family becomes the inheritance
tree. The 14 `shows = (...)` body lines become `shows=(...)` class keywords.
FieldView lists the DeclaredViews mixin first, so the keyword is taken before
Textual's DOMNode.__init_subclass__ sees it.

comms_command_dialog wrote `ValueEditor.shown_by[PreparedChoices] = lambda ...`
from module scope: a registry entry outside any class. PreparedChoices now
inherits DeclaredMetadata and declares its parameter's editor declarations
before its own lineage, so the same editor is chosen and the line is deleted.

Proof (with formbridge#19 on the path): test_forms, test_settings_screen and
test_agent_configuration 16 passed; the 2 failures are the checkbox
'ellipsis' == 'clip' tests already red on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XbFMSqJMarXn2ZE8iAL7Sd
Copilot AI balanced review requested due to automatic review settings November 6, 2026 04:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@trissim
trissim enabled auto-merge November 6, 2026 04:14
@trissim
trissim merged commit 1c41d1a into main Nov 6, 2026
1 of 2 checks passed
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