main
John Lauer
Board32 finish and export evidence, selected cooling assembly review and mechanical BOM
851498a
import json,sys,hashlib
from pathlib import Path
sys.path.insert(0,'tools');import sexp
root=Path(__file__).resolve().parents[1];out=root/'checkpoints/board32-silkscreen-current';old=root/'design/silkscreen-review'
board=root/'aiflow/run/board-32.kicad_pcb';b=sexp.parse(board.read_text());fps={}
for f in sexp.find(b,'footprint'):
props={p[1]:p[2] for p in sexp.find(f,'property')};fps[props['Reference']]=(f,props)
ids=json.loads((old/'land-bottom-texts.json').read_text())['createdIds']
children=[c for g in json.loads((old/'bottom-layout.json').read_text())['placements'] for c in g['children']]+json.loads((old/'bottom-identity.json').read_text())['texts']
assert len(ids)==len(children)
marks={m['id']:m for m in json.loads((out/'geometry.json').read_text())['marks']}
alias={'DUT_POS':'DUT+','LOAD_POS':'LOAD+','SHUNT_P_SENSE':'SH+','SHUNT_N_SENSE':'SH-','TEMP_SENSE':'TEMP','FAN_TACH':'TACH','I_SET':'ISET','V_GATE':'VDRV','LATCH_Q':'LATCH','5V_AUX':'5V','UART_TX':'TX','UART_RX':'RX'}
rows=[];errors=[]
for uid,c in zip(ids,children):
ref=c.get('reference');role=c.get('role');m=marks.get(uid)
if not ref or not role:continue
f,p=fps[ref];expected=ref
if role=='value':
if ref.startswith(('R','C','L','F')):expected='20m' if ref=='RSH1' else p['Value']
elif ref.startswith(('TP','MP')) or ref in ['J'+str(i)for i in range(1,8)]:
nets={sexp.first(pad,'net')[-1]for pad in sexp.find(f,'pad')if sexp.first(pad,'net')};assert len(nets)==1
net=next(iter(nets));expected=alias.get(net,net)
else:expected={'J8':'USB','J9':'FAN','J10':'TEMP','J11':'SWD'}[ref]
ok=m is not None and m['text']==expected and m['layer']=='B.SilkS' and m['nativeInput']['mirrored']
row={'reference':ref,'role':role,'id':uid,'expected':expected,'actual':m['text'] if m else None,'pass':ok}
if not ok:errors.append(row)
rows.append(row)
for ref in fps:
if not any(r['reference']==ref and r['role']=='reference'for r in rows):errors.append({'reference':ref,'error':'reference group absent'})
result={'boardSha256':hashlib.sha256(board.read_bytes()).hexdigest(),'status':'pass'if not errors else'fail','scope':'Native created UUIDs bind historical groups to current saved text; current electrical values and signal names independently checked. Does not establish visual association or line clearance.','groupedReferences':len(set(r['reference']for r in rows)),'rows':rows,'errors':errors}
(out/'group-identity-review.json').write_text(json.dumps(result,indent=2)+'\n');print({k:v for k,v in result.items() if k!='rows'})