Skip to content

symfonic.devtools.archgate.exports

exports

Public-export gate coverage.

The T1.2.4 export-drift rule compares a package's __all__ against a snapshot — but only for the packages archcheck.toml lists. A package that declares a public surface and is absent from that list is not passing the gate; it is standing outside it, and the difference is invisible in a green run.

This closes the loop: every top-level package that declares __all__ must be watched. Adding a public surface and forgetting to baseline it fails CI on the same commit that adds it.

check_export_coverage

check_export_coverage(modules: dict[str, ModuleInfo], config: ArchcheckConfig) -> list[Violation]

Top-level packages declaring __all__ that no baseline watches.

Source code in src/symfonic/devtools/archgate/exports.py
def check_export_coverage(
    modules: dict[str, ModuleInfo], config: ArchcheckConfig
) -> list[Violation]:
    """Top-level packages declaring ``__all__`` that no baseline watches."""
    watched = set(config.public_export_modules)
    violations: list[Violation] = []
    for name in sorted(modules):
        info = modules[name]
        if not info.is_package or name.count(".") != 1:
            continue
        if info.dunder_all is None or name in watched:
            continue
        violations.append(
            Violation(
                rule="export-coverage",
                message=(
                    f"{name} declares __all__ ({len(info.dunder_all)} names) but is not "
                    "listed in archcheck.toml [budgets].public_export_modules, so its "
                    "public surface can drift unwatched; add it and regenerate the "
                    "baseline with `python -m symfonic.devtools.archcheck --write-baseline`"
                ),
                modules=(name,),
            )
        )
    return violations