main
John Lauer Preserve board29, component assets and scaffold-fit correction candidate with reviewed footage c54169e
"""Adopt reviewed copper-equivalent v85, preserving exact live v84 first."""
from pathlib import Path
import subprocess,json,hashlib,shutil
P=Path(__file__).resolve().parents[1];out=P/'design/v85-native-adoption';out.mkdir(exist_ok=True)
remote='C:/Users/john/adom-projects/adom-custom-electronic-load/kicad/adom-custom-electronic-load.kicad_pcb'
def ab(name,args):
 r=subprocess.run(['adom-bridge',name,json.dumps(args),'--target','AdomLapper','--ai-thread','adom-custom-load'],capture_output=True,text=True);j=json.loads(r.stdout);assert j.get('success'),j
 (out/(name+'.json')).write_text(json.dumps(j,indent=2)+'\n');return j
s=ab('kicad_routing_state',{'filePath':remote});assert s['revision']=='14d7b00e7240229f430c8602c162e21cf870400b75b811a0f77cc645a3a45c9d', 'Live board changed; do not overwrite'
ab('pull_file',{'filePaths':[remote],'saveTo':str(out/'before')})
b=out/'before/adom-custom-electronic-load.kicad_pcb';assert hashlib.sha256(b.read_bytes()).hexdigest()=='6b705624e4947fd4a33dc22e9e90678a91bac1b48a850afe66f2af689ad7a3e0'
w=ab('desktop_list_windows',{});windows=json.loads(w['output'])['data']['windows'];editor=next(x for x in windows if x['hwnd']==270428);assert editor['title']=='adom-custom-electronic-load — PCB Editor',editor
for hwnd in [730608,270428]:
 r=ab('desktop_close_window',{'hwnd':hwnd});assert 'false' not in str(r.get('closed',True)).lower()
# Confirm the editor really closed; a pending dialog must not be bypassed.
w=ab('desktop_list_windows',{});windows=json.loads(w['output'])['data']['windows'];assert not any(x['hwnd']==270428 for x in windows), 'Editor still open'
shutil.copy2(P/'checkpoints/unclipped-hotspots-v1/candidate-v85.kicad_pcb',P/'kicad/adom-custom-electronic-load.kicad_pcb')
ab('send_files',{'filePaths':[str(P/'kicad/adom-custom-electronic-load.kicad_pcb')],'dest':remote.rsplit('/',1)[0],'reason':'Adopt reviewed v85 duplicate-track cleanup: native DRC zero errors/warnings/opens, same physical copper; v84 preserved'})
ab('kicad_open_board',{'filePath':remote,'foreground':False,'waitSeconds':15})
r=ab('kicad_routing_state',{'filePath':remote});print(json.dumps({'revision':r.get('revision'),'boardPath':r.get('boardPath'),'success':r['success']}))