main
John Lauer
Verify current IC catalog lineage and resolve DGS manufacturer land patterns
9f7dac2
"""Pin each remote catalog head and compare current STEP assets with adopted board models."""
from pathlib import Path
import json,subprocess,hashlib,concurrent.futures
R=Path(__file__).resolve().parents[1];O=R/'checkpoints/board31-ic-library-review/current-catalog';O.mkdir(exist_ok=True)
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
reg=json.loads((R/'aiflow/run/components.json').read_text());cs=[c for c in reg['components']if c['reference'].startswith('U')]
def cli(args):
r=subprocess.run(['adom-wiki',*args],capture_output=True,text=True,timeout=90);assert r.returncode==0,r.stderr;return json.loads(r.stdout)
def one(c):
repo=c['review']['wikiPage'].split('wiki.adom.inc/')[1];out=O/c['reference'];out.mkdir(exist_ok=True)
h=cli(['repo','log',repo,'--limit','1','--json']);head=h['data']['log'][0]['hash'];(out/'head.json').write_text(json.dumps(h,indent=2)+'\n')
response=cli(['repo','show',repo,'page.json','--ref',head,'--json']);page=json.loads(response['data']['text']);(out/'page.json').write_text(json.dumps(page,indent=2)+'\n')
assert page['component']['mpn'].lower()==c['properties']['MPN'].lower(),c['reference']
files=[]
for role,path in page['component']['parts'].items():
if role not in ['symbol','footprint','model_3d_step','step']:continue
dest=out/Path(path).name
cli(['repo','show',repo,path,'--ref',head,'--out',str(dest),'--json']);files.append({'role':role,'sourcePath':path,'file':str(dest.relative_to(R)),'sha256':sha(dest)})
models=[{'path':p,'sha256':sha(Path(p.replace('${KIPRJMOD}',str(R/'aiflow/run'))))}for p in c['modelReferences']]
match=all(any(x['sha256']==m['sha256']for x in files if x['role']in ['step','model_3d_step'])for m in models)
row={'reference':c['reference'],'repository':repo,'sourceHead':head,'version':page['version'],'files':files,'boardModels':models,'selectedModelMatchesCurrentPublishedMarkedStep':match};print(c['reference'],repo,head[:12],match,flush=True);return row
with concurrent.futures.ThreadPoolExecutor(max_workers=3)as pool:rows=list(pool.map(one,cs))
report={'scope':'Pinned current remote catalog assets; no board mutation or acceptance gate advancement','boardSha256':sha(R/'aiflow/run/board-31.kicad_pcb'),'rows':rows};(O/'report.json').write_text(json.dumps(report,indent=2)+'\n')