Files
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
7.9 KiB
Python

from pathlib import Path
import argparse
_args=argparse.ArgumentParser();_args.add_argument("--runner-log",type=Path);_args=_args.parse_args()
import ast
_tree=ast.parse(Path('/home/jakub/devel/escapistsrereintroduced/.build/playtest-source-2026-10-03-crash-start/tools/check.py').read_text())
REGRESSION_PROGRAMS=len([n.value for n in ast.walk(_tree) if isinstance(n,ast.Constant) and isinstance(n.value,str) and n.value.endswith('.py') and (n.value.split('/')[-1].startswith('test_') or n.value.endswith('_regression.py'))])
import hashlib,json,re,shutil,sys
r=Path('/home/jakub/devel/escapistsrereintroduced');f=Path('/home/jakub/devel/escapistsrereintroduced/.build/playtest-source-2026-10-03-crash-start');sys.path.insert(0,str(f/'tools'))
from packed_external import inventory,evidence
import headless_game
def digest(p):return hashlib.sha256(p.read_bytes()).hexdigest()
def write(p,v):p.write_text(json.dumps(v,indent=2)+'\n')
build=r/'.build/playtest-2026-10-03-crash-start';startup=Path('/tmp/erri-packed-chat-crash-start-2020')
pe=r/'docs/evidence/package-2026-10-03-crash-start';se=r/'docs/evidence/packed-2026-10-03-crash-start'
runner=json.loads((startup/'packed-runner.json').read_text());report=json.loads((startup/'packed-startup-report.json').read_text());manifest=json.loads((startup/'packed-input-provenance.json').read_text())
assert manifest['schema_version']==4 and manifest['kind']=='packed-chat-external-runtime-input'
assert manifest['project']=='chat' and manifest['addon_order']==['core']
assert runner['cleanup_confirmed'] and runner['packed_inputs_unchanged_after_run'] and runner['packed_external_inputs_unchanged_after_run']
assert runner['packed_input_error'] is None and runner['runner_error'] is None
assert runner['packed_input_provenance_sha256']==digest(startup/'packed-input-provenance.json')
assert runner['packed_launch_id']==manifest['launch_id']
assert manifest['captured_unix']<=runner['started_unix']<=runner['stopped_unix']
assert runner['display']=='headless Gamescope' and runner['audio']=='-noSound plus own silent sink'
assert runner['result']=='game-failed'
assert runner['failure_observed_during_polling'] and not runner['packed_consumption_verified']
logs=Path(runner['session']);assert logs.resolve().is_relative_to(startup.resolve()) and logs.is_dir()
assert digest(logs/'console.log')==runner['console_sha256']
assert (logs/'packed-input-provenance.json').read_bytes()==(startup/'packed-input-provenance.json').read_bytes()
assert (logs/'runner.json').read_bytes()==(startup/'packed-runner.json').read_bytes()
assert (logs/'game-startup-report.json').read_bytes()==(startup/'packed-startup-report.json').read_bytes()
packed={'input':Path(manifest['runtime_directory']),'external_records':manifest['external_addons'],'external_names':manifest['external_project_names']}
steam=Path(runner['executable']).parents[3]
recomputed=evidence((logs/'console.log').read_text(),packed,steam,Path(manifest['profile']),headless_game)
for k,v in recomputed.items():assert report[k]==v,(k,report[k],v)
assert report['normal_mission_ready'] and report['local_participant_verified'] and report['packed_loaded_paths_verified'] and report['packed_normal_modules']
assert report['workbench_undefined'] and not report['unexpected_smoke_fixture'] and not report['script_or_runtime_failures'] and not report['packed_input_violations']
assert report['packed_schema_version']==4 and report['external_addon_count']==7 and len(report['engine_errors'])==17
old=json.loads((r/'docs/evidence/packed-2026-10-03-depot-mines/packed-startup-report.json').read_text())
normal=lambda rows:sorted(re.sub(r'\s+',' ',re.sub(r'^\d\d:\d\d:\d\d\.\d+\s*','',x)).strip() for x in rows)
assert normal(report['engine_errors'])==normal(old['engine_errors']),'Different installed error set'
runtime=inventory(build/'packages');assert runtime==inventory(startup/'input/addons')==manifest['artifacts']
assert runtime==json.loads((build/'handoff.json').read_text())['runtime_files']
from source_bundle import inventory as source_inventory
assert source_inventory(f)==json.loads((r/'docs/evidence/native-2026-10-03-crash-prison-default/source-sha256.json').read_text())
assert 'All repository checks passed.' in Path('/home/jakub/devel/escapistsrereintroduced/docs/evidence/crash-start-2026-10-03/validation/full-suite.log').read_text()
suite_result=json.loads(Path('/home/jakub/devel/escapistsrereintroduced/docs/evidence/crash-start-2026-10-03/validation/suite-result.json').read_text())
suite_inputs=json.loads(Path('/home/jakub/devel/escapistsrereintroduced/docs/evidence/crash-start-2026-10-03/validation/suite-inputs.json').read_text())
assert suite_result['exit']==0 and suite_result['inputs_unchanged']
assert not suite_result.get('resumed'), 'Requires the original complete suite, not resumed or split verification; reviewed prose-only reuse is checked below'
assert suite_result['regression_programs']==REGRESSION_PROGRAMS==len(suite_result['programs'])
assert len({p['path'] for p in suite_result['programs']})==REGRESSION_PROGRAMS
assert all(p['exit']==0 for p in suite_result['programs'])
authored=json.loads((pe/'authored-before.json').read_text())
assert all(suite_inputs.get(n)==h for n,h in authored.items())
from suite_binding import verify_suite_binding
suite_binding=verify_suite_binding(f, Path('/home/jakub/devel/escapistsrereintroduced/docs/evidence/crash-start-2026-10-03/validation'), authored)
if _args.runner_log: assert _args.runner_log.is_file()
se.mkdir(exist_ok=False)
for name in ['packed-runner.json','packed-startup-report.json','packed-input-provenance.json','external-addons-inputs.json','external-addons-policy.json']:shutil.copyfile(startup/name,se/name)
for p in logs.iterdir():
if p.is_file() and p.suffix in ('.log','.json'):shutil.copyfile(p,se/(p.name+'.txt' if p.suffix=='.log' else p.name))
if _args.runner_log: shutil.copyfile(_args.runner_log,se/'runner-output.log.txt')
shutil.copyfile(__file__,se/'verify-and-finish.py')
shutil.copyfile(Path(__file__).with_name('suite_binding.py'),se/'suite_binding.py')
shutil.copyfile(Path(__file__).with_name('binding-inputs.json'),se/'binding-inputs.json')
shutil.copyfile(Path('/home/jakub/devel/escapistsrereintroduced/docs/evidence/crash-start-2026-10-03/validation/full-suite.log'),pe/'repository-check.log.txt')
for name in ['suite-inputs.json','suite-result.json']:
shutil.copyfile(Path('/home/jakub/devel/escapistsrereintroduced/docs/evidence/crash-start-2026-10-03/validation')/name,pe/name)
review=json.loads((build/'handoff.json').read_text());review.update(normal_mission_ready=True,local_participant_verified=True,strict_packed_consumption_verified=False,packed_script_failures=0,packed_resource_errors=17,repository_check_exit=0,repository_regression_programs=REGRESSION_PROGRAMS,repository_check_reused_for_identical_source=True,suite_reuse_binding=suite_binding,qualification_source_root=str(f),qualification_source_is_frozen_snapshot=True,live_source_match_not_claimed=True)
assert not review['release_qualified'] and not review['published']
for p in [build/'handoff.json',pe/'handoff.json']:write(p,review)
write(se/'archive-review.json',{'runtime_bytes_match_handoff':True,'copied_runtime_bytes_match_launch_manifest':True,'raw_console_sha256_verified':True,'launch_manifest_hash_and_uuid_verified':True,'native_and_root_reports_identical':True,'normal_modules_and_ten_mounts_recomputed_from_raw_console':True,'local_prisoner_verified':True,'known_resource_error_set_matches_previous_handoff':True,'cleanup_confirmed':True,'source_qualification':'Packed-only startup; source binding established separately by handoff manifest, not asserted by runner','strict_failure_retained':True,'archive_method':'archive_packed.py supports schemas 1 and 2 only; this schema 4 archive uses the explicit verifier and retained raw files.'})
write(se/'archive-sha256.json',{str(p.relative_to(se)):digest(p) for p in sorted(se.iterdir()) if p.is_file()})
print('Verified and retained packed startup, exact runtime bytes and full regression log. Strict failure preserved.')