Skip to content

fix(project): verify the requested open board - #279

Closed
nordic-style wants to merge 1 commit into
mixelpixx:mainfrom
nordic-style:codex/fix/verify-requested-open-board
Closed

fix(project): verify the requested open board#279
nordic-style wants to merge 1 commit into
mixelpixx:mainfrom
nordic-style:codex/fix/verify-requested-open-board

Conversation

@nordic-style

Copy link
Copy Markdown
Contributor

User-visible problem and scope

open_project.path accepted 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_pro paths 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 --locked
  • cargo clippy --workspace --locked --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • 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

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.

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
@nordic-style

Copy link
Copy Markdown
Contributor Author

Superseded by #285, which now contains this fix rebased onto current main together with the remaining #251 work and the catalogue-wide guard. Closing this satellite so the series has one coordinated review path.

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