# Route 131 / job 2814: for the ten documents whose accepted revision the 2026-09-16 mirror cut undid (#1413's sweep), plus # research/history/staging/shadow-prereg.md, read the public version history and test whether the first accepted revision's # change (lines it added / removed against version 1) is present in the text served now. # Usage: python3 carry2814.py [project base URL] (stdlib only; public endpoints; no token) # stdout: one JSON object per document, then a summary line. Deterministic for a fixed server state; progress goes to stderr. import difflib, hashlib, json, os, sys, urllib.request BASE = sys.argv[1] if len(sys.argv) > 1 else "https://solveathome.org/projects/twin-primes" ROOT = BASE.split("/projects/")[0] PATHS = ["paper/beta2-note.md", "paper/proposals/prop-staircase-note.md", "research/QUESTIONS.md", "research/centered-discrepancy-estimate.md", "research/corner-correlation.md", "research/fixed-endpoint-discrepancy.md", "research/fold-arithmetic-bridge.md", "research/global-factor-signs.md", "research/history/staging/derive-0904-L7-transfer.md", "research/history/staging/xchan-at29-prereg.md", "research/history/staging/shadow-prereg.md"] UA = {"User-Agent": "claude-code (claude-opus-5-5) job2814 carry check", "Accept": "application/json"} def get(url): return urllib.request.urlopen(urllib.request.Request(url, headers=UA), timeout=60).read() def blob(sha, cache="blobs"): os.makedirs(cache, exist_ok=True) fp = os.path.join(cache, sha) if not os.path.exists(fp): open(fp, "wb").write(get(f"{ROOT}/files/{sha}")) b = open(fp, "rb").read() if hashlib.sha256(b).hexdigest() != sha: sys.exit(f"hash mismatch for blob {sha}") return b.decode("utf-8").splitlines() rows = [] for path in PATHS: print(f"history {path}", file=sys.stderr) d = json.loads(get(f"{BASE}/history/{path}")) vs = d["versions"]; served = d["timestamps"]["sha256"] acc = [v for v in vs if v["return_id"]] if not acc: rows.append({"path": path, "versions": len(vs), "accepted_revisions": 0}); continue v1, v2 = vs[0], acc[0] a, b, s = blob(v1["content_sha"]), blob(v2["content_sha"]), set(blob(served)) diff = list(difflib.ndiff(a, b)) added = [l[2:] for l in diff if l.startswith("+ ")] removed = [l[2:] for l in diff if l.startswith("- ")] rows.append({ "path": path, "versions": [f"v{v['version']}:{v['content_sha'][:12]}:{v['return_id'] or '-'}" for v in vs], "served_sha": served, "served_equals_v1": served == v1["content_sha"], "latest_is_mirror_cut": vs[-1]["return_id"] is None, "first_accepted": {"version": v2["version"], "return_id": int(v2["return_id"])}, "v2_added": len(added), "added_present_in_served": sum(1 for l in added if l in s), "v2_removed": len(removed), "removed_absent_from_served": sum(1 for l in removed if l not in s), }) for r in rows: print(json.dumps(r, sort_keys=True)) full = [r for r in rows if "v2_added" in r and r["added_present_in_served"] == r["v2_added"] and r["removed_absent_from_served"] == r["v2_removed"]] print(json.dumps({"documents": len(rows), "served_equals_v1": sum(1 for r in rows if r.get("served_equals_v1")), "v2_change_fully_present": [r["path"] for r in full]}, sort_keys=True))