Datasets:
Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
Tags:
mathematics
quantum-information
quantum-error-correction
schur-channels
semidefinite-programming
research-artifact
File size: 2,760 Bytes
1f85192 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #!/usr/bin/env python3
"""Verify this prepared release locally without network access or credentials."""
from __future__ import annotations
import ast
import hashlib
import json
import re
from pathlib import Path, PurePosixPath
ROOT = Path(__file__).resolve().parent
def main() -> None:
expected = {}
for line in (ROOT / "SHA256SUMS.txt").read_text(encoding="utf-8").splitlines():
match = re.fullmatch(r"([0-9a-f]{64}) (.+)", line)
if not match:
raise ValueError("Malformed checksum line")
digest, relative = match.groups()
path = PurePosixPath(relative)
if path.is_absolute() or ".." in path.parts or relative in expected:
raise ValueError("Unsafe or duplicate manifest entry")
data = (ROOT / relative).read_bytes()
if hashlib.sha256(data).hexdigest() != digest:
raise ValueError("Checksum mismatch: " + relative)
expected[relative] = digest
counts = {}
for report in sorted((ROOT / "results" / "recorded").glob("*.json")):
result = json.loads(report.read_text(encoding="utf-8"))
if not result["all_checks_passed"] or len(result["checks"]) != result["check_count"]:
raise ValueError("Inconsistent recorded report: " + report.name)
counts[report.name] = result["check_count"]
records = [json.loads(line) for line in (ROOT / "data" / "verification_cases.jsonl")
.read_text(encoding="utf-8").splitlines()]
fields = {"case_id", "suite", "kind", "case_name", "passed", "tolerance", "source_report", "details_json"}
if len(records) != 157 or sum(counts.values()) != 157:
raise ValueError("Unexpected verification count")
if len({row["case_id"] for row in records}) != len(records):
raise ValueError("Duplicate case identifier")
for row in records:
if set(row) != fields or not row["passed"]:
raise ValueError("Unexpected verification row schema/status")
json.loads(row["details_json"])
for script in (ROOT / "code").glob("*.py"):
ast.parse(script.read_text(encoding="utf-8"), filename=str(script))
provenance = json.loads((ROOT / "release" / "SOURCE_SHA256.json").read_text())
for relative, digest in provenance.items():
if hashlib.sha256((ROOT / relative).read_bytes()).hexdigest() != digest:
raise ValueError("Original research bytes changed: " + relative)
print(json.dumps({"status": "PASS", "checked_files": len(expected),
"recorded_cases": len(records), "suite_counts": counts,
"original_research_files_preserved": len(provenance),
"network_access_used": False}, indent=2))
if __name__ == "__main__":
main()
|