main
John Lauer
Preserve board29, component assets and scaffold-fit correction candidate with reviewed footage
c54169e
"""Make a compact, hash-bound record of an isolated candidate and its existing solves."""
from pathlib import Path
import hashlib,json,sys
root=Path(__file__).resolve().parents[1];version=sys.argv[1]
assert version.startswith('v') and version[1:].isdigit()
folder=root/'checkpoints/unclipped-hotspots-v1';board=folder/f'candidate-{version}.kicad_pcb';drcfile=folder/f'drc-{version}.json'
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
drc=json.loads(drcfile.read_text());records=[]
for path in sorted(folder.glob(f'fields-{version}-*/fields.json')):
d=json.loads(path.read_text());assert d['inputIdentity']['board']==sha(board),path
records.append(dict(path=str(path.relative_to(root)),sha256=sha(path),inputIdentity=d['inputIdentity'],nets=[{k:n[k] for k in ['net','peakJ','peakAt','peakLayer','residual']} for n in d['nets']],chips=d['chips'],issues=d['issues']))
solver=Path('/home/adom/project/fields-annulus-target/release/adom-fields')
report=dict(status='isolated-not-landed',candidate=str(board.relative_to(root)),boardSha256=sha(board),nativeDRC=dict(errors=sum(v['severity']=='error' for v in drc['violations']),warnings=sum(v['severity']=='warning' for v in drc['violations']),opens=len(drc['unconnected_items']),sha256=sha(drcfile)),solver=dict(sha256=sha(solver),sourceCommit='e34bcddab94b3f14442bf511a8b6b35bcdb02237',review='https://wiki.adom.inc/adom/adom-fields/prs/9',sharedRuntimeReplaced=False),reports=records)
out=root/f'design/hotspot-{version}-evidence.json';out.write_text(json.dumps(report,indent=2)+'\n');print(out)