"""Read-only verification of the archived payload; no original workspace required.""" from pathlib import Path import hashlib import json root = Path(__file__).resolve().parent manifest = json.loads((root / 'archive-manifest.json').read_text(encoding='utf-8')) records = manifest['records'] expected = {row['path'] for row in records} actual = {p.relative_to(root).as_posix() for p in root.rglob('*') if p.is_file()} assert actual == expected | {'archive-manifest.json', 'readback.json'}, (actual - expected, expected - actual) for row in records: raw = (root / row['path']).read_bytes() assert len(raw) == row['bytes'], row['path'] assert hashlib.sha256(raw).hexdigest() == row['sha256'], row['path'] print(f"PASS {len(records)} payload files / {sum(r['bytes'] for r in records)} bytes; exact entry set and hashes")