| |
| """Validate the static judged bundle without running any paper code.""" |
|
|
| from __future__ import annotations |
|
|
| import json |
| import re |
| from pathlib import Path |
|
|
|
|
| ROOT = Path(__file__).resolve().parents[1] |
| PAGES = ROOT / "pages" |
| OUTPUT = ROOT / "outputs" / "bundle_validation.json" |
|
|
|
|
| def main() -> None: |
| claim_pages = sorted(PAGES.glob("claim-*/page.md")) |
| judged_pages = sorted(PAGES.glob("**/*.md")) |
| page_records = [] |
| verdicts = [] |
| for path in judged_pages: |
| text = path.read_text(encoding="utf-8") |
| page_records.append({ |
| "path": str(path.relative_to(ROOT)), |
| "bytes": len(path.read_bytes()), |
| "characters": len(text), |
| "nonempty": bool(text.strip()), |
| }) |
| matches = re.findall(r"^## Verdict: \*\*(VERIFIED|FALSIFIED)\*\*$", text, re.MULTILINE) |
| if path in claim_pages: |
| verdicts.append(matches[0] if len(matches) == 1 else "MISSING_OR_MULTIPLE") |
|
|
| audit = json.loads((ROOT / "outputs" / "audit_results.json").read_text(encoding="utf-8")) |
| audit_verdicts = [item.get("verdict") for item in audit.get("claims", [])] |
| all_page_bytes = sum(item["bytes"] for item in page_records) |
| all_page_characters = sum(item["characters"] for item in page_records) |
| tags_text = (ROOT / "README.md").read_text(encoding="utf-8") |
| result = { |
| "root": str(ROOT), |
| "claim_page_count": len(claim_pages), |
| "claim_page_paths": [str(p.relative_to(ROOT)) for p in claim_pages], |
| "claim_page_verdicts": verdicts, |
| "audit_claim_count": len(audit.get("claims", [])), |
| "audit_verdicts": audit_verdicts, |
| "judged_page_file_count": len(judged_pages), |
| "judged_page_bytes": all_page_bytes, |
| "judged_page_characters": all_page_characters, |
| "minimum_bytes_met": all_page_bytes >= 5000, |
| "character_cap_met": all_page_characters <= 120000, |
| "all_judged_pages_nonempty": all(item["nonempty"] for item in page_records), |
| "static_tags_present": "icml2026-repro" in tags_text and "paper-JnuwpwbZ8D" in tags_text, |
| "all_claim_verdicts_conclusive": ( |
| len(claim_pages) == 6 |
| and verdicts == ["FALSIFIED"] * 6 |
| ), |
| "page_records": page_records, |
| } |
| result["pass"] = all(( |
| result["claim_page_count"] == 6, |
| result["audit_claim_count"] == 6, |
| result["all_claim_verdicts_conclusive"], |
| result["all_judged_pages_nonempty"], |
| result["minimum_bytes_met"], |
| result["character_cap_met"], |
| result["static_tags_present"], |
| )) |
| OUTPUT.write_text(json.dumps(result, indent=2, sort_keys=True) + "\n", encoding="utf-8") |
| print(json.dumps({ |
| "output": str(OUTPUT), |
| "pass": result["pass"], |
| "judged_page_file_count": result["judged_page_file_count"], |
| "judged_page_bytes": result["judged_page_bytes"], |
| "judged_page_characters": result["judged_page_characters"], |
| }, sort_keys=True)) |
| if not result["pass"]: |
| raise SystemExit(1) |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|