Skip to content

fix(schematic): resolve pins through their placed unit - #272

Open
nordic-style wants to merge 1 commit into
mixelpixx:mainfrom
nordic-style:codex/fix/multi-unit-pin-resolution
Open

fix(schematic): resolve pins through their placed unit#272
nordic-style wants to merge 1 commit into
mixelpixx:mainfrom
nordic-style:codex/fix/multi-unit-pin-resolution

Conversation

@nordic-style

Copy link
Copy Markdown
Contributor

Summary

  • resolve pins through the unit instance that actually places them in schematic validators and exports
  • search every placed unit for reference-level pin and connectivity queries
  • prevent fix_connectivity from snapping wires to phantom pins belonging to another unit
  • make every design-review audit unit-aware and retire the temporary partial-coverage verdict
  • identify the resolved unit in additive analysis and netlist-summary response fields

Refs #182

Approach

Every per-instance path now calls extract_lib_pins_for_unit(symbol, instance.unit) before applying that instance's transform. Reference-level queries either use the established resolve_placed_pin helper or explicitly visit every placement sharing the reference. This preserves common pins while preventing another unit's local coordinates from being projected through the wrong placement.

Regression fixtures deliberately give both units a pin at the same local coordinate, then place those units on different labelled nets. That shape makes a first-instance lookup return a plausible but demonstrably wrong answer instead of merely failing to find a pin.

The sole remaining extract_lib_pins call in these files is intentional and documented: design-review coverage compares the complete definition with the selected unit only to classify a component as multi-unit. All electrical analysis uses the unit-filtered set.

This PR covers the read/analysis/export half of #182. The component mutation paths are being submitted separately, and #267 contains the additional intentional-NC/power-pin behavior for validate_component_connections; the one shared unit-filtering line may need a trivial rebase depending on merge order.

Compatibility and safety

  • Existing schemas are unchanged.
  • get_component_nets, get_net_components, and get_connected_items gain additive unit fields.
  • export_netlist_summary gains unit; each entry's pins now describe that placed unit rather than every unit superimposed at its coordinates.
  • Multi-unit design review is now complete when all other coverage is available instead of being forcibly marked partial.
  • fix_connectivity keeps its existing atomic write path but will no longer propose or apply a snap to an unplaced unit's phantom endpoint.
  • Rollback is a single revert of commit 1693251.

Validation

  • 18 focused Multi-Unit tests pass, including 8 new call-site regressions across analysis, both validators, netlist summary, connectivity repair, and design review
  • fixtures cover equal local pin coordinates, distinct placed coordinates/nets, a phantom near-snap target, an unplaced power pin, and a real unwired unit pin
  • cargo test --workspace --locked --lib --tests: all suites pass except the same three pre-existing local update_symbols_from_library_* failures caused by the installed KiCad Device:R library shadowing the test fixture; konnect-core reaches 550/553 passing tests
  • HTTP and stdio protocol suites pass
  • cargo test --workspace --locked --doc: pass
  • cargo clippy --workspace --locked --all-targets -- -D warnings: pass
  • cargo fmt --all -- --check: pass

Schematic validators, exports, connectivity queries, and design-review audits transformed every library pin through each matching reference's first placement. Multi-unit parts therefore reported phantom pins, wrong nets, false audit findings, and unsafe connectivity snaps.

Resolve only the selected unit at every per-instance call site, search all placed units for reference-level queries, identify units in additive response fields, and remove the temporary partial-review diagnostic. Regression fixtures place both units' pins at the same local coordinate so first-instance resolution cannot pass unnoticed.

Refs mixelpixx#182
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant