Skip to content

feat(pcb): batch component placement atomically - #264

Open
nordic-style wants to merge 1 commit into
mixelpixx:mainfrom
nordic-style:codex/feat/batch-component-placement
Open

feat(pcb): batch component placement atomically#264
nordic-style wants to merge 1 commit into
mixelpixx:mainfrom
nordic-style:codex/feat/batch-component-placement

Conversation

@nordic-style

Copy link
Copy Markdown
Contributor

Summary

Add set_component_placements, an additive PCB tool that sets the X/Y position and absolute rotation of multiple existing footprints atomically.

No linked issue.

Approach

  • Validate the complete batch, including duplicate and missing references, before any mutation.
  • For live KiCad, read one board snapshot, transform each footprint and all of its pads, graphics, and fields with the existing geometry primitives, and publish one UpdateItems request inside one KiCad commit.
  • For a closed board, transform every requested footprint in memory and perform one revision-checked atomic file write.
  • Keep single-item move and rotate behavior unchanged.

Compatibility and safety

This is an additive MCP tool and schema. The pcb_components count and all quoted total/toolset counts are updated.

Both paths are all-or-nothing. Live IPC verifies that the requested board is active and creates one undo step. The file fallback is used only when IPC is unreachable, rejects stale source content, validates every reference before writing, and preserves pads, graphics, fields, line endings, and unrelated board content.

Validation

  • cargo fmt --all -- --check
  • cargo test --workspace --locked --lib --tests — the full local core run reaches the same three update_symbols_from_library_* failures reproduced on origin/main; focused suites below pass
  • cargo test --workspace --locked --doc — not run
  • cargo clippy -p konnect-core --locked --all-targets -- -D warnings
  • cargo test -p konnect-core --locked --lib pcb_components::tests — 57 passed
  • cargo test -p konnect-ipc --locked --test footprint_transform_test — 3 passed on this branch
  • cargo test -p konnect --locked --test doc_tool_counts — 6 passed
  • Real KiCad 10 check: two existing footprints were submitted at their current placements; the response reported source: ipc, one undo step, unchanged live pad positions, and the board saved successfully

Review checklist

  • The diff is focused and contains no generated output, personal data, or unrelated cleanup.
  • New names follow docs/NAMING_CONVENTIONS.md; public renames include compatibility handling.
  • New behavior and failure paths have regression coverage.
  • File mutations are atomic and preserve unrelated content.
  • IPC mutations verify the requested board and do not leave partial batches.
  • Tool counts and docs are updated.

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