57 lines
2.7 KiB
Python
57 lines
2.7 KiB
Python
"""Verify frozen report inputs and prior evidence without extracting PDF text."""
|
|
from pathlib import Path
|
|
import hashlib
|
|
import json
|
|
import subprocess
|
|
|
|
ROOT = Path(__file__).resolve().parents[4]
|
|
EVIDENCE = Path(__file__).resolve().parent
|
|
PRIOR = ROOT / "documents/assets/front-matter-lists-2026-11-24"
|
|
|
|
|
|
def digest(path):
|
|
return hashlib.sha256(path.read_bytes()).hexdigest()
|
|
|
|
|
|
def verify():
|
|
inputs = json.loads((PRIOR / "build-source-hashes.json").read_text(encoding="utf-8-sig"))
|
|
for relative, expected in inputs.items():
|
|
assert digest(ROOT / relative).lower() == expected.lower(), relative
|
|
protected = json.loads((PRIOR / "protected-hashes.json").read_text(encoding="utf-8-sig"))
|
|
for item in protected:
|
|
assert digest(Path(item["Path"])).lower() == item["Hash"].lower(), item["Path"]
|
|
prior = json.loads((PRIOR / "checks.json").read_text(encoding="utf-8-sig"))
|
|
pdfs = {}
|
|
for edition, name in (("submission", "TikZRefinery.pdf"),
|
|
("developer", "TikZRefinery-Developers-Edition.pdf")):
|
|
actual = digest(ROOT / "documents" / name)
|
|
assert actual == prior["pdfs"][edition]["sha256"], name
|
|
pdfs[name] = actual
|
|
tracked = set(subprocess.check_output(
|
|
["git", "ls-files", "-z"], cwd=ROOT).decode().rstrip("\0").split("\0"))
|
|
required = set(inputs)
|
|
required.update(p.relative_to(ROOT).as_posix()
|
|
for p in (ROOT / "code").rglob("*")
|
|
if p.is_file() and p.suffix in {".h", ".cpp"}
|
|
and any(p.is_relative_to(ROOT / "code" / name)
|
|
for name in ("src", "tests", "plugins", "plugin-api")))
|
|
# Include direct asset inputs to every active indexed figure.
|
|
index = json.loads((ROOT / "documents/diagram-index.json").read_text())
|
|
for figure in index["figures"]:
|
|
required.update(figure["assets"])
|
|
assert required <= tracked, sorted(required - tracked)
|
|
result = dict(date="2026-11-25", baseline="0.1.4-alpha",
|
|
reportInputsUnchanged=len(inputs), protectedFilesUnchanged=len(protected),
|
|
requiredInputsPresentInIndex=len(required), pdfs=pdfs,
|
|
applicationChecks={"freshReleaseBuild": True, "releaseSuitesPassed": 8,
|
|
"existingDebugBuild": True, "debugSuitesPassed": 8},
|
|
limits=["Windows only; no Linux/cloud build",
|
|
"No new package or native UI review",
|
|
"Prior complete report build and visual checks reused; PDFs unchanged"])
|
|
(EVIDENCE / "checks.json").write_text(json.dumps(result, indent=2) + "\n")
|
|
print(json.dumps(result, indent=2))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
verify()
|