Skip to content

feat: import cycle detection in ImportIntegrityVerifier #191

@omsherikar

Description

@omsherikar

Context

ImportIntegrityVerifier documents deferred work:

Step 4 (cycle detection) deferred — requires project-wide import graph

(refactron/verification/checks/imports.py)

Impact

Transforms that introduce circular imports can still pass syntax + resolvability checks but break at runtime. Catching this in the verification engine materially increases confidence for autofix and --verify.

Suggested direction

  • Build a bounded import graph for the project (or for the package subtree under project_root).
  • On transform, diff new edges and detect simple cycles involving the changed module.
  • Guardrails: timeouts, max files, cache graph between runs for performance.

Acceptance sketch

  • Unit tests with minimal fake packages showing a cycle is reported with a clear blocking_reason.
  • Document complexity limits in docstrings or config.

References

  • refactron/verification/checks/imports.py (TODO)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions