Skip to content

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

Open
aifunmobi wants to merge 1 commit intotscircuit:mainfrom
aifunmobi:fix/no-traces-for-net-label-connections
Open

fix: don't create traces for net-label-only connections#116
aifunmobi wants to merge 1 commit intotscircuit:mainfrom
aifunmobi:fix/no-traces-for-net-label-connections

Conversation

@aifunmobi
Copy link

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 shared its netMap by reference between directConnMap and netConnMap in getConnectivityMapsFromInputProblem. 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: Clone netMap before passing to netConnMap constructor to prevent cross-contamination
  2. MspConnectionPairSolver: Iterate over 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_repro04_net_label_only.test.ts — two capacitors connected only via GND/VCC net labels, asserts 0 MSP pairs and 0 traces
  • Updated MspConnectionPairSolver_repro1 assertion (4 → 2 pairs, since GND was a netConnection)
  • Updated 16 SVG snapshots reflecting correct trace removal
  • All 50 tests pass, 0 type errors

🤖 Generated with Claude Code

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 shared its netMap by reference between
directConnMap and netConnMap, causing net-label connections to pollute
the direct connection map. Both MspConnectionPairSolver and
LongDistancePairSolver then used the polluted global map to create
trace pairs for net-label-only pins.

Three fixes:
1. Clone netMap in getConnectivityMapsFromInputProblem to prevent
   directConnMap pollution
2. MspConnectionPairSolver: iterate over directConnMap nets and use
   directConnMap to find connected pins
3. LongDistancePairSolver: use directConnMap for candidate pair
   generation instead of netConnMap

Closes tscircuit#79

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 8, 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 Feb 8, 2026 8:34pm

Request Review

@aifunmobi
Copy link
Author

Hi — just checking in on this. CI is passing. Let me know if there's anything to adjust!

@aifunmobi
Copy link
Author

@seveibar Just following up on this one — fixes the extra net label bug in repro61. All CI checks passing. Happy to make any changes needed!

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.

Fix extra net label in repro61, or remove trace

1 participant