import hashlib import json from pathlib import Path from datetime import datetime, timezone base = Path(__file__).resolve().parent trial = base / 'trial-diagnostic-2' def identity(path): data = path.read_bytes() return {'bytes': len(data), 'sha256': hashlib.sha256(data).hexdigest()} closure = json.loads((trial / 'closed.json').read_text()) assert closure['exitCode'] == 0 and closure['launchReceiptError'] is None assert all(closure[k] for k in ['binaryUnchanged', 'preservedBinaryUnchanged', 'sameFileAfterExit', 'dllUnchanged']) pairs = [('project.arcadia', base / 'fixtures/missing-include/project.arcadia'), ('functions.arcadia', base / 'fixtures/functions-to-discover.arcadia')] files = [] for name, original in pairs: actual = trial / 'work-fixture' / name assert actual.read_bytes() == original.read_bytes(), name files.append({'file': name, 'actual': identity(actual), 'original': identity(original), 'exactEqual': True}) observations = [] for path in sorted((trial / 'screenshots').glob('*.json')): item = json.loads(path.read_text()) shots = [] for shot in item['screenshots']: p = path.parent / shot['file'] shots.append({'file': shot['file'], **identity(p)}) observations.append({'file': path.name, **identity(path), 'screenshots': shots}) assert len(observations) == 49 result = {'atUtc': datetime.now(timezone.utc).isoformat(), 'helper': identity(Path(__file__)), 'closure': identity(trial / 'closed.json'), 'files': files, 'observations': observations, 'noSaveOrApplyDuringTrial': 'Parent action record; not inferred from disk equality', 'scope': 'Post-exit exact disk fixtures and evidence membership. No transient model-state equality claim.'} out = trial / 'post-exit-verification.json' with out.open('x', encoding='utf-8') as f: json.dump(result, f, indent=2) f.write('\n') print(json.dumps({'result': identity(out), 'observations':len(observations), 'screenshots':sum(len(x['screenshots']) for x in observations), 'filesExact': True}))