Skip to content

Give Action one metaclass with both parents so Toad imports on Textual main - #1372

Merged
trissim merged 1 commit into
mainfrom
hotfix/action-key-family-meta
Oct 30, 2026
Merged

trissim merged 1 commit into
mainfrom
hotfix/action-key-family-meta

Conversation

@trissim

@trissim trissim commented Oct 30, 2026

Copy link
Copy Markdown

textual#215: KeyDeclaration gets metaclass KeyDeclarationType
Action: also DeclaredFamily, metaclass FamilyMeta
type(): pick one
python: no
every agent-comms head: debt-src red, debt-tools red, before measuring one line

In numbers: 1 file, +8/-3, 1 commit. Fixes the import crash that turns debt-src and debt-tools red on every fresh agent-comms head (#3723, #3697, #3670, #3566 seen red; older heads passed).

Mechanism

Before: class Action(KeyDeclaration[Context], Command, DeclaredFamily, Generic[Context], affix="Action"). Its two metaclasses KeyDeclarationType(ABCMeta) (textual keys.py:21, from textual#215) and FamilyMeta(AutoRegisterMeta, ABCMeta) are unrelated, so import toad.widget_actions raises TypeError: metaclass conflict. The agent-comms NRA gate imports tools/cutover/carry_toad_key_mode.py:15 → toad.preferences → … → widget_actions and dies.

After: class KeyFamilyMeta(FamilyMeta, KeyDeclarationType), the one metaclass both bases require, and Action(..., metaclass=KeyFamilyMeta, affix="Action"). Multiple parents, nothing restated. These are the same lines as toad#1338's fix, landed alone because #1338 is red on its own unrelated growth (menus.py OwnTypeTest +1, TypeCheckingImport +5, TypeErrors +4). Its merge of main resolves to these lines unchanged.

Proof

On fresh mains of toad (1d85311), textual (76f9ef770) and agent-comms: before, import toad.preferences raises the metaclass conflict. After, toad.preferences, cutover.carry_toad_key_mode, cutover.carry_toad_arrow_keys and toad.app all import. type(Action).__mro__ starts KeyFamilyMeta → FamilyMeta → AutoRegisterMeta.

Deleted

Nothing.

Assumed: no other Toad class mixes KeyDeclaration with DeclaredFamily on main; the gate's import path and toad.app import cleanly, which covers every module the app loads at start.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XbFMSoWgC3ZwKzjT4SwMDu

…l main

textual#215 gave KeyDeclaration the KeyDeclarationType metaclass, while
Action also inherits DeclaredFamily's FamilyMeta; neither metaclass
subclasses the other, so `import toad.widget_actions` raises a metaclass
conflict and agent-comms' debt-src/debt-tools die importing the Toad
cutover tools on every head. KeyFamilyMeta(FamilyMeta, KeyDeclarationType)
is the one class both bases require; same lines as toad#1338's fix, so its
merge of main resolves to them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XbFMSoWgC3ZwKzjT4SwMDu
Copilot AI balanced review requested due to automatic review settings October 30, 2026 18:01

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 October 30, 2026 18:05
@trissim
trissim merged commit c72556c into main Oct 30, 2026
2 of 3 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