Conversation
get_netclasses reported orphan_patterns — a pattern naming a class that does not exist — but a pattern whose class exists and which fits no net on the board was invisible: the class governs nothing, KiCad's dialog shows the pattern beside the working ones, and the only way to notice was to subtract matched_nets from patterns by hand. On a class with several patterns that subtraction does not even say which one is idle. It is the usual trace of a renamed net, a pattern carried over from another board, or a glob that never fitted the net's real name. One additive response field, unmatched_patterns, lists those patterns in the shape of the project file, the same shape as orphan_patterns. A pattern is listed in one of the two, never both. When the board cannot be read or parsed the field is null rather than an empty list, because an empty list would claim every pattern matched; nets_source carries the reason as before. Measured on a real two-layer KiCad 10 board (61 nets) whose project file carries a pattern for a since-renamed net and a glob that never fitted: before, HV shows patterns=8 matched=7 and HV_LOW patterns=2 matched=1; after, unmatched_patterns names Net-(R9-Pad2) and HV_* and the orphan is still listed once, under orphan_patterns. On five unmodified boards with twelve patterns between them the field is empty.
Collaborator
|
The implementation remains useful and distinct from #222. The only current merge conflict is in Please take the minimum path forward:
The issue and PR are labeled for their current state. Once the refreshed head is conflict-free and green, we can perform the final exact-head review. |
19 tasks
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
get_netclassesnames the netclass patterns that fit no net on the board. Until now only patterns naming a missing class were reported (orphan_patterns); a pattern whose class exists but matches nothing was invisible, and subtractingmatched_netsfrompatternsby hand does not say which pattern is the idle one.Issue: Closes #525
Approach
The handler already resolves every pattern against the board's nets to build
matched_nets. This PR runs the samewildcard_matchesthe other way: a pattern whose class exists and which fits zero nets goes into a new additive fieldunmatched_patterns, in the shape of the project file ({ "pattern", "netclass" }) — the same shape asorphan_patterns, so a caller handles both alike. A pattern is listed in one of the two, never both.The board read already distinguished "parsed" from "could not read/parse" for
nets_source; that outcome now also drives the new field. Without a readable board the field isnull, not[]: an empty list would claim every pattern matched, which is the response-derived-from-the-request shape this tool exists to avoid.Alternatives considered: a per-class
unmatched_patternsbesidepatterns/matched_nets. Not done — one top-level list mirrorsorphan_patternsand keeps the change to one field; thenetclasskey on each entry makes it just as actionable.Branch and dependencies
Base branch:
upstream/main(3dbfd9a)Depends on: nothing
Series order: none — independent change
Unique commits owned by this PR: 1
Compatibility and safety
Additive response field only. Nothing renamed or removed;
orphan_patterns,patterns,matched_nets,nets_on_board,nets_sourcekeep their meaning. Read-only tool: no file or IPC mutation. Documented indocs/API_MIGRATIONS.mdunder Unreleased … (minor release), following the existing entries.Validation
All four gate commands run locally on this exact head (Windows,
stable-x86_64-pc-windows-msvc, KiCad 10.0.6 installed so the board-fixture scan runs):cargo fmt --all -- --check— exit 0cargo test --workspace --locked --lib --tests— 29 suites, 1765 passed, 0 failed, 29 ignored (two new tests:a_pattern_fitting_no_net_is_reported_as_unmatched,unmatched_patterns_is_unknown_without_a_readable_board)cargo test --workspace --locked --doc— 8 passed, 0 failedcargo clippy --workspace --locked --all-targets -- -D warnings— exit 0Measured before/after on a real two-layer board (61 nets) whose project file carries a pattern for a since-renamed net and a glob that never fitted:
HVHV_LOWorphan_patterns[{"netclass":"Vanished","pattern":"400V"}]unmatched_patterns[{"netclass":"HV","pattern":"Net-(R9-Pad2)"}, {"netclass":"HV_LOW","pattern":"HV_*"}]On the five unmodified boards (twelve patterns between them) the new field is
[], consistent with each class'spatterns/matched_netscounts.Not run: the live IPC tests (the tool is file-only and needs no running KiCad).
Review checklist
upstream/mainand has no merge conflicts; CI on this head pending at open time.upstream/main, not a release tag.docs/NAMING_CONVENTIONS.md(unmatched_patternsbesideorphan_patterns).