Skip to content

Prove AbstractHooksMeta MRO abstracts and installed @classmethod constructors - #639

Merged
trissim merged 1 commit into
mainfrom
feat/abstract-hooks-and-installed-ctor
Nov 27, 2026
Merged

trissim merged 1 commit into
mainfrom
feat/abstract-hooks-and-installed-ctor

Conversation

@trissim

@trissim trissim commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Two soundness-preserving proof upgrades driven by live Toad duplicate_class bench failures (f8000efb5b and 43705cb1e3):

  1. AbstractHooksMeta MRO-wide abstract collection (class_creation_store.py, refactors/class_creation.py, refactors/class_overlap.py):

    • Factored _walk_metaclasses(roots) shared by ClassCreationProof.metaclass_ancestry and new ClassCreationProof.collects_mro_abstract_methods().
    • Unlike abc.ABCMeta (which only reads base.__abstractmethods__), metaclass_registry.abstract_hooks.AbstractHooksMeta.__init__ scans vars(base) across cls.__mro__ for __isabstractmethod__. When a composer's metaclass chain includes AbstractHooksMeta without ABCMeta, ComposedAncestry.creation() keeps abstract methods moved onto plain-type composed bases as preserved; ABCMeta composers remain strict and still refuse plain-type abstract bases.
    • Live Toad f8000efb5b (PickerPane composing SubmitsContract): clears `SubmitsContract` would take abstract ['submit'] and reaches the real textual/message_pump.py:163 (_dispatch_declarations) proof boundary.
  2. Installed classes and @classmethod constructors in RestatedDeclarations.require_no_owner_bound_values (refactors/class_overlap.py):

    • Added _constructed_class_symbol() resolving both direct scanned/installed class calls (verdicts.ancestor via imported_name_for_node) and @classmethod constructors whose own-scope returns all construct cls(...) without rebinding cls (e.g. textual.css.scalar.Scalar.from_number).
    • Added _require_class_has_no_set_name() closing the MRO across scanned classes, installed classes, and known __set_name__-free bases (typing.NamedTuple, builtins), checking base_references_are_complete, class_decorators_are_promotion_safe, and __set_name__.
    • Live Toad 43705cb1e3 (SessionTitles/SessionLabel sharing Scalar.from_number(1)): clears the bogus owner-bound value refusal and reaches the real textual/dom.py:1016 creation proof.

Verification

  • tests/test_installed_creation_hooks.py: 18/18 passed (including new end-to-end apply+run tests for AbstractHooksMeta vs ABCMeta and installed NamedTuple @classmethod vs __set_name__).
  • tests/test_class_overlap_codemod.py: 58/58 passed.
  • tests/test_repository_architecture.py: 7/7 passed.
  • REL_IMPORTS=0.

@trissim
trissim merged commit c1f555e into main Nov 27, 2026
2 of 10 checks passed
@trissim
trissim deleted the feat/abstract-hooks-and-installed-ctor branch November 27, 2026 21:23
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.

1 participant