Skip to content

fix(pcb): validate the requested routing board - #284

Open
nordic-style wants to merge 1 commit into
mixelpixx:mainfrom
nordic-style:codex/fix/validate-routing-board
Open

fix(pcb): validate the requested routing board#284
nordic-style wants to merge 1 commit into
mixelpixx:mainfrom
nordic-style:codex/fix/validate-routing-board

Conversation

@nordic-style

Copy link
Copy Markdown
Contributor

User-visible problem and scope

Seven IPC-backed routing operations required a board path but never used it. The related pad-to-pad router read the file for pad coordinates but still did not verify that the same board was active in KiCad. If a different board was active, a valid request could route, query, modify, or delete copper on that unintended board.

This PR makes every routing IPC call verify that the requested board is the active KiCad board before performing the operation.

Refs #251

Root cause and design

The routing toolset's local ipc! helper established connectivity but, unlike the component helper, did not resolve or compare args["board"]. The helper now reads the path once and calls ensure_board_is_active inside the same blocking IPC operation before executing the requested mutation/query.

The affected tools are route_trace, route_pad_to_pad, add_via, delete_trace, query_traces, get_nets_list, modify_trace, and route_differential_pair (including both route segments where applicable).

Compatibility and migration

No schema changes. Calls naming the actually active board behave as before. Calls naming another board now fail safely instead of operating on the wrong file.

Validation

  • KONNECT_STATE_DIR=/private/tmp/konnect-routing-board cargo test -p konnect-core pcb_routing --locked (16 passed)
  • cargo clippy --workspace --locked --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • The catalogue-wide guard PR independently verifies that board is now reached through the registered handler/macro call graph.
  • Combined-series CI commands: docs, Clippy, and format pass; 585/588 konnect-core tests pass, with only the same three installed-Device:R fixture-shadowing failures reproduced on unmodified main.

Risk and rollback

This intentionally adds a refusal path before IPC routing mutations. The safe failure mode is preferable to cross-board modification. No file fallback is introduced. Rollback is a single commit revert.

Make every IPC-backed routing operation resolve the advertised board path and refuse to operate unless that exact board is active in KiCad. This prevents a valid request from silently mutating whichever board happens to be open.\n\nRefs mixelpixx#251
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