from pathlib import Path import hashlib, json root = Path(__file__).resolve().parent expected = json.loads((root / 'qa/native46/saved-c-oracle.json').read_text(encoding='utf-8'))['files'] folder = root / 'working/fresh-c' actual = {p.relative_to(folder).as_posix(): {'bytes': p.stat().st_size, 'sha256': hashlib.sha256(p.read_bytes()).hexdigest()} for p in folder.rglob('*') if p.is_file()} assert actual == expected, 'Fresh-process Open and no-op Save All must preserve all37 saved file bytes.' result = {'status': 'PASS', 'scope': 'All37 saved source/companion bytes unchanged after native fresh-process reopen and no-op Save All.', 'files': actual} with (root / 'qa/reopen46/bytes-oracle.json').open('x', encoding='utf-8') as f: json.dump(result, f, indent=2); f.write('\n') print(json.dumps({'status': 'PASS', 'files': len(actual)}))