master
Ray Publish 0.5.1 6234640
"""Acceptance 2: logic-74hc595bq (8 x 8 with 2 mm top and bottom wings, at its claude-pcb-f411 v2.3 tag) shows both bottom pours with a 0.30 mm
gap and a 0.40 mm edge pullback, and the 45-degree corner labels.
Usage: python3 hc595_pours.py <adom-2dboard binary> <claude-pcb-f411 repo> [out.png]"""
import json, os, subprocess, sys, tempfile
BIN, REPO = sys.argv[1], sys.argv[2]
OUT = sys.argv[3] if len(sys.argv) > 3 else '/dev/null'
B = 'mcu-self-contained/boards/logic-74hc595bq'
with tempfile.TemporaryDirectory() as t:
    for f, p in (('circuit.json', f'{B}/dist/lib/index/circuit.json'), ('design.json', f'{B}/design.json')):
        open(os.path.join(t, f), 'w').write(subprocess.run(['git', '-C', REPO, 'show', f'hc595-domino-v2.3:{p}'], capture_output=True, text=True, check=True).stdout)
    out = subprocess.run([BIN, 'render', '--circuit', f'{t}/circuit.json', '--design', f'{t}/design.json', '--out', OUT, '--json'], capture_output=True, text=True, check=True).stdout
s = json.loads(out[:out.rindex(']') + 1])[0]
bottom = [p for p in s['pours'] if p['layer'] == 'bottom']
corner = [t for t in s['silk'] if abs(abs(t['ccwRotation']) - 45) < 1e-9 and not t['bottom']]
checks = {
    'bottom pours VCC and GND': len(bottom) == 1 and sorted(bottom[0]['nets']) == ['GND', 'VCC'],
    'pour gap 0.30 mm': bool(bottom) and bottom[0]['gap_mm'] == 0.3,
    'edge pullback 0.40 mm': bool(bottom) and bottom[0]['edge_pullback_mm'] == 0.4,
    '45-degree corner labels (VCC -45, GND +45)': sorted((t['text'], t['ccwRotation']) for t in corner) == [('GND', 45.0), ('VCC', -45.0)],
}
print('pours:', bottom); print('corner labels:', [(t['text'], t['ccwRotation'], t['x'], t['y']) for t in corner])
for k, v in checks.items(): print(('PASS ' if v else 'FAIL ') + k)
sys.exit(0 if all(checks.values()) else 1)