Files
EscapistsReintroduced/docs/evidence/playtest-refresh-2026-10-03-depot-mines/freeze.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

28 lines
2.2 KiB
Python

from pathlib import Path
import hashlib,json,shutil,sys
r=Path('/home/jakub/devel/escapistsrereintroduced');f=r/'.build/playtest-source-2026-10-03-depot-mines';b=Path('/tmp/erri-gameplay-root-1210');sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
sys.path.insert(0,str(r/'tools'));from source_manifest import addon_manifest
m=json.loads((r/'docs/evidence/native-2026-10-03-depot-mines/source-sha256.json').read_text());inputs=json.loads(Path('/tmp/erri-depot-mines-root-1116/suite-inputs.json').read_text());assert len(m)==423
assert all((r/n).is_file() and sha(r/n)==h for n,h in m.items())
review=json.loads(Path('/tmp/erri-playtest-review-1210/docs-review.json').read_text())
allowed={'docs/current-status.md','docs/ground-depot-loading.md','docs/infantry-resupply.md'}
assert all(n in allowed or ((r/n).is_file() and sha(r/n)==h) for n,h in inputs.items())
assert not f.exists();f.mkdir()
for n in m:
p=f/n;p.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(r/n,p)
# Reuse only an unchanged historical resource cache with this same authored file inventory.
cache=r/'.build/playtest-source-2026-10-03-ground-supply/addons/core'
for p in cache.glob('resourceDatabase.rdb*'):shutil.copyfile(p,f/'addons/core'/p.name)
for n in inputs:
if n in m:continue
p=f/n;p.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(r/n,p)
(f/'docs/evidence').symlink_to(r/'docs/evidence',target_is_directory=True)
(f/'frozen-source.json').write_text(json.dumps(m,indent=2)+'\n');assert addon_manifest(f)==m
(b/'frozen-source.json').write_text(json.dumps(m,indent=2)+'\n')
live=addon_manifest(r);excluded={n:h for n,h in live.items() if n not in m}
for folder in ['tests','tools']:
for p in (r/folder).rglob('*'):
if p.is_file() and '__pycache__' not in p.parts and p.suffix!='.pyc' and str(p.relative_to(r)) not in inputs:excluded[str(p.relative_to(r))]=sha(p)
(b/'excluded-live-additions.json').write_text(json.dumps({'scope':'Observed concurrent additions preserved live and excluded from exact validated frozen snapshot; hashes are observations, not qualification or a promise they remain unchanged.','files':excluded},indent=2)+'\n')
print('Frozen exact validated authored source files:',len(m));print('Excluded concurrent later additions:',json.dumps(excluded,indent=2))