main
John Lauer Refresh board24 digital twin and exact-snapshot current evidence; thermal gate remains open da85333
import json,hashlib,decimal
from pathlib import Path
from sexp import parse
R=Path(__file__).resolve().parents[1];p=R/'design/silkscreen-review/front-contacts';a=R/'kicad/adom-custom-electronic-load.kicad_pcb';b=p/'postmeasure/adom-custom-electronic-load.kicad_pcb'
def norm(x,round_nm=False):
 if isinstance(x,list):return [norm(v,round_nm) for v in x]
 try:
  n=decimal.Decimal(x)
  return str((n.quantize(decimal.Decimal('0.000001')) if round_nm else n).normalize())
 except decimal.InvalidOperation:return x
x=parse(a.read_text());y=parse(b.read_text())
physical=lambda v: sorted(repr(norm(i)) for i in v[1:] if i[0] not in ('gr_line','gr_text'))
assert physical(x)==physical(y),'Physical/electrical content changed'
assert sorted(map(repr,norm(x,True)[1:]))==sorted(map(repr,norm(y,True)[1:])),'Artwork differs beyond native 1nm serialization'
r=dict(status='same circuit, copper, fills and artwork within native serialization precision',snapshotSha256=hashlib.sha256(a.read_bytes()).hexdigest(),nativeSavedSha256=hashlib.sha256(b.read_bytes()).hexdigest(),nativeRevision='8ad5cf23aeb0d12845a382355905c713d28f877ba8c5d1127534893ec4c45fed',scope='Physical/electrical data numerically exact; root ordering and front artwork formatted to native 1nm. Snapshot retained; native save retained separately.')
(p/'postmeasure-equivalence.json').write_text(json.dumps(r,indent=2)+'\n');print(r['status'])