from pathlib import Path import hashlib, json root = Path('output') archive = root/'original-submission' archive.mkdir(exist_ok=True) files = ['article.md', 'metadata.json', 'editor-notes.md', 'check_package.py'] manifest = {} for name in files: src, dst = root/name, archive/name if dst.exists(): raise RuntimeError('Archive already exists; refusing to overwrite: ' + str(dst)) raw = src.read_bytes() dst.write_bytes(raw) assert dst.read_bytes() == raw manifest[name] = hashlib.sha256(raw).hexdigest() inputs = {str(p): hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted(Path('inputs').iterdir()) if p.is_file()} (root/'preservation-manifest.json').write_text(json.dumps({'original_submission_sha256': manifest, 'input_sha256_at_review_start': inputs}, indent=2)+'\n', encoding='utf-8') a = (root/'article.md').read_text(encoding='utf-8') a = a.replace('This assessment uses the supplied source packet.', 'This assessment reflects the supplied source packet as of October 18, 2026.') a = a.replace('workspace using 750 uploads would', 'workspace using 750 uploads in one month would') a = a.replace('a small trial is reasonable. Start', 'a small evaluation is reasonable; this is not an advertised free-trial offer. Start') (root/'article.md').write_text(a, encoding='utf-8') n = (root/'editor-notes.md').read_text(encoding='utf-8') n = n.replace('drafts do not execute transactions or communications.', 'it does not approve payments, send emails or execute contracts.') n = n.replace('workspace with 750 uploads, without OCR:', 'workspace with 750 uploads in one month, without OCR:') (root/'editor-notes.md').write_text(n, encoding='utf-8') print('Preserved all four original files byte-for-byte, recorded SHA-256 hashes, and applied limited editorial clarifications.')