Files
ARCADIA-Studio/harness/experiments/peer-union-e34-windows-20260923/helpers/package-e34-evidence-v2.py
T

69 lines
3.4 KiB
Python

"""Create the reviewed v2 proposal without executing a verifier or archived code."""
from pathlib import Path
import hashlib
import json
import shutil
LOCAL = Path(__file__).resolve().parent
ORIGINAL = LOCAL / 'peer-union-e34-evidence-proposal-20260923'
OUT = LOCAL / 'peer-union-e34-evidence-proposal-v2-20260923'
ORIGINAL_PINS = {
'.gitattributes': (71, 'e4206e7142a4c884e433fb83f68548d8cbb6945955cb1d378a01f012da4123eb'),
'evidence.zip': (1073739, '08c9a6e72e74e3368a1b167b358bf76923db3986d53457d5ead707926d6b3b5b'),
'manifest.json': (17383, '9fc171e23543bff10452b2352844486165097a45533de7485bcbe3a542b2a9a4'),
'README.md': (5158, '6ea11241d7e1c2e0f5bc74fd243be4adfe1723cde247f226e0d0f30a9aa1cfcd'),
'verify.py': (19786, 'e41cc00a78f70e98344e2afaf96c06d15de0899cdaae12cecfe7a48229c1b02a'),
}
def pin(raw):
return {'bytes': len(raw), 'sha256': hashlib.sha256(raw).hexdigest()}
def check_original():
assert {p.name for p in ORIGINAL.iterdir()} == set(ORIGINAL_PINS)
for name, (size, digest) in ORIGINAL_PINS.items():
assert pin((ORIGINAL / name).read_bytes()) == {'bytes': size, 'sha256': digest}, name
def main():
check_original()
OUT.mkdir()
# Preserve every raw evidence payload and the original ZIP bytes exactly.
for name in ('evidence.zip', '.gitattributes'):
shutil.copyfile(ORIGINAL / name, OUT / name)
shutil.copyfile(LOCAL / 'verify-e34-evidence-v2.py', OUT / 'verify.py')
manifest = json.loads((ORIGINAL / 'manifest.json').read_bytes())
manifest['verifier'] = pin((OUT / 'verify.py').read_bytes())
(OUT / 'manifest.json').write_text(json.dumps(manifest, indent=2) + '\n', encoding='utf-8', newline='\n')
readme = (ORIGINAL / 'README.md').read_text(encoding='utf-8')
readme = readme.replace('# Frozen e34 Windows gate evidence — proposed package',
'# Frozen e34 Windows gate evidence — proposed package v2', 1)
readme = readme.replace('its portable verifier has not yet been executed.',
'its revised portable verifier has not yet been executed.', 1)
review = '''
V2 addresses static review findings: independently fixed historical raw-log and
failed/ignored identities, an independent eight-test ignore policy, aggregate/leaf
and before-snapshot consistency for supplementary listings (including source and
baseline bindings for the retained failed attempt), and native compiler-error
refusal. The original proposal remains byte-exact. The archive and all 72 payloads
are unchanged; its archived original packaging script is historical evidence.
Only the verifier pin and this README change in the proposal. The separate v2
producer and semantic-control driver are review helpers, not archived execution
dependencies. Neither the revised verifier nor the controls have been run.
'''
anchor = 'without executable binary duplication.\n'
assert readme.count(anchor) == 1
readme = readme.replace(anchor, anchor + review, 1)
(OUT / 'README.md').write_text(readme, encoding='utf-8', newline='\n')
check_original()
assert (OUT / 'evidence.zip').read_bytes() == (ORIGINAL / 'evidence.zip').read_bytes()
print(json.dumps({'folder': str(OUT), 'archive': manifest['archive'], 'verifier': manifest['verifier'],
'original_unchanged': True, 'verified': False}, indent=2))
if __name__ == '__main__':
if not __debug__:
raise SystemExit('Optimized Python is not supported')
main()