Repository navigation
Conversation
…orting unreadable JSON addPinToNet now throws when one physical pin is assigned to two nets, instead of keeping both net memberships while the component-side map records only the last assignment. A successful export then either round-trips through the reader or fails loudly; it no longer emits valid-hash JSON the same release rejects. Same-net re-assignment stays idempotent. Adds the pin-conflict decision table (9 cells) and its replay tests. Fixes IntelligentElectron#327.
|
Thanks for the PR and for reproducing the issue so carefully, @Huyvux12. We tested the throw on real designs before deciding. BeagleBone AI, which is public, hits it on its main processor, and with this change the whole design stops loading for every tool. The conflict there comes from a parser bug (the wrong pin map for sections numbered We opened #331. It fixes that lookup and a second one (the same part name in several libraries), and it moves the refusal to We need to run more tests on our private corpus before merging #331. Give us until next week, and we'll come back to this PR then. Generated by Claude Code |
|
Closing this one, @Huyvux12: #331 is merged and ships in v1.16.1, and it covers the case this PR was after. Your work is in there. The reproduction you confirmed is what pointed us at the assembler, and the refusal message in Thanks for the careful PR. You are credited in the release notes :) Generated by Claude Code |
Summary
A DSN design that assigns one physical pin to two nets used to export successfully and then fail to reload: the net assembler kept the pin in both net membership lists while the component-side map recorded only the last assignment, so the writer emitted JSON with a valid content hash that the same release's reader rejects. The export now surfaces the unresolved conflict instead of reporting success.
Changes
src/parsers/cadence/dsn/net-assembly.ts:addPinToNetthrows when a pin already has an assignment to a different net, naming the pin and both nets. Re-assigning the same net stays idempotent.docs/decision-tables/dsn-net-assignment/pin-conflict.{csv,spec.json,rules.json,rules.md}: new golden table for the rule (9 cells: prior assignment x incoming net, including NC).src/parsers/cadence/dsn/net-assignment.table.test.ts: replay block for the new table, one test per cell.No physical-connectivity decision is made here: which assignment is correct, and whether the source should be rejected, corrected, or reconciled, remains unverified (see #294). No schema change, no net selection, no bus merging.
Related Issues
Fixes #327
Decision tables
New logic with interacting conditions and no table, so the table was built first and is attached as part of this fix (bug fix):
New table
docs/decision-tables/dsn-net-assignment/pin-conflict, 9 cells, replayed bysrc/parsers/cadence/dsn/net-assignment.table.test.ts("pin-conflict: one physical pin, one net"):The replay passes (72/72 in
net-assignment.table.test.ts, 9 of them the new cells). NC counts as a net name here: a pin recorded unconnected and also connected is the same conflict. That differs frommergeRepeatedSections, which tolerates NC when folding twin copies of a repeated section — a cross-key fold, not a same-key assignment — so it is unaffected.Verification
Built the
packagedbinary from this branch (scripts/build-binary.sh host <dir>/universal-netlist packaged, Bun 1.4.4) and drove the CLI and the MCP server over stdio. Verdict: PASS.Control — CLI export of a real golden design still succeeds and reloads:
Off the happy path — CLI export of the conflicting document generated by the released v1.16.0 code now fails loudly instead of writing a file:
MCP over stdio —
list_netson the golden design returns its nets; on the conflicting document it returns the same reader error as an error result, not a crash:The fix itself was verified against the issue's 6-case reproduction (
assembleNets+buildComponents+ writer + reader round-trip), before and after:Before (released v1.16.0 and local
main@60d3ef7): 3 controls readable; 3 conflict cases produce valid-hash JSON the reader rejects (net 'NET_A' lists U1.OUT4, but U1.OUT4 is on 'NET_B'), and reversing the records reverses the selected net.After (this branch): the 3 conflict cases throw at assembly —
Pin U1.OUT4 is assigned to both 'NET_A' and 'NET_B'; a physical pin belongs to one net, so the netlist cannot be built until the conflicting assignments are resolved.— and the 3 controls still export and reload.Why the throw lives in the assembler rather than the writer: the assembled graph is already incoherent before serialization — queries read both sides (
componentPinsvsnets) and would return contradictory answers — so serving it is silently wrong, and the writer cannot name the cause as precisely. The alternative (validate inserializeUniversalNetlist) would confine the failure to export only; if the maintainer prefers that, the fallback is a small validation reusing the same message. No in-repo design hits the throw: all 21 golden Cadence netlists are inverse-consistent, and #247's two remaining duplicate-refdes designs are renamed apart byseparateDuplicateRefdesbefore assembly.Testing
Added/updated tests
npm run type-checkpassesnpm run lintpassesnpm testpasses (see scope note below)Base SHA on upstream:
60d3ef7(reproduced and fixed on this commit).Repro commands:
node reproduce.mjs ./runtime/node_modules/@intelligentelectron/universal-netlist(v1.16.0, 6 cases as in Export/reload inconsistency: conflicting physical pin assignments produce unreadable JSON #327) and the same script against the local build; post-fix checknode verify-fix.mjs ./upstream(3 conflicts surface at assembly, 3 controls export and reload).Regression scope:
npm run type-check(0 errors),npm run lint(0 warnings/errors),npm testwith the Cadence fixtures checked out: 2882 passed / 18 failed / 231 skipped. All 18 failures were triaged and none is an assertion failure or caused by this change: 8 are timeouts on this 1.5-CPU VM (the same files pass in isolation, including the golden suite 92/92 and the DSN suite), 9 need the Altium/KiCad fixtures (this checkout fetched Cadence only; CI runs the full corpus), and 1 is the known root-userDiskCacheStoreartifact. The pre-existing failures were verified identical on the clean tree by running the affected files with the fix stashed.Diff scope: 2 source/test files changed (+16 in
net-assembly.ts, +43 in the table test) and 4 new table files. NoCHANGELOG.mdor version change, per CONTRIBUTING.Risks checked and ruled out: legitimate duplicate pins (every duplicate path — duplicate refdes, repeated sections, multi-root drawings — is renamed apart before assembly, and same-net repeats stay idempotent); cache poisoning (a throwing parse is never cached:
store.setruns only afterproducesucceeds); Altium/KiCad paths (out of scope for Export/reload inconsistency: conflicting physical pin assignments produce unreadable JSON #327; they build nets without this component-side map, and KiCad groups each pin under one net by construction).