Repository navigation
Accept abstract ancestor capabilities without requiring Widget constructors - #181
Merged
Merged
Conversation
trissim
marked this pull request as ready for review
October 21, 2026 12:18
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
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.
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.
P407: abstract ancestor capabilities
Fixes the Textual dependency of OpenHCSDev/toad#1115.
SessionScopeis an abstract DOMNode capability, not a concrete Widget constructor. The oldtype[QueryType]overload rejected both its Widget bound and its abstractness.src/textual/css/query.py:53: one unboundAncestorType; existing Widget-boundQueryTypeis unchanged.src/textual/dom.py:1820: replace the class-selector overload withTypeForm[AncestorType]; implementation returnsDOMNode | AncestorType. String and expect_type overloads are unchanged.tests/test_query.py: one abstract-mixin test returning the exact existing parent instance. The abstractmethod-only mixin follows Textual's metaclass-compatible convention.Verification at ad554b3
Background commands, existing dependencies, timeout 300, faulthandler_timeout=60:
The second count includes the new case. No full suite or local ratchet.
A focused mypy caller using the real Toad SessionScope and assert_type(child.query_ancestor(SessionScope), SessionScope) passes without a cast/ignore. The whole dom.py check still reports 33 diagnostics outside query_ancestor; the two introduced implementation errors from the first annotation-only checkpoint are gone. Python ast.parse(feature_version=(3,9)) accepts the changed module. No installation claim.
Owner/consumer evidence
Existing refactor-audit Package/Repository inventory: 255 production modules and 484 test modules, zero parse omissions. It enumerates query declarations, imports, QueryType/AncestorType, DOMQuery._matches, of_type, and every syntactic query_ancestor consumer. Toad's separate complete Scope inventory is on Textualize#1115. Dynamic aliases are not claimed resolved by AST.
Search:
rg -n 'AncestorType|def query_ancestor|TypeForm' src/textual/{css/query,dom}.pyshows one AncestorType declaration and the replacement overload/implementation. The superseded constructor overload is deleted, not kept alongside the new one.Assumed: