from pathlib import Path import hashlib,json,importlib.util,shutil B=Path('/tmp/erri-gameplay-root-1509');R=Path('/home/jakub/devel/escapistsrereintroduced');D=R/'docs/evidence/config-supply-recovery-2026-10-03' sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest() r=json.loads((D/'review.json').read_text());assert not (D/'artifact-sha256.json').exists() assert len(r['archive_files'])==78 and all(sha(D/n)==h for n,h in r['archive_files'].items()) assert sha(D/'archive.py')=='ab8e51ac288a529ead61c498d6286d0e19b408cefaeaf42a609c2634c4f5813a' assert all(sha(R/n)==v['after'] for n,v in json.loads((B/'integration.json').read_text()).items()) recovery={'reason':'Archive copies and directory rename completed, but local candidate-manifest variable seal shadowed seal() and prevented the final artifact index. Error cleanup also referred to already-renamed staging directory. No archived payload was lost. Documentation updates subsequently completed; attempted finalize refused the absent artifact index.','copied_payloads_verified':78,'production_inputs_unchanged':True,'original_failed_helper_preserved':'archive.py','correction':'Rename sealing function to seal_archive and check staging exists before error cleanup. Validate every copied payload before recovering initial seal; ordinary finalization independently verifies post-suite documentation delta and preservation.','native_or_test_failure':False} (D/'archive-recovery.json').write_text(json.dumps(recovery,indent=2)+'\n') shutil.copyfile(B/'archive.py',D/'root/archive-recovery.py') shutil.copyfile(Path(__file__),D/'root/recover-archive.py') spec=importlib.util.spec_from_file_location('recover',B/'archive.py');m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m);m.seal_archive() print('Recovered artifact index after verifying all78 copied payloads; original failed helper retained')