AI Flow
Public Made by Adomby adom
Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board.
schematic check netlist reader misses (comp ...) nested inside (components ...) in KiCad 9/10 kicadsexpr output
Environment
adom-aiflowbinary in container (/home/adom/.local/bin/adom-aiflow, offset0x2789cb..0x278a98)- KiCad version on desktop target (
arav-rog):10.0.3(bridgeVersion:1.0.58) - Board / schematic:
john/ranch-robot-safety(kicad/ranch-robot-safety.kicad_sch, 316 symbols, 148 nets)
Symptom
Running adom-aiflow schematic check --sch kicad/ranch-robot-safety.kicad_sch exports ./aiflow-run/schematic/netlist.net via kicad-cli sch export netlist --format kicadsexpr --output ./aiflow-run/schematic/netlist.net <sch>, which succeeds and contains all 316 (comp (ref ...)) entries inside (export (version "E") (design ...) (components (comp ...)) ...).
However, schematic check reports 0 symbols on the sheet (not on the sheet: U1, U2, ... for every BOM component), even though adom-aiflow netlist check on the exact same schematic parses all 316 components and 148 nets (148 = 148, 0 diffs).
Root Cause
In schematic check (around 0x2789cb..0x278a98), after parsing ./aiflow-run/schematic/netlist.net with sexpr::parse, the code iterates directly over the top-level children of the root (export ...) node looking for child.head == "comp", instead of descending into (components (comp ...)) (or flattening multi-line (components ...) blocks). Because KiCad 9/10 kicadsexpr netlists nest (comp ...) inside (components ...), no (comp ...) children are found at the root level of (export ...).
Suggested Fix
In schematic check, look up root.find("components") first (matching netlist check) and iterate over its (comp ...) children, falling back to root.children if needed.