fix(enforcement): ENFORCE-046 exempts the Pattern-B peer its catalog row declares - #509
Merged
Merged
Conversation
…row declares A family facade that extends a peer family facade by class name (the form the facade-base-by-class-name codemod and the generator law require) was reported as a bare concrete import. The visitor now derives the peer: family package importer, canonical-facade origin, used as a base of a class the module declares. Consumers outside the family keep the alias base. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
marlon-costa-dc
enabled auto-merge
September 26, 2026 20:22
marlon-costa-dc
added a commit
that referenced
this pull request
Sep 26, 2026
…d family-surface owners (#510) ## Summary - #509 added a second, string-parsed definition of a Pattern-B peer (`NAMESPACE_FAMILY_PREFIX`, canonical file names, `rpartition`). This PR replaces it with one helper, `FlextUtilitiesBeartypeHelpers.is_family_facade`, derived only from existing owners: - **published facade:** the class bound to a one-letter alias in the generated `_LAZY_IMPORTS` (`lazy_alias_suffixes`); - **family membership:** `FlextUtilitiesFamilySurface.project_alias_owners()`. - ENFORCE-046 exempts an import only when it is a base of a published family facade and is itself a published family facade. The duplicate helper is deleted. - The test added in #509 copied the style of existing tests (private-path imports, manual `sys.path`, bare assert), so it is removed. The evidence is the consumers' `runtime-census` after they move to this commit. ## Evidence (lane, canonical verbs) - `make gen`: no changes. - `make check` with CI unset: exit 0 on all active gates (378 s, dominated by mypy; performance defect recorded). - `make test`: 2710 passed in 30.6 s, 0 skipped. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Changes ENFORCE-046 so a Pattern-B peer is recognized through a single helper, `FlextUtilitiesBeartypeHelpers.is_family_facade`, fed by the generated `_LAZY_IMPORTS` alias map and `FlextUtilitiesFamilySurface.project_alias_owners()`. **Refactors** - An import is exempt only when it is a base of a published family facade and is itself a published family facade. - Removes the string-parsed `_is_pattern_b_peer` helper and its copied-style unit test; the consumers' runtime-census is the evidence. <sup>Written for commit ba8849f. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/flext-sh/flext-core/pull/510?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
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.



Summary
facade-base-by-class-namecodemod rule and generator law points 1/5.c.NAMESPACE_FAMILY_PREFIX), the origin is a canonical facade module (c.ENFORCEMENT_CANONICAL_FILES), and the imported class is a base of a class the module declares. Consumers outside the family keep the alias base (Pattern A, flext-dv1ga).Evidence
tests/unit/test_beartype_engine_import_blacklist.pycovers the peer pass, an unused bare class being reported, and a non-family consumer being reported.🤖 Generated with Claude Code
Summary by cubic
Fixes ENFORCE-046 to match its catalog row: a family facade that extends a peer family facade by class name is now exempt instead of being reported as a bare concrete import.
Written for commit de81772. Summary will update on new commits.