fix(project): verify the requested open board - #279
Closed
nordic-style wants to merge 1 commit into
Closed
Conversation
Resolve project paths to their sibling PCB, query KiCad's real open-document list, and return an honest per-path result instead of ignoring open_project.path. Refs mixelpixx#251
Contributor
Author
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
open_project.pathaccepted either a project or board path, but the handler ignored the requested path and treated any successful PCB IPC ping as proof that the requested project was open. With multiple projects, it could report success for the wrong board.This PR resolves
.kicad_propaths to their sibling.kicad_pcb, queries KiCad's open boards, and succeeds only when the requested board is actually active/open.Refs #251
Root cause and design
The old implementation used a liveness check without reading
path. The IPC client now exposes normalized open-board paths, and the handler compares the requested canonical board against that list. Unsupported extensions, missing sibling boards, unreachable IPC, and a different open board return structured, actionable failures.Compatibility and migration
Both documented input forms remain supported. Correct calls keep the same success behavior; false-positive calls now fail and name the requested/open board state. This is a correctness tightening, not a schema change.
The tool remains a verifier: it does not launch KiCad or modify project files.
Validation
KONNECT_STATE_DIR=/private/tmp/konnect-open-project cargo test -p konnect-core tools::project::tests --lockedcargo clippy --workspace --locked --all-targets -- -D warningscargo fmt --all -- --checkkonnect-coretests pass, with only the same three installed-Device:Rfixture-shadowing failures reproduced on unmodifiedmain.Risk and rollback
Risk is confined to IPC path normalization and refusal behavior. No files are written. If a platform-specific path form is missed, the safe failure is a refusal rather than acting on the wrong project. Rollback is a single commit revert.