|
| 1 | +"""Assemble before-after.json and copy reproducibility artifacts into the evidence dir.""" |
| 2 | +import json |
| 3 | +import os |
| 4 | +import shutil |
| 5 | + |
| 6 | +W = os.path.expanduser("~/Documents/ownnet-eng/work") |
| 7 | +E = os.path.expanduser("~/Documents/ownnet-eng/Own.NET/docs/evidence/c01-precision-2026-10") |
| 8 | +A = f"{E}/artifacts" |
| 9 | +os.makedirs(A, exist_ok=True) |
| 10 | + |
| 11 | + |
| 12 | +def bm(p): |
| 13 | + d = json.load(open(p)) |
| 14 | + cases = d.get("cases", []) |
| 15 | + norm = sorted(json.dumps({k: v for k, v in c.items() if "second" not in k and "time" not in k}, |
| 16 | + sort_keys=True) for c in cases) |
| 17 | + return d, norm |
| 18 | + |
| 19 | + |
| 20 | +b, bc = bm(f"{W}/logs/baseline/benchmark.json") |
| 21 | +p, pc = bm(f"{W}/logs/patched/benchmark.json") |
| 22 | +print("benchmark top keys", list(b)[:15], "cases", len(bc), "per-case identical:", bc == pc) |
| 23 | +dev = json.load(open(f"{W}/dev-diff.json")) |
| 24 | +ho = json.load(open(f"{W}/holdout-diff.json")) |
| 25 | +key = json.load(open(f"{W}/eval-key/key.json")) |
| 26 | +labels = [json.loads(line) for line in open(f"{W}/eval-labels.jsonl")] |
| 27 | +ctl = {ph: json.load(open(f"{W}/logs/{d}/controls-{ph}.json")) |
| 28 | + for ph, d in (("before", "baseline"), ("after", "patched"))} |
| 29 | +out = { |
| 30 | + "baseline_sha": "175076925058b6b4eb60087a3b1e834e7315ebad", |
| 31 | + "patch_sha": open(f"{W}/sb-dev/PATCH_SHA").read().strip(), |
| 32 | + "extractor_dll_sha256": { |
| 33 | + "base": "e169519b5d9aaf6df80b119952bbbbb50bc73a727f9a4c4e91cd94436369caf6", |
| 34 | + "patched": "92e1d5f858ef8e3977cf5b4cbf4732bec34356efc12046d93daa1e6931945591"}, |
| 35 | + "engine": "Python reference core; Rust own-cli byte-identical on base and patched MAUI facts", |
| 36 | + "dev_sets": dev, |
| 37 | + "holdout": ho, |
| 38 | + "independent_evaluator": { |
| 39 | + "packet_sha256": "37f93776c57ed34081b2cbf17e13d0bd0ddfc79974d7909084d88d420ed9d4ef", |
| 40 | + "key": key, "labels": labels}, |
| 41 | + "controls": {ph: {"mismatches": c["mismatches"], |
| 42 | + "rows": [{"file": x["file"], **r} for x in c["cases"] for r in x["rows"]]} |
| 43 | + for ph, c in ctl.items()}, |
| 44 | + "corpus_benchmark": {"baseline": {k: v for k, v in b.items() if k != "cases"}, |
| 45 | + "patched": {k: v for k, v in p.items() if k != "cases"}, |
| 46 | + "per_case_identical": bc == pc}, |
| 47 | +} |
| 48 | +json.dump(out, open(f"{E}/before-after.json", "w"), indent=1, ensure_ascii=False) |
| 49 | +for f in ["gates.sh", "ci_samples.sh", "mk_ci_samples.py", "parity.py", "classify_minus.py", |
| 50 | + "tpl_census.py", "iface_calls.sh", "used_repos.py", "check_candidates.sh", "mk_jobs.sh", |
| 51 | + "sb-lib.sh", "diff_runs.py", "mk_packet.py", "controls.sh", "round7_check.sh", |
| 52 | + "round7_base.sh", "assemble.py"]: |
| 53 | + shutil.copy(f"{W}/{f}", f"{A}/{f}") |
| 54 | +for j in ("sb-dev", "sb-holdout"): |
| 55 | + os.makedirs(f"{A}/{j}", exist_ok=True) |
| 56 | + shutil.copy(f"{W}/{j}/run.sh", f"{A}/{j}/run.sh") |
| 57 | +shutil.copy(f"{W}/sb-holdout/holdout.tsv", f"{A}/sb-holdout/holdout.tsv") |
| 58 | +for n, s in (("steps-dev.log", "sb-dev-out/steps.log"), ("steps-holdout.log", "sb-holdout-out/steps.log"), |
| 59 | + ("isolation-dev.txt", "sb-dev-out/isolation.txt"), |
| 60 | + ("isolation-holdout.txt", "sb-holdout-out/isolation.txt"), |
| 61 | + ("gates-baseline-steps.log", "logs/baseline/steps.log"), |
| 62 | + ("gates-patched-steps.log", "logs/patched/steps.log"), |
| 63 | + ("minus-triage.json", "minus-triage.json"), |
| 64 | + ("eval-packet.jsonl", "../eval-packet/packet.jsonl"), |
| 65 | + ("eval-labels.jsonl", "eval-labels.jsonl"), ("eval-key.json", "eval-key/key.json")): |
| 66 | + shutil.copy(f"{W}/{s}", f"{A}/{n}") |
| 67 | +for t in ("h1", "opensilver", "maui-patched"): |
| 68 | + shutil.copy(f"{W}/parity/{t}/parity.json", f"{A}/parity-{t}.json") |
| 69 | +print("ok") |
0 commit comments