#!/usr/bin/env python3 """Offline validation of Cortist Reality Ledger export. No remote fact-checking.""" import json from pathlib import Path from urllib.parse import urlparse ROOT = Path(__file__).resolve().parents[1] RECORDS = [json.loads(line) for line in (ROOT / "records.jsonl").read_text(encoding="utf-8").splitlines() if line.strip()] assert len(RECORDS) == 10, "Expected ten records in initial release" assert len({r["id"] for r in RECORDS}) == len(RECORDS), "Duplicate record ID" assert [r["id"] for r in RECORDS] == [f"CL-{n:04d}" for n in range(1, 11)] assert sum(len(r["sources"]) for r in RECORDS) == 12, "Original-source reference count differs" for r in RECORDS: assert r["version"] == 1 and r["snapshot_date"] == "2026-10-25" assert r["outcome_resolved"] is False and r["score"] is None assert all(r.get(k) for k in ["claim", "evidence", "limitations", "next_evidence", "source_date"]) assert urlparse(r["snapshot_url"]).netloc == "cortist.com" assert len(r["snapshot_sha256"]) == 64 assert all(s["url"].startswith("https://") for s in r["sources"]) assert all(set(event)=={"date", "event", "detail"} for event in r["timeline"]) manifest=json.loads((ROOT/"metadata/source_manifest.json").read_text(encoding="utf-8")) assert manifest["records"]==10 and len(manifest["snapshots"])==10 assert [s["sha256"] for s in manifest["snapshots"]]==[r["snapshot_sha256"] for r in RECORDS] print("OK — 10 unique records, 12 source links, 10 immutable snapshot references, consistent metadata.") print("Note: this is a structural test. Independent source claims were not re-tested.")