#!/usr/bin/env python3 """build-payload-2978.py -- the payload for the triage of route 151 (job 2978, attempt 00832421...). An EXPLORE return on an ASSIGNED route, carrying attempt_id + job_id and `research: {route_id: 151, outcome: promising, ...}`. Gates (refuses to build otherwise): * the checker PASSES against the ATTACHED survey: supremum run 309, the top row is the rung-307 certificate with run [-2,306], second best 291, and NO row reaches 310 -- with its three controls detected; * `run-supremacy.json` still carries that verdict and its own controls; * evidence_md and prior_art_md are within the 4000-char cap, and `research.next_step` passes the tool's own shape validator; * the transcript is THIS turn's cut, and it is honestly the OPEN-turn cut: the harness holds only the person's assignment message for seq 898+, so the payload must say so and the usage is recorded as pending AFTER filing (`sahtool pending`), never estimated; * no credential body window survives in the transcript (credguard floor 3) and no `sah_`-form is a prefix of the live credential body. python3 build-payload-2978.py --check # gates and hashes, writes nothing python3 build-payload-2978.py # writes job2978/payload-2978.json """ import hashlib import io import json import os import re import subprocess import sys HERE = os.path.dirname(os.path.abspath(__file__)) RUN = os.path.dirname(HERE) ROOT = os.path.abspath(os.path.join(RUN, "..", "..", "..", "..")) V1 = os.path.join(os.environ.get("LOCALAPPDATA", ""), "solveathome", "tools", "v1") CREDGUARD = os.path.join(os.environ.get("LOCALAPPDATA", ""), "solveathome", "tools", "credguard", "v1", "credguard.py") sys.path.insert(0, V1) import sahtool # noqa: E402 TRANSCRIPT = "transcript-2978-turn.jsonl" ARTIFACTS = ["report-2978.md", "evidence_md.txt", "prior_art_md.txt", "run-supremacy.py", "run-supremacy.json", "verify-run-supremacy.py", "verify-run-supremacy.json", "witness-runs.json", "route151.txt", "boundary-2978.py", "boundary-2978.json", TRANSCRIPT, "build-payload-2978.py"] EVIDENCE_MD = io.open(os.path.join(HERE, "evidence_md.txt"), encoding="utf-8").read().strip() PRIOR_ART_MD = io.open(os.path.join(HERE, "prior_art_md.txt"), encoding="utf-8").read().strip() NEXT_STEP = { "question": ("Does a covering of [0,309] exist on 83# -- is there a certificate whose COVERED RUN " "is at least 310 positions, one more than the best run the record holds (309)?"), "method": ("1. Run the early-abort build's witness search at the next rung with the acceptance test " "stated on the covered run length (>= 310), stopping at the first witness; the rung's " "printed prefix is not the decidable quantity. 2. Re-verify the covering with " "verify-R307-independent.py re-pointed at the new certificate. 3. Report the wall/CPU " "cost and the run lengths seen. Do NOT price in a seed from the R = 307 certificate: a " "witness is not a demonstrated starting point for the next rung's search, and that " "clause of the route's next step is an unevidenced cost assumption. If the run is " "aborted, record a measurement of a truncated run, never a refutation: `aborted` is not " "`exhausted`. The measured requirement is ~32+ CPU h (the R = 307 witness was in hand at " "t = 14,454 s of the rung on 8 threads), so budget_hours below is the schema cap, not " "the measured cost."), "success": ("An independently verified covering of [0,309]: R = 310 is COVERABLE, the banked bound " "moves 1859 -> 1865 under the route's own map A = 6L + 5, and the first open decision " "moves up one rung."), "failure": ("No witness with a covered run >= 310 within the priced budget: R = 310 stays open, " "recorded as a measurement of a truncated run and not as a refutation."), "budget_hours": 4.0, "compute": {"cpu_hours": 4, "ram_gb": 2, "disk_gb": 1}, "required_tools": ["python", "cc"], "required_sources": [], } def sha(p): return hashlib.sha256(open(p, "rb").read()).hexdigest() def main(): check = "--check" in sys.argv bad = [] for a in ARTIFACTS: if not os.path.exists(os.path.join(HERE, a)): bad.append("missing artifact %s" % a) if bad: print(json.dumps({"PROBLEMS": bad}, indent=1)) return 2 # 1. the checker PASSES against the attached survey, offline p = subprocess.run([sys.executable, os.path.join(HERE, "verify-run-supremacy.py"), "--input", os.path.join(HERE, "witness-runs.json"), "--target", "310"], capture_output=True, text=True, cwd=HERE, env=dict(os.environ, PYTHONIOENCODING="utf-8")) try: verdict = json.loads(p.stdout) except Exception: # noqa: BLE001 verdict = {"verdict": "UNPARSABLE", "stdout": p.stdout[-300:], "stderr": p.stderr[-300:]} if p.returncode != 0 or verdict.get("verdict") != "PASS": bad.append("the checker does not PASS (rc=%s): %s" % (p.returncode, verdict.get("differences") or verdict.get("stdout"))) if not verdict.get("controls_all_detected"): bad.append("the checker's controls were not all detected") d = verdict.get("derived") or {} if (d.get("supremum_run"), d.get("second_run"), d.get("rows_reaching_target")) != (309, 291, 0): bad.append("the survey moved: %s" % json.dumps(d)) # 2. the measurement JSON still says what the return says sup = json.load(io.open(os.path.join(HERE, "run-supremacy.json"), encoding="utf-8")) if not sup.get("verdict", "").startswith("NO RECORDED WITNESS DECIDES R = 310"): bad.append("run-supremacy verdict moved: %r" % sup.get("verdict")) if (sup.get("supremum") or {}).get("run_len") != 309 or sup.get("rows_reaching_target"): bad.append("run-supremacy supremum/reach moved") if not sup.get("controls_all_detected"): bad.append("run-supremacy controls not all detected") if sup.get("free_bound_from_supremum") != 1859 or sup.get("free_bound_at_target") != 1865: bad.append("the free/target bounds moved: %s / %s" % (sup.get("free_bound_from_supremum"), sup.get("free_bound_at_target"))) # 3. the transcript: the honest OPEN-turn cut txt = io.open(os.path.join(HERE, TRANSCRIPT), encoding="utf-8").read() lines = txt.splitlines() # the open-turn cut of seq 898+ is exactly the thread header and the person's message: the # harness writes an open turn's assistant rows only when the turn closes (measured 2026-09-24) if (len(lines) != 2 or "solveathome.transcript" not in lines[0] or "Take next assignement" not in lines[1] or '"role": "user"' not in lines[1]): bad.append("the transcript is not the open-turn cut of this assignment (%d lines)" % len(lines)) q = subprocess.run([sys.executable, CREDGUARD, "scan", "--in", os.path.join(HERE, TRANSCRIPT), "--token-file", os.path.join(RUN, ".sah"), "--json"], capture_output=True, text=True, cwd=HERE, env=dict(os.environ, PYTHONIOENCODING="utf-8")) if q.returncode != 0: bad.append("credguard finds body windows in the transcript") body = io.open(os.path.join(RUN, ".sah"), encoding="utf-8").read().strip().split("_", 1)[-1] for m in re.finditer(r"sah_([A-Za-z0-9_-]+)", txt): if body.startswith(m.group(1)): bad.append("the transcript carries a credential body prefix (length %d)" % len(m.group(1))) # 4. the prose and the shapes shape = sahtool.validate_research_shape({"next_step": NEXT_STEP}) bad.extend(shape) if not 0 < len(EVIDENCE_MD) <= 4000: bad.append("evidence_md is %d chars" % len(EVIDENCE_MD)) if not 0 < len(PRIOR_ART_MD) <= 4000: bad.append("prior_art_md is %d chars" % len(PRIOR_ART_MD)) report = io.open(os.path.join(HERE, "report-2978.md"), encoding="utf-8").read() for frag in ("151", "309", "310", "1859", "1865", "measured", "OPEN at filing time", "403"): if frag not in report: bad.append("the report does not carry %r" % frag) print("gates: checker %s (supremum %s, second %s, reach %s, controls %s); supremacy verdict %r; " "transcript %d lines, credguard rc %s; evidence_md %d, prior_art %d, report %d chars" % (verdict.get("verdict"), d.get("supremum_run"), d.get("second_run"), d.get("rows_reaching_target"), verdict.get("controls_all_detected"), sup.get("verdict"), len(lines), q.returncode, len(EVIDENCE_MD), len(PRIOR_ART_MD), len(report))) files = ["%s/job2978/%s" % (os.path.relpath(RUN, ROOT).replace(os.sep, "/"), a) for a in ARTIFACTS] hashes = {os.path.basename(f): sha(os.path.join(ROOT, f)) for f in files} if check: print(json.dumps(hashes, indent=1, sort_keys=True)) print("PROBLEMS: %s" % bad if bad else "checks clean") return 2 if bad else 0 if bad: print("PROBLEMS: %s" % json.dumps(bad, indent=1)) return 2 plan = { "schema_version": 1, "tools": ["python3"], "manifest": [ {"path": "verify-run-supremacy.py", "sha256": hashes["verify-run-supremacy.py"], "role": "checker"}, {"path": "witness-runs.json", "sha256": hashes["witness-runs.json"], "role": "target"}, {"path": "run-supremacy.json", "sha256": hashes["run-supremacy.json"], "role": "target"}, {"path": "run-supremacy.py", "sha256": hashes["run-supremacy.py"], "role": "input"}, ], "targets": ["witness-runs.json", "run-supremacy.json"], "claim": ("Over the 22 witness certificates the corpus recorded (the survey served by return " "#1569), the longest COVERED RUN is 309 positions, achieved by exactly one row -- the " "return #1554 certificate at rung 307, covering [-2,306] -- and no row reaches 310. " "Because a run of L positions translates to a certificate at prefix L, the record's " "own best translate covers [0,308] (A >= 6*309+5 = 1859) and stops one position short " "of the target: no recorded witness decides R = 310, and deciding it would lift the " "bound to 6*310+5 = 1865."), "scope": ("the 22 rows of the attached survey, which is every witness certificate the corpus " "recorded at the time the survey was taken. Nothing outside those rows is examined, " "no search is run, and no statement is made about witness certificates that do not " "exist in the record."), "assumptions": ("a witness's covered run translates freely to the origin (a_p ranges over all " "residues mod p, so translating every class translates the covered set), and " "the route's own map A = 6R+5 is used for the bound -- the same map the route " "and return #1569 use. The survey's run values are readings of recorded " "certificates, which is why this return is graded `measured`."), "checker": hashes["verify-run-supremacy.py"], "inputs": [hashes["witness-runs.json"], hashes["run-supremacy.py"]], "environment": ("python3 (%s), standard library only, no network and no credential: the checker " "reads the attached survey and nothing else." % sys.version.split()[0]), "command": "python3 verify-run-supremacy.py --input witness-runs.json --target 310", "expected": ("exit 0, `verdict` PASS, `differences` empty, `controls_all_detected` true: 22 " "usable rows, supremum run 309 on the rung-307 row with run_lo -2 / run_hi 306, " "second run 291, zero rows reaching the target, free bound 1859. Exit 3 if a " "control is not detected; exit 2 on any other difference."), "supports": ("establishes that the RECORD cannot decide R = 310, which is what makes the " "proposed ascent run non-redundant, and that the decidable quantity is the covered " "run rather than the printed prefix. It does NOT establish anything about R = 310 " "itself: a covering of [0,309] may exist and simply not be in the record."), "coverage": "decisive", "coverage_md": ("all 22 recorded witness rows, each with its run bounds; the supremum, the " "runner-up, the cliff below it and the count of rows reaching the target. " "Excluded: any run not in the record, the mathematical content of the " "certificates, and the price of a future search."), "comparison": ("exact integer equality of the supremal run length (309), of the second (291) and " "of the top row's endpoints (-2, 306); set emptiness for rows reaching 310. No " "tolerance is used."), "availability": {"status": "complete", "details": ("the checker, the survey it reads and the measurement are all " "attached; the check needs only python3 and runs in under a " "second"), "required_sources": [], "network": False}, "cost": {"minutes": 1, "judgment_minutes": 10, "cpu_hours": 0.01, "ram_gb": 1, "disk_gb": 1}, } payload = { "type": "explore", "job_id": 2978, "attempt_id": "00832421a76775c97e07b5f3ff0cd980", "author_rung": "measured", "cpu_hours": 0.1, "report_md": report, "files": files, "hashes": hashes, "cites": {"returns": [1569, 1554, 1507], "messages": [], "files": [], "handles": []}, "research": { "route_id": 151, "outcome": "promising", "evidence_md": EVIDENCE_MD, "prior_art_md": PRIOR_ART_MD, "next_step": NEXT_STEP, "depends_on": [1569, 1554], }, "verification_plan": plan, "request_review": False, "transcript": txt, "transcript_approved": True, } out = os.path.join(HERE, "payload-2978.json") with io.open(out, "w", encoding="utf-8", newline="\n") as fh: json.dump(payload, fh, indent=1, sort_keys=True) fh.write("\n") print("wrote %s (%d bytes), %d files" % (out, os.path.getsize(out), len(files))) return 0 if __name__ == "__main__": sys.exit(main())