Coverage for scripts/check_artifact_pins.py: 100%
17 statements
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-22 12:55 +0000
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-22 12:55 +0000
1"""Fails (exit 1) when an installed model file differs from `ml/artifact_pins.json` (V6.6.9, Problems #382). `aq verify --quick` runs it.
3 python scripts/check_artifact_pins.py
4"""
6from __future__ import annotations
8import sys
9from pathlib import Path
11ROOT = Path(__file__).resolve().parents[1]
12sys.path.insert(0, str(ROOT))
14from retraining.artifact_pins import artifact_problems # noqa: E402
17def main() -> int:
18 if not (ROOT / "ml" / "sequence_model.json").exists():
19 print("no installed models here (a clean checkout): nothing to check")
20 return 0
21 problems = artifact_problems(ROOT / "ml", ROOT / "ml" / "artifact_pins.json")
22 for problem in problems:
23 print(problem, file=sys.stderr)
24 print("the installed models match their pins" if not problems else f"{len(problems)} problem(s)")
25 return 1 if problems else 0
28if __name__ == "__main__":
29 raise SystemExit(main())