Skip to content

Index

fix

Deterministic test-suite auto-fixer.

See docs/fix_pipeline.md for pipeline architecture and bug-class history. Public API: :func:run, :func:format_report, :class:PipelineReport, :class:FileOp, :class:OpKind.

OpKind = Literal['flatten', 'relocate', 'split', 'merge', 'rename'] module-attribute

Stage tag for a planned :class:FileOp.

Mirrors the five mutating stages of the fix pipeline (FLATTEN, RELOCATE, SPLIT, MERGE, RENAME). Stage 0.5 (non-canonical relocate) and stage 1.5 (layout flatten) emit warnings, not :class:FileOp entries.

FileOp dataclass

A single planned filesystem mutation produced by the pipeline.

target is a list only for SPLIT (one source → many targets); all other kinds use a single Path. split_map is populated only when kind == "split" and maps each canonical target filename to the list of test_* symbols routed into it.

Source code in packages/axm-audit/src/axm_audit/core/fix/models.py
Python
@dataclass
class FileOp:
    """A single planned filesystem mutation produced by the pipeline.

    ``target`` is a list only for SPLIT (one source → many targets); all
    other kinds use a single ``Path``. ``split_map`` is populated only
    when ``kind == "split"`` and maps each canonical target filename to
    the list of ``test_*`` symbols routed into it.
    """

    kind: OpKind
    source: Path
    target: Path | list[Path]
    rationale: str
    source_rule: str
    split_map: dict[str, list[str]] | None = None

PipelineReport dataclass

Aggregated output of :func:axm_audit.core.fix.run.

ops lists every planned mutation across all fixed-point iterations. unfixable carries findings the pipeline declined to auto-resolve (e.g. TEST_QUALITY_NO_PACKAGE_SYMBOL). applied distinguishes dry-run from applied mode. warnings collects non-fatal messages from each stage and the post-pipeline polish. iterations records how many passes the fixed-point loop ran before convergence (1 in dry-run).

Source code in packages/axm-audit/src/axm_audit/core/fix/models.py
Python
@dataclass
class PipelineReport:
    """Aggregated output of :func:`axm_audit.core.fix.run`.

    ``ops`` lists every planned mutation across all fixed-point
    iterations. ``unfixable`` carries findings the pipeline declined to
    auto-resolve (e.g. ``TEST_QUALITY_NO_PACKAGE_SYMBOL``). ``applied``
    distinguishes dry-run from applied mode. ``warnings`` collects
    non-fatal messages from each stage and the post-pipeline polish.
    ``iterations`` records how many passes the fixed-point loop ran
    before convergence (1 in dry-run).
    """

    ops: list[FileOp] = field(default_factory=list)
    unfixable: list[dict[str, Any]] = field(default_factory=list)
    applied: bool = False
    warnings: list[str] = field(default_factory=list)
    iterations: int = 0

    def by_kind(self) -> dict[str, int]:
        """Return a count of planned ops grouped by :data:`OpKind`."""
        c: Counter[str] = Counter()
        for op in self.ops:
            c[op.kind] += 1
        return dict(c)
by_kind()

Return a count of planned ops grouped by :data:OpKind.

Source code in packages/axm-audit/src/axm_audit/core/fix/models.py
Python
def by_kind(self) -> dict[str, int]:
    """Return a count of planned ops grouped by :data:`OpKind`."""
    c: Counter[str] = Counter()
    for op in self.ops:
        c[op.kind] += 1
    return dict(c)