main
John Lauer
Verify current IC catalog lineage and resolve DGS manufacturer land patterns
9f7dac2
"""Explain a shared-catalog refresh without replacing a validated board dependency."""
from pathlib import Path
import json,hashlib
import sexp
R=Path(__file__).resolve().parents[1];D=R/'checkpoints/board31-ic-library-review/current-catalog/U1';sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
def pins(p):
out={}
def walk(x):
if not isinstance(x,list):return
if x and x[0]=='pin':
n=sexp.first(x,'number');name=sexp.first(x,'name')
if n and name:out[n[1]]={'name':name[1],'electricalType':x[1]}
for v in x:walk(v)
walk(sexp.parse(p.read_text()));return out
old=R/'components/stm32g0b1kct6';a=pins(old/'stm32g0b1kct6.kicad_sym');b=pins(D/'stm32g0b1kct6.kicad_sym');assert set(a)==set(b)and len(a)==32
changes={n:{'selected':a[n],'current':b[n]}for n in a if a[n]!=b[n]}
def geometry(f):return sorted((p[1],tuple(map(float,sexp.first(p,'at')[1:3])),tuple(map(float,sexp.first(p,'size')[1:3])))for p in sexp.find(f,'pad'))
board=R/'aiflow/run/board-31.kicad_pcb';boardtree=sexp.parse(board.read_text());f=next(f for f in sexp.find(boardtree,'footprint')if any(p[1:3]==['Reference','U1']for p in sexp.find(f,'property')))
currentfp=D/'stm32g0b1kct6.kicad_mod';padmatch=geometry(f)==geometry(sexp.parse(currentfp.read_text()));plain=sha(old/'stm32g0b1kct6-generic.step')==sha(D/'current-plain.step');assert plain and padmatch
r={'boardSha256':sha(board),'currentHead':json.loads((D/'head.json').read_text())['data']['log'][0]['hash'],'plainStepBytesIdentical':plain,'plainStepSha256':sha(D/'current-plain.step'),'selectedBoardPadsMatchCurrentCatalog':padmatch,'symbolPinCount':32,'symbolChanges':changes,'review':'Six name changes are punctuation/alias formatting only: PC14/OSC32_IN, PC15/OSC32_OUT, PF2/NRST, PA11/PA9, PA12/PA10, PA14/BOOT0. Electrical-type changes, if any, are recorded separately below.','electricalTypeChanges':{n:changes[n]for n in changes if a[n]['electricalType']!=b[n]['electricalType']},'decision':'Retain Board31 selected marked STEP and previously reviewed symbol. Shared plain physical model is byte-identical; current source marks use a different derivative. New shared footprint returns to the same generic pad geometry already used by U1. No automatic update needed.','limits':['The current shared catalog views show a different marked derivative.','Manufacturer example comparison and process qualification remain separate.','No board change or gate advancement.']}
(D/'comparison.json').write_text(json.dumps(r,indent=2)+'\n');print(json.dumps({k:r[k]for k in ['plainStepBytesIdentical','selectedBoardPadsMatchCurrentCatalog','symbolPinCount','electricalTypeChanges']}))