"""Preserve an interrupted changed-source attempt; never produce acceptance proof.""" from pathlib import Path import hashlib, json, zipfile root = Path('C:/ar-scenario-9e8r6t') run = root/'.local/scenario-group-gates/selection-scenario-3' out = root/'harness/scenario-selection-evidence-20260924/invalid-attempt-3' result = json.loads((run/'result.json').read_text()) assert result['exitCode'] == 1 and result['inputsUnchanged'] is False assert result['artifacts'] == [] and 'finish' in result assert not (run/'source-proof.json').exists() def pin(data): return {'bytes':len(data), 'sha256':hashlib.sha256(data).hexdigest()} payload = {p.name:p.read_bytes() for p in run.iterdir() if p.is_file()} assert set(payload) == {'started.json','process.json','result.json','stdout.log','stderr.log','inputs.json','inputs.zip'} payload['gate.py'] = (run.parent/'gate.py').read_bytes() assert pin(payload['gate.py']) == result['helper'] out.mkdir(parents=True, exist_ok=False) with zipfile.ZipFile(out/'raw.zip','x',zipfile.ZIP_DEFLATED) as archive: for name, data in sorted(payload.items()): archive.writestr(name,data) with zipfile.ZipFile(out/'raw.zip') as archive: assert set(archive.namelist()) == set(payload) assert all(archive.read(name) == data for name,data in payload.items()) manifest = {'status':'INVALID interrupted source-change attempt; no verification claim', 'run':'selection-scenario-3', 'reason':'Cargo started while the final formatter/commit command was still running. app.rs bytes changed after capture. Parent deliberately terminated the observed Cargo process tree; no executable/test result was emitted. Raw HEAD identifies only the starting checkout, not the captured or compiled working tree.', 'archive':pin((out/'raw.zip').read_bytes()), 'members':{n:pin(d) for n,d in sorted(payload.items())}} with (out/'manifest.json').open('x',encoding='utf-8',newline='\n') as stream: json.dump(manifest,stream,indent=2);stream.write('\n') print(json.dumps(manifest,indent=2))