Skip to content

refactor(ipc): share the IPC classification gate and board test mock - #334

Open
pauliuszaleckas wants to merge 1 commit into
mixelpixx:mainfrom
pauliuszaleckas:refactor/shared-ipc-gate
Open

refactor(ipc): share the IPC classification gate and board test mock#334
pauliuszaleckas wants to merge 1 commit into
mixelpixx:mainfrom
pauliuszaleckas:refactor/shared-ipc-gate

Conversation

@pauliuszaleckas

Copy link
Copy Markdown
Contributor

Groundwork for a board graphic-delete tool, useful on its own.

  • with_ipc_classified moves to tools/mod.rs. It was about to exist twice
    verbatim, and it is the gate deciding whether a board file may be edited
    behind a live KiCad — the one helper whose copies must not drift. Related
    context in Closed-board fallback cannot tell "KiCAD was never running" from "KiCAD just died holding this board" #240.
  • get_items_of_types_in asks for several object types in one GetItems. The
    field is repeated and every send_command dials a fresh socket, so four types
    cost one round trip instead of four. A non-OK status is now an error rather
    than an empty result — previously a failed request was indistinguishable from
    an empty board, and one failure zeroed every type in the batch.
  • delete_items_in addresses a named document, like the other _in methods.
    delete_items delegates to it; deleting from the first open board rather than
    the requested one was the same hazard the reader fixes hit.
  • pcb_board's tests get one mock KiCad (board_mock) owning the socket, the
    envelope, and the GetOpenDocuments answer, so a test writes only its own
    command arms. Three duplicate ToolContext builders go with it.

No tool surface, argument, or response shape changes.

Gate run locally on this commit alone: cargo test --workspace --locked --lib --tests, cargo test --workspace --locked --doc, cargo clippy --workspace --locked -- -D warnings, cargo fmt --all -- --check.

Groundwork for a board graphic-delete tool, useful on its own:

- with_ipc_classified moves to tools/mod.rs. It was about to exist twice
  verbatim, and it is the gate deciding whether a board file may be edited
  behind a live KiCAD — the one helper whose copies must not drift.
- get_items_of_types_in asks for several object types in one GetItems.
  The field is repeated and every send_command dials a fresh socket, so
  four types cost one round trip instead of four.
- delete_items_in addresses a named document, like the other _in methods.
  delete_items delegates to it; deleting from the first open board rather
  than the requested one was the same hazard the reader fixes hit.
- pcb_board's tests get one mock KiCAD (board_mock) owning the socket,
  the envelope, and the GetOpenDocuments answer, so a test writes only
  its own command arms. Three duplicate ToolContext builders go with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@pauliuszaleckas
pauliuszaleckas force-pushed the refactor/shared-ipc-gate branch from ab770ab to cf63cdc Compare August 26, 2026 20:33
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