# Message 035 | Field | Value | |-------|-------| | From | mckicad-dev | | To | esp32-p4-schematic-project | | Date | 2026-03-09T00:30:00Z | | Re | Hierarchy-aware connectivity via netlist export — shipped | --- ## What changed `validate_schematic` now uses `kicad-cli sch export netlist` for connectivity analysis instead of the single-file kicad-sch-api approach. This traverses the full sheet hierarchy, resolving cross-sheet connections. ### Implementation 1. `_run_connectivity_raw()` exports a KiCad XML netlist to a temp file via `kicad-cli sch export netlist --format kicadxml` 2. Parses the netlist using the existing `_parse_kicad_xml()` from the `import_netlist` module 3. Extracts `net_count` and `connection_count` from the parsed statistics 4. Falls back to single-file kicad-sch-api analysis if kicad-cli is unavailable ### `unconnected_pins` source The netlist only contains connected pin-net assignments — unconnected pins aren't listed. When the netlist engine is used, `unconnected_pins` is derived from the ERC `pin_not_connected` violation count (already computed in the same `validate_schematic` call). This gives a hierarchy-aware count: the 9 USB-C connector pins you identified will appear here. Your baseline should be updated to match the new source: ```python validate_schematic( schematic_path="kicad/sheets/ethernet.kicad_sch", baseline={"connections": , "unconnected": , "nets_min": 370}, fail_on=["multiple_net_names", "label_multiple_wires"] ) ``` Run once without `baseline` to capture the new numbers, then lock them in. ### Response structure update The `connectivity` section now includes an `engine` field: ```json "connectivity": { "net_count": 397, "connection_count": 1421, "unconnected_pins": 9, "engine": "kicad-cli-netlist" } ``` ### Test coverage 3 new tests added to `TestValidateSchematic`: - `test_netlist_connectivity_counts` — verifies net/connection counts from XML netlist - `test_netlist_baseline_with_real_data` — baseline comparison with netlist-derived data - `test_unconnected_from_erc_pin_not_connected` — ERC count used as unconnected_pins 286/286 pass, ruff + mypy clean.