Files
ARCADIA-Studio/harness/experiments/text-workspace-followup-review-20260913/readback_publication.py
T

27 lines
1.6 KiB
Python

"""Read back selected published source/evidence bytes from the exact Gitea commit."""
from pathlib import Path
from datetime import datetime, timezone
import hashlib
import json
import subprocess
import urllib.request
ROOT = Path('C:/ar-text-9e8r6t')
COMMIT = '2df7f580aa4bd728a728c83ac10e6ccc956ef069'
BASE = 'http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/raw/commit/' + COMMIT + '/'
FILES = ['crates/oa-desktop/src/app.rs', 'crates/oa-desktop/src/app/source_symbols.rs', 'harness/text-workspace-verified-20260913.md', 'harness/experiments/text-workspace-native3-20260913/manifest.json', 'harness/experiments/text-workspace-native3-20260913/attempt-6/inputs.zip', 'harness/experiments/text-workspace-native3-20260913/attempt-6/tests-stdout.log']
records = []
for name in FILES:
expected = subprocess.check_output(['git', 'show', COMMIT + ':' + name], cwd=ROOT)
with urllib.request.urlopen(BASE + name, timeout=45) as response:
raw = response.read()
assert response.status == 200
assert raw == expected, 'Published content differs: ' + name
records.append({'path': name, 'bytes': len(raw), 'sha256': hashlib.sha256(raw).hexdigest()})
result = {'atUtc': datetime.now(timezone.utc).isoformat(), 'commit': COMMIT, 'scope': 'Exact selected committed source/evidence bytes downloaded from Gitea; complete source and evidence membership are separately verified against the committed Git tree.', 'files': records}
dest = Path(__file__).resolve().parent / 'publication-readback.json'
with dest.open('x', encoding='utf-8', newline='\n') as out:
json.dump(result, out, indent=2)
out.write('\n')
print(json.dumps(result))