P2r main grid: runner, summary, results; close the P2r decision

- scripts/11: check_rids guard; scripts 14/15 accept the protocol_p2r main grid
  (realizations 8-15) only when protocol_p2r and its inputs match the locked SHA-256
- scripts/run_p2r_main.sh: per-regime pipelines (posterior then training) on cuda:0/cuda:1
- scripts/18_summarize_p2r.py: H2a / H2b / H3 / sigma_a verdicts per the locked rules
- docs/plan.md, report.html: H2a and H2b pass, sigma_a arm fails, no Pivot 1
- logs/index.csv: run records of the P2r grid

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 14:27:32 +00:00
parent f95123174f
commit 5a6fb2fc8c
9 changed files with 509 additions and 13 deletions

View File

@@ -41,3 +41,19 @@ def test_p2r_inputs_match_sha256():
if not f.exists(): # outputs/ is not versioned
continue
assert hashlib.sha256(f.read_bytes()).hexdigest() == P["inputs"][key]["sha256"], key
def test_check_rids_guards_main_grids():
"""Scripts 14/15 refuse protocol_p2 main-grid realizations and never mix the protocol_p2r main grid with dev."""
import importlib.util
import pytest
spec = importlib.util.spec_from_file_location("run_d2", REPO_ROOT / "scripts" / "11_run_d2.py")
run_d2 = importlib.util.module_from_spec(spec)
spec.loader.exec_module(run_d2)
P = yaml.safe_load((CONFIGS / "protocol_p2.yaml").read_text())
assert run_d2.check_rids([900, 901], P) is None
for rids in ([0], [8, 900]):
with pytest.raises(SystemExit):
run_d2.check_rids(rids, P)