Files
EscapistsReintroduced/docs/evidence/playtest-refresh-2026-10-03-mine-safety/preparation/adapt.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

43 lines
7.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from pathlib import Path
import json,hashlib,ast,shlex
old=Path('/tmp/erri-package-prep-0150');out=Path('/tmp/erri-package-prep-0644');root=Path('/home/jakub/devel/escapistsrereintroduced')
replacements=[('playtest-source-2026-10-03-mounted-pair','playtest-source-2026-10-03-mine-safety'),('playtest-2026-10-03-mounted-pair','playtest-2026-10-03-mine-safety'),('erri-package-mounted-pair-0150','erri-package-mine-safety-0644'),('erri-playtest-source-20261003-mounted-pair.zip','erri-playtest-source-20261003-mine-safety.zip'),('erri-packed-chat-mounted-pair-0150','erri-packed-chat-mine-safety-0644'),('package-2026-10-03-mounted-pair','package-2026-10-03-mine-safety'),('native-2026-10-03-mounted-pair-normal','native-2026-10-03-engineer-movement'),('packed-2026-10-03-mounted-pair','packed-2026-10-03-mine-safety'),('erri-gameplay-root-0150/package.log','erri-gameplay-root-0644/package.log'),('erri-gameplay-root-0150','erri-gameplay-root-0558'),('erri-playtest-review-0150','erri-playtest-review-0644'),('erri-package-prep-0150','erri-package-prep-0644')]
def adapt(s):
for a,b in replacements:s=s.replace(a,b)
return s
for name in ['assemble.py','preflight.py','verify.py','finalize_docs.py','config.json','commands.json']:
s=adapt((old/name).read_text())
if name=='finalize_docs.py':
s=s.replace("s/'frozen-source.json'", "f/'frozen-source.json'")
s=s.replace("inclusion='This snapshot adds event-time capture cancellation for original active hunter vehicles, the current inherited terrain presentation, and paired radio interception by two original convoy escorts. Both real order receipts precede detours; finite forces, crew identities, stock and fixed deadlines are preserved. Earlier convoy-survivor, radio interruption and finite-transfer corrections remain included.'", "inclusion='This snapshot adds engineer mine flanks with at least 15 m clearance from nearby road centerlines and more than 200 m from named settlements. Mine dispatch also respects the group’s current native movement envelope before starting and throughout the job. Original items, fixed deadlines and cancellation quarantine remain intact. Earlier paired interception, finite supply and player-recovery changes remain included.'")
s=s.replace("limits='This is an **unqualified development candidate**. Native survivor radio delivery and physical retasking remain unverified, as do physical resupply/interception, complete human escape, real multiplayer/JIP/reconnect/twelve-player play, manual UI behavior, comparative FPS and a clean release. Qualification binds this frozen snapshot; later live edits are excluded. Earlier packages and original missions remain preserved.'", "limits='This is an **unqualified development candidate**. Native mine placement, arming and detonation, physical resupply/interception and survivor retasking remain unverified, as do complete human escape, real multiplayer/JIP/reconnect/twelve-player play, manual UI behavior, comparative FPS and a clean release. An intermittent zero-radius engine diagnostic remains unresolved; the opt-in trace preserves native behavior and is not a fix or proof of the caller. Qualification binds this frozen snapshot; later live edits are excluded. Earlier packages and original missions remain preserved.'")
s=s.replace('four later prose-only documentation updates are separately reviewed.', "{len(checks['suite_reuse_binding']['documentation_differences'])} later documentation-only differences are separately reviewed.")
s=s.replace('— mounted-pair development handoff:', '— mine-safety development handoff:')
s=s.replace("previous='**2 October 2026 — convoy-survivors development handoff:**'", "previous='**3 October 2026 — mounted-pair development handoff:**'")
s=s.replace('## Previous convoy-survivors handoff (historical)', '## Previous mounted-pair handoff (historical)')
s=s.replace('3 October mounted-pair snapshot', '3 October mine-safety snapshot').replace('# Mounted-pair development candidate', '# Mine-safety development candidate')
(out/name).write_text(s)
# Generic proof retains exact independent reviewed mismatch list rather than copying old four paths.
s=(old/'suite_binding.py').read_text();s=adapt(s)
s=s.replace('four independently reviewed prose deltas only','independently reviewed documentation-only deltas')
s=s.replace("ALLOWED={'docs/current-status.md','docs/mounted-interception.md','docs/original-feature-coverage.json','docs/original-feature-coverage.md'}\n",'')
s=s.replace("assert result['regression_programs']==294==len(result['programs']) and all(x['exit']==0 for x in result['programs'])", "assert result['regression_programs']==len(result['programs']) and all(x['exit']==0 for x in result['programs'])")
s=s.replace('len(set(registered))==294','len(set(registered))==result[\'regression_programs\']')
s=s.replace("assert {x['path'] for x in differences}==ALLOWED, differences", "assert all(x['path'].startswith('docs/') for x in differences), differences")
s=s.replace("binding['programs']==294", "binding['programs']==result['regression_programs']")
s=s.replace("'regression_programs':294", "'regression_programs':result['regression_programs']")
s=s.replace('with four reviewed prose-only deltas','with independently reviewed documentation-only deltas')
(out/'suite_binding.py').write_text(s)
# Pending scripts may read only these captured document versions, never overwrite a concurrent edit.
for n in ['README.md','docs/current-status.md','docs/playtest-build.md']:
p=out/'docs-baseline'/n;p.parent.mkdir(parents=True,exist_ok=True);assert not p.exists();p.write_bytes((root/n).read_bytes())
c=json.loads((out/'config.json').read_text());c['expected_authored_files']=422;c['expected_regression_programs']=299;c['normal_reuse_pending_independent_review']=True;(out/'config.json').write_text(json.dumps(c,indent=2)+'\n')
commands=json.loads((out/'commands.json').read_text())
for row in commands:
row['purpose']=row['purpose'].replace('four-doc prose delta','documentation-only delta')
commands.extend([{'purpose':'SCRATCH ONLY: preview documentation after freeze exists','argv':['python3',str(out/'finalize_docs.py')]},{'purpose':'FILES ONLY, ROOT: after final independent review, preview verified docs then repeat with --apply','argv':['python3',str(out/'finalize_docs.py'),'--verified','--review','/tmp/erri-playtest-review-0644/final-review.json','--review-sha256','REPLACE_WITH_REVIEWED_SHA256']}])
(out/'commands.json').write_text(json.dumps(commands,indent=2)+'\n');(out/'commands.txt').write_text('\n\n'.join('# '+x['purpose']+'\n'+shlex.join(x['argv']) for x in commands)+'\n')
for n in ['assemble.py','preflight.py','verify.py','suite_binding.py','finalize_docs.py']:ast.parse((out/n).read_text(),filename=n)
(out/'template-provenance.json').write_text(json.dumps({'templates':{n:hashlib.sha256((old/n).read_bytes()).hexdigest() for n in ['assemble.py','preflight.py','verify.py','suite_binding.py','finalize_docs.py','config.json','commands.json']},'template_root':str(old),'native_executed':False,'target_writes':False,'qualification':'Pending independent source/suite/normal reuse review and fresh package/packed evidence.'},indent=2)+'\n')
print('Prepared scratch helpers; AST parsing only; no target or native actions.')