fix(pcb): validate the requested routing board - #284
Open
nordic-style wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User-visible problem and scope
Seven IPC-backed routing operations required a
boardpath 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 compareargs["board"]. The helper now reads the path once and callsensure_board_is_activeinside 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, androute_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 warningscargo fmt --all -- --checkboardis now reached through the registered handler/macro call graph.konnect-coretests pass, with only the same three installed-Device:Rfixture-shadowing failures reproduced on unmodifiedmain.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.