Files
EscapistsReintroduced/docs/evidence/hq-search-radius-2026-10-03/validation/finalize.py
T
jakub 6a667d8deb Capture current mission, AI, map and administration development
Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
2026-10-13 22:52:53 +02:00

19 lines
1.8 KiB
Python

from pathlib import Path
import hashlib,json,subprocess
R=Path('/home/jakub/devel/escapistsrereintroduced');B=Path('/tmp/erri-gameplay-root-1611');E=R/'docs/evidence/hq-search-radius-2026-10-03'
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
M=E/'artifact-sha256.json';files=json.loads(M.read_text())
assert {str(p.relative_to(E)) for p in E.rglob('*') if p.is_file()}==set(files)|{'artifact-sha256.json'}
for name,h in files.items():assert sha(E/name)==h,name
D=json.loads((B/'docs-manifest.json').read_text());inputs=json.loads((B/'suite-inputs.json').read_text())
for name,h in inputs.items():assert sha(R/name)==(D[name]['after'] if name in D else h),name
index=hashlib.sha256(subprocess.check_output(['git','diff','--cached','--binary'],cwd=R)).hexdigest()
assert index==json.loads((B/'baseline.json').read_text())['index_sha256']
report={'complete':True,'suite_programs':305,'source_unchanged_since_suite':True,'prose_changes':list(D),'staged_diff_sha256':index,'archive_helper_note':'Initial helper successfully copied and sealed evidence and applied two guarded prose updates, then compared the raw index-file hash with the baseline hash of git diff --cached --binary. This final assertion failed due to different representations. This verification uses the same staged-diff representation as the baseline; contents are unchanged. Original helper retained in validation/archive.py.'}
(E/'validation/finalize.py').write_bytes(Path(__file__).read_bytes())
(E/'validation/finalization.json').write_text(json.dumps(report,indent=2)+'\n')
for name in ['validation/finalize.py','validation/finalization.json']:files[name]=sha(E/name)
M.write_text(json.dumps(files,indent=2)+'\n')
for name,h in files.items():assert sha(E/name)==h,name
print(json.dumps({'complete':True,'sealed_files':len(files),'programs':305,'staged_diff_unchanged':True}))