Skip to content

equivalence_cics: lazy family re-exports end the 23 unsafe cyclic imports (Part of #7153) - #7231

Merged
squid-shepherd[bot] merged 1 commit into
mainfrom
churn/7153-20261031T0134Z
Oct 31, 2026
Merged

squid-shepherd[bot] merged 1 commit into
mainfrom
churn/7153-20261031T0134Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #7153.

Checklist: done [c:3e30b5cd]

What

tests/tools/equivalence_cics.py copied 23 names out of the equivalence_cics_* family modules at import time (fault_lines = cics_faults.fault_lines, ...). Each family imports equivalence_cics back, so importing a family first ran those copies against a half-initialised module: CodeQL's 23 py/unsafe-cyclic-import alerts (lines 61-83 on main). The names are now resolved on first use through a module-level __getattr__ (PEP 562) over one _FAMILY_NAMES table (24 names, check_child_faults included), and equivalence_cics.py's own calls use cics_<family>.<name> directly. External ec.<name> access is unchanged. No engine code, no golden change.

Class sweep

The class: an import-time copy of an attribute of a module that imports this one back.

  • The 24 aliases in equivalence_cics.py: converted (23 alerted + check_child_faults).
  • Open py/unsafe-cyclic-import alerts on main by API query: 23, all in this file. None elsewhere.
  • Function-level import equivalence_cics in equivalence_call/ims/inputs.py: lazy, not the class.

Tests

test_cics_family_split.py: an AST check that no X = cics_*.X copy remains, and a fresh python -I import of each of the 8 modules first, asserting every re-exported name is the family's own object. The affected suites pass (750 passed, 30 skipped). ruff, mypy and dead-key audits show no new findings.

Sibling gaps

None found for this rule. The 4 py/uninitialized-local-variable alerts are the next checklist item.

Lessons for agents

A function's bare global lookup never goes through a module __getattr__: when replacing a module-level alias by a lazy re-export, rewrite the module's own bare uses to the qualified form.

Cross-repo

None.

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 31, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review October 31, 2026 01:44
@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) October 31, 2026 01:51
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot merged commit d15f856 into main Oct 31, 2026
79 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/7153-20261031T0134Z branch October 31, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant