#!/usr/bin/env python3 """Stage outputs/job4540/repro/ with exactly the declared inputs and run the checker there. The repro directory holds nothing but the checker and the inputs the checker resolves by name, so a pass there says the shipped numbers are reproducible from the shipped bytes alone. """ import os import shutil import subprocess import sys HERE = os.path.dirname(os.path.abspath(__file__)) REPRO = os.path.join(HERE, "repro") SERVED = os.path.join(HERE, "served") INPUTS = ["check-job4540.py", "scan.json", "step.json", "corpus.jsonl", "fetch_manifest.json", "route-100.json", "f2024_corpus.jsonl", "f1833_sweep2612.jsonl", "f1833_dbound2612.json", "f1833_sweep2612.py", "f1804_sweep2785.json"] for rid in (1264, 1267, 1804, 1833, 2018, 2024, 2025, 2026, 2027): INPUTS.append("return-%d.json" % rid) def declared_attached(): import json out = [] for rid in (1264, 1267, 1804, 1833, 2024, 2025, 2026, 2027): p = os.path.join(SERVED, "return-%d.json" % rid) rec = json.load(open(p, encoding="utf-8")) for f in (rec.get("files") or []): nm = "f%d_%s" % (rid, f["name"]) if os.path.exists(os.path.join(SERVED, nm)): out.append(nm) return out def main(): os.makedirs(REPRO, exist_ok=True) for nm in INPUTS + declared_attached(): src = os.path.join(HERE, nm) if not os.path.exists(src): src = os.path.join(SERVED, nm) if not os.path.exists(src): raise SystemExit("missing declared input: %s" % nm) shutil.copyfile(src, os.path.join(REPRO, nm)) r = subprocess.run([sys.executable, "check-job4540.py"], cwd=REPRO, capture_output=True, text=True) print(r.stdout[-2000:]) print("repro exit", r.returncode, "files", len(os.listdir(REPRO))) return r.returncode if __name__ == "__main__": sys.exit(main())