#!/usr/bin/env python3 """Independent checker for job #2849's claims (route 140 checker census). Re-derives the headline numbers from the served bytes and the two saved artifacts, with its own anonymous requests, and re-runs the two controls that can be re-run without a walk. python verify-2849.py --census checker-census.json --literals literal-census.json \ --out verify-2849.json [--no-network] Claims C1 population custody: the index artifact hashes to its pin, 1200 ids answer, 170 do not, and the walk digest has exactly 1200 records. C2 retrievability: every declared checker still answers anonymously by sha with sha256(body) == sha (the population was 807; a 404 anywhere fails the claim). C3 the pre-registered partition: 22 constants in 17 checkers, 20 compared, 19 resolved, and the unresolved member is job1679-checks.py's HASH compared against two patch_hash fields. C4 the unanchored constant: /files/79eda0d5... answers 404, and no return declares it. C5 the extension (offline): 117 checkers carry quoted literals, 561 rows / 328 distinct, 297 resolve as store objects, and the worked example's 4 literals all resolve. C6 controls: a fabricated constant is UNRESOLVED, and the unresolved checker's second fetch is byte-identical to the parsed copy. """ import argparse import hashlib import json import os import re import sys import urllib.error import urllib.request BASE = "https://solveathome.org" INDEX = "evidence/2849/r1373-returns-index.json" INDEX_PIN = "bf8041517acc16dd9d5fafbcf3261c59c1328c148213359fd11d24488ea120d5" EV = "evidence/2849" UNANCHORED = "79eda0d5370d7b9a1984d1381a08cbd053d9ac4481de5115612524b94b11206a" WORKED = "b91f88a8db355c4114205a7f157ea2d99a49ae8cf007fbf5e2a8f4df0c6bf9da" def sha(b): return hashlib.sha256(b).hexdigest() def get(path, timeout=90): url = path if path.startswith("http") else BASE + path req = urllib.request.Request(url, headers={"User-Agent": "t1-2026-09-23/2849 (verify)"}) try: with urllib.request.urlopen(req, timeout=timeout) as r: return r.status, r.read() except urllib.error.HTTPError as e: return e.code, e.read() except Exception as e: return None, repr(e).encode() def find(name): here = os.path.dirname(os.path.abspath(__file__)) for c in (name, os.path.join(here, name), os.path.join(here, "..", "..", name), os.path.join("work2849", name), os.path.join(here, "..", "..", "work2849", name), os.path.join(EV, name), os.path.join(here, "..", "..", EV, name)): if os.path.exists(c): return c raise SystemExit("not found from %s: %s" % (os.getcwd(), name)) def main(): ap = argparse.ArgumentParser() ap.add_argument("--census", default="checker-census.json") ap.add_argument("--literals", default="literal-census.json") ap.add_argument("--out", default="verify-2849.json") ap.add_argument("--no-network", action="store_true") a = ap.parse_args() census = json.load(open(find(a.census), encoding="utf-8")) lit = json.load(open(find(a.literals), encoding="utf-8")) claims, failures, detail = {}, [], {} # C1 raw = open(find(os.path.basename(INDEX)), "rb").read() if os.path.exists( find(os.path.basename(INDEX))) else None if raw is None: st, raw = get("/files/" + INDEX_PIN) index = json.loads(raw.decode("utf-8")) n200 = sum(1 for v in index.values() if v.get("http") == 200) n404 = sum(1 for v in index.values() if v.get("http") == 404) digest_lines = sum(1 for l in open(find("return-digest.jsonl"), encoding="utf-8") if l.strip()) c1 = (sha(raw) == INDEX_PIN and n200 == 1200 and n404 == 170 and digest_lines == 1200) claims["C1_population_custody"] = c1 detail["C1"] = {"index_sha256": sha(raw), "pin": INDEX_PIN, "ids_200": n200, "ids_404": n404, "digest_records": digest_lines} if not c1: failures.append("C1") # C2 checkers = census["checkers"] bad = [] if not a.no_network: for h in sorted(checkers): st, body = get("/files/" + h) if st != 200 or sha(body) != h: bad.append({"checker": h, "status": st}) c2 = not bad and len(checkers) == census["population"]["distinct_checkers"] == 807 claims["C2_checkers_retrievable"] = c2 detail["C2"] = {"declared": census["population"]["distinct_checkers"], "checked": len(checkers), "not_retrieving": bad} if not c2: failures.append("C2") # C3 rows = census["constant_rows"] compared = [r for r in rows if r["compared"]] unres = [r for r in compared if not r["records_holding"]] c3 = (len(rows) == 22 and len({r["checker"] for r in rows}) == 17 and len(compared) == 20 and len(unres) == 1 and unres[0]["value"] == UNANCHORED and unres[0]["name"] == "HASH" and any("patch_hash" in (c.get("text") or "") for c in unres[0]["comparison_lines"])) claims["C3_partition"] = c3 detail["C3"] = {"constants": len(rows), "checkers_with_constants": len({r["checker"] for r in rows}), "compared": len(compared), "resolved": len(compared) - len(unres), "unresolved": [{"checker": r["checker"], "name": r["name"], "value": r["value"], "returns": r["returns"], "comparison_lines": r["comparison_lines"]} for r in unres]} if not c3: failures.append("C3") # C4 st, body = get("/files/" + UNANCHORED) declared_by = [] for line in open(find("return-digest.jsonl"), encoding="utf-8"): if UNANCHORED in line: rec = json.loads(line) if any(f.get("sha256") == UNANCHORED for f in (rec.get("files") or [])): declared_by.append(rec["id"]) c4 = st == 404 and not declared_by claims["C4_unanchored_constant"] = c4 detail["C4"] = {"value": UNANCHORED, "files_status": st, "declared_by_returns": declared_by, "compared_against": [c.get("text") for r in unres for c in r["comparison_lines"]]} if not c4: failures.append("C4") # C5 (offline, from the saved checkers) literals = 0 distinct = set() with_lit = 0 for h in sorted(os.listdir(EV + "/checkers")): text = open(EV + "/checkers/" + h, "rb").read().decode("utf-8", "replace") vals = set(re.findall(r"['\"]([0-9a-f]{64})['\"]", text)) if vals: with_lit += 1 literals += len(re.findall(r"['\"]([0-9a-f]{64})['\"]", text)) distinct |= vals worked = lit.get("worked_example") or {} worked_unresolved = {u["value"] for u in lit["unresolved"] if u["checker"] == WORKED} c5 = (with_lit == lit["checkers_with_literals"] and literals == lit["literal_rows"] and len(distinct) == lit["distinct_literals"] and len(worked.get("literals") or []) == 4 and not worked_unresolved) claims["C5_extension"] = c5 detail["C5"] = {"checkers_with_literals": with_lit, "literal_rows": literals, "distinct_literals": len(distinct), "worked_example_literals": len(worked.get("literals") or []), "worked_example_unresolved": sorted(worked_unresolved)} if not c5: failures.append("C5") # C6 fake = "a" * 64 st, body = get("/files/" + fake) fake_unresolved = not (st == 200 and sha(body) == fake) second = [] for h in sorted({r["checker"] for r in unres}): st2, body2 = get("/files/" + h) second.append({"checker": h, "identical": body2 == open(EV + "/checkers/" + h, "rb").read()}) c6 = fake_unresolved and all(s["identical"] for s in second) and bool(second) claims["C6_controls"] = c6 detail["C6"] = {"fabricated_constant_status": st, "fabricated_unresolved": fake_unresolved, "second_copies": second} if not c6: failures.append("C6") out = {"instrument": os.path.basename(__file__), "job": 2849, "route_id": 140, "census": {"path": a.census, "sha256": sha(open(find(a.census), "rb").read())}, "literals": {"path": a.literals, "sha256": sha(open(find(a.literals), "rb").read())}, "claims": claims, "failed_claims": failures, "ok": not failures, "detail": detail} with open(a.out, "w", encoding="utf-8", newline="\n") as fh: json.dump(out, fh, indent=1, sort_keys=True) fh.write("\n") print(json.dumps({"out": a.out, "bytes": os.path.getsize(a.out), "sha256": sha(open(a.out, "rb").read()), "claims": claims, "failed_claims": failures, "ok": not failures}, indent=1)) return 0 if not failures else 1 if __name__ == "__main__": sys.exit(main())