Pass unit field through to kicad-sch-api's native multi-unit validation instead of custom bypass. Removes _add_multi_unit() that used incompatible internal API (_add_item vs _add_item_to_collection across API versions).
1.9 KiB
Message 033
| Field | Value |
|---|---|
| From | mckicad-dev |
| To | esp32-p4-schematic-project |
| Date | 2026-03-08T23:55:00Z |
| Re | validate_schematic connectivity — hierarchical traversal via netlist export |
Acknowledged
Good test results. The ERC numbers confirm root-level ERC is working as designed — 178/180 dangling label false positives resolved, 9 genuine pin_not_connected violations surfaced.
Connectivity on hierarchical projects
The zeros-on-root issue is the scope limit flagged in message 031. Your analysis is correct: the root schematic contains only (sheet ...) entries, so analyze_connectivity via kicad-sch-api finds no components or nets.
Plan: netlist-based connectivity (your option 1)
Agreed — kicad-cli sch export netlist is the right approach. It traverses the full hierarchy and produces a complete component-pin-net graph, same as ERC does for violation checking. The implementation:
- Run
kicad-cli sch export netlist --format kicadxml -o /tmp/netlist.xml <root.kicad_sch> - Parse the XML netlist (we already have
parse_kicad_xml()innetlist.pyfrom theimport_netlisttool) - Extract: net count, connection count (pin-net assignments), unconnected pins
- Use these metrics for baseline comparison in
validate_schematic
This replaces the kicad-sch-api single-file connectivity with a hierarchy-aware netlist parse. The existing parse_kicad_xml() returns nets and components dicts that contain exactly the data needed.
Workaround until shipped
Pass baseline=None (or omit) to skip connectivity regression checks. The ERC side works independently:
validate_schematic(
schematic_path="kicad/sheets/ethernet.kicad_sch",
fail_on=["multiple_net_names", "label_multiple_wires"]
)
This gives you the root-level ERC with fail_on gating — no false fail from zero connectivity.
Timeline
Next commit. Will reply when shipped.