Files
EscapistsReintroduced/docs/evidence/playtest-refresh-2026-10-04-ui-bmp/finish.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

77 lines
8.8 KiB
Python

"""Final guarded documentation/seal step. Run only after independent review."""
from pathlib import Path
import hashlib,json,shutil,subprocess,sys
R=Path('/home/jakub/devel/escapistsrereintroduced');B=Path(__file__).parent;C=R/'.build/playtest-2026-10-04-ui-bmp';F=R/'.build/playtest-source-2026-10-04-ui-bmp';E=R/'docs/evidence/playtest-refresh-2026-10-04-ui-bmp';N=R/'docs/evidence/native-2026-10-04-ui-bmp-normal-route'
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest();load=lambda p:json.loads(p.read_text());write=lambda p,v:p.write_text(json.dumps(v,indent=2)+'\n')
def tree(p):return {str(q.relative_to(p)):sha(q) for q in sorted(p.rglob('*')) if q.is_file()}
sys.path.insert(0,str(F/'tools'))
from source_manifest import addon_manifest
from packed_external import inventory
from suite_binding import verify_suite_binding
review_path=B/'independent-review.json';approval_path=B/'approved-review-sha256.txt'
approved_review_sha256=approval_path.read_text().strip()
assert len(approved_review_sha256)==64 and all(c in '0123456789abcdef' for c in approved_review_sha256)
review_bytes=review_path.read_bytes()
assert hashlib.sha256(review_bytes).hexdigest()==approved_review_sha256, 'Independent review lacks exact parent approval'
review=json.loads(review_bytes)
assert review['complete'] is True and review['candidate']==str(C)
reviewed_candidate=review['candidate_files']
assert isinstance(reviewed_candidate,dict) and reviewed_candidate
assert {'README.md','handoff.json','source.zip','packages/core/addon.gproj','packages/core/data.pak','packages/core/resourceDatabase.rdb'}<=set(reviewed_candidate)
assert any(n.startswith('source/') for n in reviewed_candidate)
assert not C.is_symlink() and not any(q.is_symlink() for q in C.rglob('*')), 'Candidate symlinks are not reviewed files'
assert tree(C)==reviewed_candidate, 'Candidate changed after independent review'
base=load(B/'baseline.json');h=load(C/'handoff.json');route=load(N/'report.json')
assert addon_manifest(R)==addon_manifest(F)==base['authored']
binding=verify_suite_binding(F,Path('/tmp/erri-native-root-20261004'),base['authored'])
assert h['authored_files']==len(base['authored']) and len(h['runtime_files'])==3
assert inventory(C/'packages')==h['runtime_files'] and sha(C/'source.zip')==h['source_zip_sha256']
assert h['normal_mission_ready'] and h['local_participant_verified'] and h['repository_regression_programs']==binding['regression_programs']
assert h['packed_script_failures']==0 and not h['release_qualified'] and not h['published']
for n,v in base['files'].items():assert sha(R/n)==v,n
assert hashlib.sha256(subprocess.check_output(['git','diff','--cached','--binary'],cwd=R)).hexdigest()==base['staged_diff_sha256']
original=load(Path('/tmp/erri-heartbeat-20260930-1542-reference.json'));assert all(sha(Path('/home/jakub/devel/escapists')/n)==v for n,v in original.items())
prior={}
for label in ['crash-start','depot-mines','ground-supply','mine-safety','mounted-pair']:
p=R/f'docs/evidence/playtest-refresh-2026-10-03-{label}/candidate-sha256.json';manifest=load(p)
assert tree(R/f'.build/playtest-2026-10-03-{label}')==manifest,label
prior[label]={'files':len(manifest),'manifest_sha256':sha(p)}
assert not E.exists() and not E.is_symlink()
a=h['authored_files'];payload=h['pak_payload_files'];programs=h['repository_regression_programs'];passed=route['assertions_passed'];rounds=route['smoke_completions'];errors=len(route['engine_errors']);packed_errors=h['packed_resource_errors']
summary=f'''The combined addon includes the inventory hit-zone callback correction and mounted BMP ammunition-accounting corrections, alongside selectable static crash starts and the existing finite base escape loop. Prison remains the default. **{a} authored files, {payload} exact PAK payloads and 3 runtime files** match the handoff. The exact code/tests/tools bind to the completed **{programs}-program regression pass**, with any later checkpoint prose changes recorded separately. The exact-source normal escape completes **{passed} assertions and {rounds} completion**, with zero script/runtime failures and **{errors} retained engine errors**. Ordinary startup of these exact runtime bytes reaches the normal mission and local prisoner with zero script/runtime failures and **{packed_errors} retained engine errors**.
This is an **unqualified development candidate**. Strict packaging/startup failures remain recorded. Synthetic inventory notifications and bounded BMP inventory/status diagnostics do not establish natural-injury/manual UI behavior, physical interception, human escape, multiplayer/JIP/reconnect, comparative FPS or clean release acceptance. Existing missions and all five prior sealed candidates remain unchanged. No installed runtime is replaced and nothing is published.'''
readme=f'''# UI and BMP development candidate — 4 October 2026
{summary}
Open `source/addons/core/addon.gproj` in Workbench and select `Missions/ERR_Everon.conf`. Runtime files are under `packages/core/`; editable source is in `source/` and `source.zip`. Install audited RHS, WCS Armaments, WCS BMP-1 and Parachute Framework dependencies separately; their payloads are not bundled. Ordinary play needs no diagnostic, smoke, input or flight flags. `/esc mission start set prison` or `/esc mission start set crash` selects the next round.
See [handoff manifest](handoff.json), [start controls](../../docs/mission-starts.md), [player route](../../docs/player-route.md), and [evidence](../../docs/evidence/playtest-refresh-2026-10-04-ui-bmp/README.md).
'''
paragraph='**4 October 2026 — refreshed UI/BMP development handoff:** [package and editable source](../.build/playtest-2026-10-04-ui-bmp/README.md).\n\n'+summary+'\n\n'
updates={}
for n in ['docs/current-status.md','docs/playtest-build.md']:
old=(R/n).read_text();first,rest=old.split('\n',1);updates[n]=first+'\n\n'+paragraph+rest.lstrip('\n')
n='README.md';old=(R/n).read_text();anchor='The [latest development playtest handoff]';assert old.count(anchor)==1;start=old.index(anchor);end=old.index('\n\n',start)
updates[n]=old[:start]+f'The [latest development playtest handoff](.build/playtest-2026-10-04-ui-bmp/README.md) includes the inventory callback and BMP ammunition-accounting corrections. Its {a} authored files match {payload} PAK payloads and three runtime files. The code/tests/tools bind to {programs} passing regression programs; exact-source normal escape and ordinary packaged startup complete with retained engine errors. It remains an **unqualified development candidate**. Existing missions and prior packages are preserved. See [current status](docs/current-status.md) for exact scope and limits.'+old[end:]
records={n:{'before_sha256':sha(R/n),'after_sha256':hashlib.sha256(t.encode()).hexdigest()} for n,t in updates.items()}
# Recheck exact approved evidence and every candidate file immediately before writes.
assert sha(review_path)==approved_review_sha256 and approval_path.read_text().strip()==approved_review_sha256
assert not C.is_symlink() and not any(q.is_symlink() for q in C.rglob('*'))
assert tree(C)==reviewed_candidate, 'Candidate changed before finalization'
# All validation above precedes mutation; destination must be new.
E.mkdir();(C/'README.md').write_text(readme)
for n,t in updates.items():assert sha(R/n)==base['files'][n];(R/n).write_text(t)
for p in B.iterdir():
if p.is_file():shutil.copyfile(p,E/p.name)
final_candidate=tree(C)
assert final_candidate==dict(reviewed_candidate, **{'README.md':hashlib.sha256(readme.encode()).hexdigest()}), 'Unexpected candidate finalization delta'
write(E/'candidate-reviewed-sha256.json',reviewed_candidate)
write(E/'candidate-sha256.json',final_candidate);write(E/'documentation-updates.json',records)
write(E/'review.json',{'complete':True,'candidate':str(C),'authored_files':a,'pak_payload_files':payload,'regression_programs':programs,'frozen_source':str(F),'suite_reuse_binding':binding,'strict_failures_retained':True,'release_qualified':False,'published':False,'original_reference_files_preserved':len(original),'previous_candidates_preserved':prior,'source_snapshot_matches_live_at_handoff':True,'documentation_updates':records,'independent_review_sha256':approved_review_sha256,'reviewed_candidate_manifest':'candidate-reviewed-sha256.json'})
(E/'README.md').write_text('# UI/BMP development handoff — 4 October 2026\n\n'+summary+'\n\nFull source/test/tool suite binding, native normal-route provenance, exact PAK/ZIP/runtime equality and ordinary-startup evidence are retained in the adjacent package/packed archives and handoff.json. Prior failed diagnostics remain in the separate ui-bmp-corrections checkpoint; no strict verdict is overwritten.\n')
write(E/'evidence-sha256.json',tree(E))
for n,hsh in base['files'].items():assert sha(R/n)==records.get(n,{}).get('after_sha256',hsh),n
print(json.dumps({'candidate':str(C),'authored_files':a,'pak_payload_files':payload,'regression_programs':programs,'prior_candidates_preserved':prior,'release_qualified':False},indent=2))