main
John Lauer
Review published passive component views and bind evidence to Board32
5107598
"""Evidence-bound nominal library review; retains native/physical acceptance dependencies."""
from pathlib import Path
import json,hashlib
import sexp
R=Path(__file__).resolve().parents[1];O=R/'checkpoints/board32-resistor-review';O.mkdir(exist_ok=True);adopted=R/'aiflow/run/board-32.kicad_pcb';candidate=adopted
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
expected=json.loads((R/'design/netlist.json').read_text());intent={c['ref']:c for c in expected['components']};groups={
'Bourns':{'source':'https://www.bourns.com/docs/product-datasheets/cr.pdf?sfvrsn=574d41f6_17','bodyRangeMm':[[.95,1.05],[.45,.55],[.27,.37]],'footprintBasis':'Bourns recommended land ranges, selected0.50gap/1.50span/0.50width'},
'Panasonic-ERA':{'source':'https://industrial.panasonic.com/cdbs/www-data/pdf/RDM0000/AOA0000C307.pdf','bodyRangeMm':[[.9,1.1],[.45,.6],[.30,.40]],'footprintBasis':'Panasonic recommended land ranges, selected0.55gap/1.50span/0.50width'},
'Panasonic-ERJ':{'source':'https://industrial.panasonic.com/cdbs/www-data/pdf/RDA0000/AOA0000C304.pdf','bodyRangeMm':[[.95,1.05],[.45,.55],[.30,.40]],'footprintBasis':'Panasonic recommended land ranges, selected0.55gap/1.50span/0.50width'},
'Vishay':{'source':'https://www.vishay.com/docs/28758/tnpw_e3.pdf','bodyRangeMm':[[.95,1.05],[.45,.55],[.30,.40]],'footprintBasis':'Vishay28950 IPC reflow example, selected0.40gap/1.50span/0.60width'},
'Royalohm':{'source':'https://www.royalohm.com/assets/pdf/products/smd/10.pdf','bodyRangeMm':[[.9,1.1],[.45,.55],[.30,.40]],'footprintBasis':'No land pattern in manufacturer CQ sheet; retained stock KiCad R_0402_1005Metric nominal pattern. Catalog uses different corner radius; no silent substitution.'}}
rows=[]
for f in sexp.find(sexp.parse(candidate.read_text()),'footprint'):
props={p[1]:p[2]for p in sexp.find(f,'property')};ref=props['Reference'];mpn=props.get('MPN','')
if not ref.startswith('R')or ref.startswith('RSH'):continue
group='Bourns'if mpn.startswith('CR0402')else 'Panasonic-ERA'if mpn.startswith('ERA-')else 'Panasonic-ERJ'if mpn.startswith('ERJ-')else 'Vishay'if mpn.startswith('TNPW')else 'Royalohm'if mpn=='CQ02WGF0000TCE'else None
assert group,(ref,mpn)
assert mpn==intent[ref]['mpn'];pads=sexp.find(f,'pad');assert {str(p[1])for p in pads}=={'1','2'}
for p in pads:assert sexp.first(p,'net')[-1]==intent[ref]['pins'][str(p[1])]
models=sexp.find(f,'model');assert len(models)==1;model=models[0];path=Path(model[1].replace('${KIPRJMOD}',str(R/'kicad')));assert sha(path)=='91507e5af4251cb4ef38e04889c9b98da29904432bd83786bba13ae9b605eacb'
dims=[1,.5,.35];assert all(lo<=v<=hi for v,(lo,hi)in zip(dims,groups[group]['bodyRangeMm']))
rows.append({'reference':ref,'mpn':mpn,'group':group,'pins':intent[ref]['pins'],'nonpolar':True,'candidateFootprint':f[1],'selectedModelSha256':sha(path),'modelClass':'Stock KiCad nominal envelope, not exact manufacturer CAD or terminal tolerance model','modelNominalEnvelopeWithinManufacturerRanges':True,'catalogModelSubstituted':False,'candidateAdopted':True,'qualification':'Native per-reference view, published wiki visual and physical process review remain open'})
assert len(rows)==37
report={'adoptedBoardSha256':sha(adopted),'candidateSha256':sha(candidate),'references':rows,'groups':groups,'modelProvenance':'checkpoints/bourns-land-review-v2/source: selected stock STEP byte-matches installed KiCad library; CC-BY-SA4.0 with KiCad exception','landGuides':['https://industrial.panasonic.com/cdbs/www-data/pdf/RDM0000/DMM0000COL17.pdf','https://www.vishay.com/doc?28950'],'limits':'37-reference identity, two-terminal net binding and nominal body envelope review. No physical solder/process/electrical/thermal qualification; no gate pass. Selected manufacturer footprint variants were adopted in Board31 and retained in Board32.'}
(O/'resistor-family-review.json').write_text(json.dumps(report,indent=2)+'\n')
p=R/'aiflow/run/components.json';reg=json.loads(p.read_text());assert reg['board']=='aiflow/run/board-32.kicad_pcb'
for c in reg['components']:
if c['reference']not in {r['reference']for r in rows}:continue
v=c['review'];v['classification']='purchased';v.setdefault('geometryEvidence',[])
evidence='checkpoints/board32-resistor-review/resistor-family-review.json'
if evidence not in v['geometryEvidence']:v['geometryEvidence'].append(evidence)
v['resistorReviewNote']='Exact identity, two-terminal net membership and stock nominal model envelope checked. Selected manufacturer lands adopted in Board31 and retained unchanged in Board32. Native per-reference/published-page visual and physical qualification remain open.'
p.write_text(json.dumps(reg,indent=2)+'\n');print('37 resistor references reviewed; pending/stale acceptance statuses preserved')