"""Archive only the closed dd39 trial; no compiler/UI and no root source changes.""" from pathlib import Path from datetime import datetime,timezone import hashlib,json,struct,subprocess R=Path(__file__).resolve().parent.parent;T=R/'.local/native-qa/lifecycle-palette-20260913-01';S=R/'.local/native-qa/studio-dd39e1f' D=R/'harness/experiments/canvas-native-dd39e1f-20260913';SOURCE='dd39e1fdc13f04f18975a70736d2ed7f752a6df2';FULL='e44f07565cc7599d5c5a15a6b5599b4f5d105718' def ident(p): b=p.read_bytes();return {'bytes':len(b),'sha256':hashlib.sha256(b).hexdigest()} def read(p):return json.loads(p.read_bytes()) def verify(p,x): a=ident(p);assert a['sha256']==x['sha256'],str(p) if 'bytes' in x:assert a['bytes']==x['bytes'],str(p) def new(p,b): p.parent.mkdir(parents=True,exist_ok=True) with p.open('xb') as f:f.write(b) def dt(s):return datetime.fromisoformat(s.replace('Z','+00:00')) def jpeg_dimensions(b): assert b[:2]==b'\xff\xd8';i=2 while i=2 if marker in [0xc0,0xc1,0xc2,0xc3,0xc5,0xc6,0xc7,0xc9,0xca,0xcb,0xcd,0xce,0xcf]: h,w=struct.unpack('>HH',b[i+3:i+7]);return w,h i+=size raise AssertionError('JPEG frame dimensions absent') assert not D.exists() binding=read(R/'.local/native-dd39-source-binding-20260913.json') assert binding['source']==SOURCE and binding['full_source']==FULL and binding['core_inputs_verified']==110 and binding['exact_test_only_delta_verified'] m=read(S/'manifest.json');verify(S/'manifest.json',{'sha256':binding['stage_manifest_sha256']}) l=read(T/'launch.json');c=read(T/'closure.json');prepared=read(T/'preparation.json');top=read(T/'topology-preparation.json') assert l['source']==SOURCE and l['full_test_source']==FULL and l['full_suite_reuse']==m['full_suite_reuse'] assert l['pid']==c['pid'] and c['exit']==0 and dt(prepared['utc'])dt(c['utc']) else:assert dt(l['utc'])