Skip to content

fix: don't create traces for net-label-only connections#132

Open
blessuselessk wants to merge 2 commits intotscircuit:mainfrom
blessuselessk:fix/extra-net-label-repro61
Open

fix: don't create traces for net-label-only connections#132
blessuselessk wants to merge 2 commits intotscircuit:mainfrom
blessuselessk:fix/extra-net-label-repro61

Conversation

@blessuselessk
Copy link

@blessuselessk blessuselessk commented Mar 19, 2026

/claim #79

Summary

Fixes #79 — Traces were incorrectly drawn between pins connected only via net labels (e.g., GND/VCC netConnections). Net labels are meant to visually represent virtual connections without physical traces.

Root cause: ConnectivityMap stores its netMap constructor argument by reference. In getConnectivityMapsFromInputProblem, netConnMap was constructed with directConnMap.netMap, so both maps shared the same underlying object. When netConnMap.addConnections() added net-label entries, they also appeared in directConnMap.netMap. Both MspConnectionPairSolver and LongDistancePairSolver then created trace pairs for net-label-only pins.

Three fixes:

  1. getConnectivityMapsFromInputProblem: Deep-clone netMap before passing to netConnMap constructor to prevent cross-contamination
  2. MspConnectionPairSolver: Queue only directConnMap net IDs and use dcConnMap (not globalConnMap) to find connected pins
  3. LongDistancePairSolver: Use directConnMap for candidate pair generation instead of netConnMap

Test plan

  • Added SchematicTracePipelineSolver_repro61.test.ts — two capacitors connected only via GND/VCC net labels, asserts 0 MSP pairs and net labels still placed
  • Updated MspConnectionPairSolver_repro1 assertion (4 → 2 pairs, since GND was a netConnection)
  • Updated 17 SVG snapshots reflecting correct trace removal
  • All 50 tests pass, 0 failures

Net connections (netConnections) represent virtual connections shown via
net labels -- they should NOT produce physical traces. Only direct
connections (directConnections) should generate MSP pairs and traces.

Root cause: ConnectivityMap constructor stores its netMap argument by
reference. When getConnectivityMapsFromInputProblem passed
directConnMap.netMap to the netConnMap constructor, both maps shared the
same underlying object. Calling netConnMap.addConnections() for
net-label entries then polluted directConnMap.netMap too. Both
MspConnectionPairSolver and LongDistancePairSolver used the polluted
maps to create trace pairs for net-label-only pins.

Three fixes:
1. getConnectivityMapsFromInputProblem: deep-clone netMap before passing
   to netConnMap constructor to prevent cross-contamination
2. MspConnectionPairSolver: queue only directConnMap net IDs and use
   dcConnMap (not globalConnMap) to find connected pins
3. LongDistancePairSolver: use directConnMap for candidate pair
   generation instead of netConnMap

Fixes tscircuit#79
@vercel
Copy link

vercel bot commented Mar 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
schematic-trace-solver Ready Ready Preview, Comment Mar 19, 2026 0:18am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix extra net label in repro61, or remove trace

1 participant