#!/usr/bin/env python3 """ABLAQ Studios: check release fixity and exact regenerated scientific outputs. Python 3.10+, standard library. CC0-1.0. python3 -B verify-radiative.v1.py --release . --reproduced reproduced """ import argparse,hashlib,json from pathlib import Path ap=argparse.ArgumentParser(description=__doc__) ap.add_argument('--release',type=Path,default=Path('.')) ap.add_argument('--reproduced',type=Path,required=True) a=ap.parse_args() manifest=json.loads((a.release/'radiative-manifest.v1.json').read_text()) checked=[] for name,expected in manifest['files'].items(): original=(a.release/name).read_bytes() assert len(original)==expected['bytes'] and hashlib.sha256(original).hexdigest()==expected['sha256'], 'Release mismatch: '+name if not name.endswith('.py'): assert original==(a.reproduced/name).read_bytes(), 'Reproduction mismatch: '+name checked.append(name) assert (a.release/'radiative-manifest.v1.json').read_bytes()==(a.reproduced/'radiative-manifest.v1.json').read_bytes(), 'Manifest differs' print(json.dumps({'status':'passed','release_version':manifest['version'],'files_verified':checked,'regenerated_outputs':'byte-identical'}))