Repository navigation
Run on metaclass-registry 0.4: one owner per registry key - #18
Merged
Merged
Conversation
WitnessNameAliasMixin declared an AutoRegisterMeta family keyed by the witness_name descriptor. Nothing reads that registry. Every line witness that inherits ClassNameWitnessNameMixin or QualnameWitnessNameMixin inherited the mixin's key, so 19 classes claimed two keys between them and each displaced the last; a class listing the mixin first also never reached the LineWitnessCandidate registry. metaclass-registry 0.4 rejects the second claim at import. The mixin is now a plain ABC that supplies witness_name. Each witness registers once, in LineWitnessCandidate, under its own class-name key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…istry 0.4 require_requested_key_compatibility builds the requested members through the real AutoRegisterMeta and compares the registry with the request. Two different classes asked for under one key used to overwrite each other and fail that comparison; 0.4 refuses the second class itself, with an error that is not a ValueError and so escaped the callers' handling. Translate it to the same ValueError. Tests: each class of every NRA family holds one key; the witness-name mixins register nothing; the requested-key check refuses a key claimed twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rites The type-keyed descent test executed a fixture in which a subclass inherits its parent's key and takes it over. 0.4 refuses that class at its declaration, so the test now asserts the refusal and that the key keeps its owner; the codemod's static rejection is asserted as before. The one-key-per-class guard walks classes by identity, because other tests declare unhashable classes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
trissim
force-pushed
the
fix/metaclass-registry-0.4
branch
from
October 12, 2026 15:06
2cf77e4 to
42b83b2
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.
metaclass-registry 0.4 refuses a second class under a registered key. NRA failed at import:
Where the defect was
WitnessNameAliasMixindeclared its ownAutoRegisterMetafamily keyed by thewitness_namedescriptor. Nothing reads that registry. Each line witness inheritingClassNameWitnessNameMixinorQualnameWitnessNameMixininherited the mixin's key, so 19 classes claimed 2 keys; under 0.3 each silently displaced the last. A probe that records every refused registration instead of raising found these 19 and no others across all NRA modules.Fix
witness_name. Each witness registers once, inLineWitnessCandidate, under its own class-name key. No__replaces_registered__: no class replaces another.AutoRegisterClassAuthority.require_requested_key_compatibilitybuilds requested members through the real metaclass. Two classes requested under one key now raise the library's error there; it is translated to the sameValueErrorthe callers already handle.metaclass-registry>=0.4.0;uv.lockregenerated.Tests
tests/test_registry_keys_have_one_owner.py: every class of every NRA family holds one key; the mixins register nothing; the requested-key check refuses a key claimed twice.🤖 Generated with Claude Code