Buckets:
| #!/usr/bin/env python3 | |
| """Validate the non-launchable trainable OT-DRO admission scaffold.""" | |
| from __future__ import annotations | |
| import json | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def validate(root: Path = ROOT) -> list[str]: | |
| root = root.resolve() | |
| errors: list[str] = [] | |
| try: | |
| contract = json.loads((root / "PREPARATION_CONTRACT.json").read_text(encoding="utf-8")) | |
| paper = json.loads((root / "paper.json").read_text(encoding="utf-8")) | |
| except (OSError, UnicodeError, json.JSONDecodeError) as exc: | |
| return [f"cannot read preparation JSON: {exc}"] | |
| expected = { | |
| "lane": "loss-aware-dro-ot", | |
| "decision": "ADMIT", | |
| "stage": "PREPARATION_HOLD", | |
| "source_commit": "6e8d18f023f4f2e920af22dc1ef32b292dbb9631", | |
| "claim_count": 6, | |
| } | |
| for key, value in expected.items(): | |
| if contract.get(key) != value: | |
| errors.append(f"contract {key} mismatch") | |
| if paper.get("slug") != expected["lane"]: | |
| errors.append("paper slug mismatch") | |
| if paper.get("state") != expected["stage"]: | |
| errors.append("paper must remain PREPARATION_HOLD") | |
| if paper.get("admission_decision") != expected["decision"]: | |
| errors.append("paper admission decision mismatch") | |
| if paper.get("scored_claim_count") != expected["claim_count"]: | |
| errors.append("paper claim count mismatch") | |
| if paper.get("current_evidence_scale") not in {"none", "scientific_canary"}: | |
| errors.append("only none or scientific_canary evidence is allowed before paper scale") | |
| expected_claims = {claim_id: "HOLD" for claim_id in ("A1", "A2", "A3", "A4", "A5", "A6")} | |
| if paper.get("scientific_claims") != expected_claims: | |
| errors.append("all scientific claims must remain HOLD") | |
| if paper.get("current_evidence_scale") == "scientific_canary": | |
| if not (root / ".openresearch" / "control" / "scientific-canary-manifest.json").is_file(): | |
| errors.append("scientific canary manifest missing") | |
| if paper.get("official_source", {}).get("revision") != expected["source_commit"]: | |
| errors.append("paper source revision mismatch") | |
| if not contract.get("blockers"): | |
| errors.append("blocker list must be nonempty") | |
| if any(contract.get("authority", {}).values()) or any(paper.get("authority", {}).values()): | |
| errors.append("all authority flags must remain false") | |
| if paper.get("publication", {}).get("authorized") or paper.get("publication", {}).get("submitted"): | |
| errors.append("publication must remain unauthorized and unsubmitted") | |
| for rel in contract.get("required_files", []): | |
| candidate = (root / rel).resolve() | |
| if root not in candidate.parents or not candidate.is_file(): | |
| errors.append(f"missing or escaping required file: {rel}") | |
| for forbidden in (".git", "source", "outputs", "results", "evidence"): | |
| if (root / forbidden).exists(): | |
| errors.append(f"forbidden preparation path exists: {forbidden}") | |
| claims = (root / "CLAIM_MAPPING.md").read_text(encoding="utf-8") | |
| for claim_id in ("A1", "A2", "A3", "A4", "A5", "A6"): | |
| if f"| `{claim_id}` |" not in claims: | |
| errors.append(f"missing claim row {claim_id}") | |
| return errors | |
| if __name__ == "__main__": | |
| problems = validate() | |
| if problems: | |
| print("PREPARATION INVALID", file=sys.stderr) | |
| for problem in problems: | |
| print(f"- {problem}", file=sys.stderr) | |
| raise SystemExit(2) | |
| print("PREPARATION VALID: ADMIT decision recorded; lane remains HOLD and non-launchable") | |
Xet Storage Details
- Size:
- 3.71 kB
- Xet hash:
- 49a808ee2ecd63bf4827b4642bef4287780ccc2c3fcd78299e38d65775e2b4ef
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.