fix(pcb): harden live footprint pad readback - #265
Draft
nordic-style wants to merge 2 commits into
Draft
Conversation
The writers in these toolsets act on the live board over IPC while get_board_info and get_component_pads parsed the file, so a session with unsaved edits got contradictory answers: get_component_list reported 25 components while get_board_info reported layer_count 0 and net_count 0 from the empty stub on disk, and pad positions were unreadable until the user pressed Ctrl+S. Both now try IPC first and fall back to the file, reporting which they used as "source" the way add_board_outline already does. get_pad_position carries the source through. Two deliberate non-behaviours. Paper size is still read from the file on both paths — KiCad's API exposes no page settings, and the tool description says so. A footprint KiCad does not have is an error rather than a file answer, because falling back would report a part the user deleted but has not saved. Every _in-less client method resolves its document as "the first open one", so with two boards open a read answered about the wrong one -- ensure_board_is_active only checks the requested board is open somewhere. The new readers address the document find_open_board matched, and get_board_extents was switched to do the same. Pads come out of the API in absolute board coordinates (see transform), so the live path applies none of the anchor/rotation math the file path needs. The copper layer count comes from BoardEnabledLayersResponse's own field rather than a tally of layer names ending in .Cu. The two agree on an ordinary stackup, which is the kind of agreement that stops holding on one nobody tried. KiCad answering with the footprint but no pads is refused whenever the saved file gives that part pads. A pad-less footprint is legal, so zero is not wrong by itself, but zero also reads as a plausible answer rather than a failure — and that is the shape an unread response would take. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nordic-style
force-pushed
the
codex/fix/live-pad-readback
branch
from
August 17, 2026 23:02
afa28a7 to
934dbf3
Compare
Contributor
|
Looks like this duplicates some of my PR #207 |
nordic-style
force-pushed
the
codex/fix/live-pad-readback
branch
from
August 18, 2026 09:23
934dbf3 to
edcc9b4
Compare
nordic-style
marked this pull request as draft
August 18, 2026 09:26
Contributor
Author
|
You're right — thanks for pointing me to #207. I missed it when I opened the original version of this PR. I've now rewritten #265 as a stacked follow-up:
I've also converted #265 to draft. Once #207 lands, its shared commit will disappear from this diff and #265 will contain only the hardening delta. I'll keep it rebased if #207 changes. Thanks again. |
Owner
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.
Summary
This is now a stacked follow-up to #207, not a competing implementation.
The branch contains #207's commit unchanged, followed by
edcc9b4. Review only the second commit. Once #207 lands, the shared base commit will disappear from this PR's diff.Depends on #207.
Approach
Keep #207's broader live-board reader and its explicit document targeting, then add only the remaining hardening:
Anytypes before decoding footprints and pads;0,0;layersfield in the saved-file fallback;Compatibility and safety
The existing tools remain source-compatible. Responses gain the additive
layersfield;sourceremains unchanged.This is read-only. It keeps #207's named-document selection, absent-footprint handling, and pad-less-footprint consistency guard.
Validation
cargo fmt --all -- --checkcargo test --workspace --locked --doccargo clippy --workspace --locked --all-targets -- -D warningscargo test -p konnect-ipc --locked --test mock_server_test --test footprint_transform_test— 29 passed, 1 intentionally ignored timeout testcargo test -p konnect-core --locked tools::pcb_components::tests— 62 passedcargo test --workspace --locked --lib --tests— 551 core tests passed; the same three unchangedupdate_symbols_from_library_*/Device:Rfailures reproduced on the local baseline remainReview checklist