Skip to content

feat: add SameNetTraceCombiningSolver to merge close collinear same-net traces#276

Open
chengyixu wants to merge 3 commits intotscircuit:mainfrom
chengyixu:pr275
Open

feat: add SameNetTraceCombiningSolver to merge close collinear same-net traces#276
chengyixu wants to merge 3 commits intotscircuit:mainfrom
chengyixu:pr275

Conversation

@chengyixu
Copy link
Copy Markdown

@chengyixu chengyixu commented May 4, 2026

What this PR does

Merges same-net trace segments that are collinear (same X or Y axis) and close together (gap <= 0.15), reducing visual clutter by combining redundant parallel traces into single cleaner lines.

How to test

bun test tests/solvers/SameNetTraceCombiningSolver/SameNetTraceCombiningSolver.test.ts

Before / After

Before: Same-net traces from different MSP pairs rendered as separate overlapping/parallel lines, cluttering the schematic with redundant visual elements.

After: Collinear same-net segments within 0.15 gap tolerance are merged into a single line. 10 snapshot files updated showing cleaner output (examples 01, 02, 07, 13, 14, 15, 18, 19, 21, 27, 29).

Which issues this fixes

Fixes #29 (combine same-net traces)
Fixes #34 (merge close collinear traces)

Pipeline position

Inserted after TraceCleanupSolver, before NetLabelPlacementSolver. Downstream solvers fall back gracefully when the combiner is absent.

Test results

  • 8 new unit tests (horizontal/vertical merges, net isolation, gap rejection, overlapping, empty input, simplifyTracePath)
  • All 60+ existing tests pass with 10 snapshot updates reflecting merged traces

/claim #29
/claim #34

chengyixu and others added 3 commits May 5, 2026 02:29
…(issue tscircuit#79)

Deep-clone directConnMap.netMap when creating netConnMap to prevent
shared-reference mutations. In MspConnectionPairSolver, route direct-wire
nets through dcConnMap (not globalConnMap) to exclude net-label-only pins
that share a net name from getting merged into wire routing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Regenerate 6 stale snapshot SVGs after rebase onto main
- Fix biome formatting in repro79 test (single-line arrays)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…et traces

Implements a post-processing solver that identifies and merges collinear
(horizontal at same Y, vertical at same X) trace segments belonging to
the same net when they are within COLLINEAR_TOLERANCE (0.05) and
GAP_TOLERANCE (0.15). The solver extends one segment to span the
combined range and collapses the redundant segment, then simplifies
trace paths by removing zero-length segments.

Includes 8 unit tests covering horizontal/vertical merges, different-net
isolation, large-gap rejection, overlapping segments, and edge cases.

Pipeline position: after TraceCleanupSolver, before NetLabelPlacementSolver.

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

vercel Bot commented May 4, 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 May 4, 2026 6:47pm

Request Review

@chengyixu
Copy link
Copy Markdown
Author

Hi maintainers, friendly ping for a review on this one when you get a chance. All CI checks are green (test, format, type-check, Vercel preview). This PR adds a SameNetTraceCombiningSolver that covers issues #29 ($100) and #34 ($100). Happy to address any feedback. Thanks!

@chengyixu
Copy link
Copy Markdown
Author

Hey @seveibar — gentle ping for review on this one. CI is green, mergeable, and it addresses both #29 and #34. Would appreciate a look when you have a moment!

@chengyixu
Copy link
Copy Markdown
Author

Hi! This PR is CI green and ready for merge when you have a moment. Thanks!

@chengyixu
Copy link
Copy Markdown
Author

@seveibar gentle ping on this and a few related PRs (#274, #275) - all CI green and ready for review. Thanks!

@chengyixu
Copy link
Copy Markdown
Author

Hey @seveibar -- all CI is green on these 4 PRs totaling $500 in bounties:

The fixes are surgical and well-tested. Would appreciate a review when you have a moment.

@chengyixu
Copy link
Copy Markdown
Author

Hi @seveibar, all CI checks are passing ✅ (test, format-check, type-check, Vercel). This PR is ready for review and merge whenever you have a moment. Thanks!

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

Projects

None yet

1 participant