Skip to content

Add close same-net trace cleanup phase#397

Open
Haenlein1 wants to merge 1 commit into
tscircuit:mainfrom
Haenlein1:haenlein1/issue-29-combine-close-same-net
Open

Add close same-net trace cleanup phase#397
Haenlein1 wants to merge 1 commit into
tscircuit:mainfrom
Haenlein1:haenlein1/issue-29-combine-close-same-net

Conversation

@Haenlein1
Copy link
Copy Markdown

@Haenlein1 Haenlein1 commented May 21, 2026

/claim #29
/claim #34

Hi, I completed the requested task.

Summary:

  • Added a final TraceCleanupSolver phase that combines close same-net trace segments.
  • The new cleanup helper aligns close overlapping horizontal/vertical internal segments only when they share the same globalConnNetId.
  • Endpoint segments stay fixed, different-net traces are ignored, and candidate moves are rejected if they introduce a new different-net intersection.
  • This covers Merge same-net trace lines that are close together (make at the same Y or same X) #34's same-net same-Y/same-X requirement without opening a duplicate PR for the same implementation.
  • Important files changed:
    • lib/solvers/TraceCleanupSolver/combineCloseSameNetSegments.ts
    • lib/solvers/TraceCleanupSolver/TraceCleanupSolver.ts
    • tests/solvers/TraceCleanupSolver/combine-close-same-net-segments.test.ts

#34 verification notes:

  • Focused reproduction before behavior: trace a has an internal same-net horizontal run at y = 1, while trace b has an overlapping internal run at y = 1.1.
  • After the cleanup phase, trace b snaps its internal run to y = 1 while its endpoint legs remain attached.
  • The same focused test also verifies different-net traces are not aligned and unsafe different-net intersections are rejected.

Verification:

  • npx --yes bun test tests\solvers\TraceCleanupSolver\combine-close-same-net-segments.test.ts tests\examples\example29.test.ts tests\examples\example34.test.ts tests\solvers\TraceCleanupSolver\TraceCleanupSolver.test.ts
  • .\node_modules.bin\tsc.exe --noEmit
  • npx --yes bun run build
  • npx biome lint lib\solvers\TraceCleanupSolver\combineCloseSameNetSegments.ts tests\solvers\TraceCleanupSolver\combine-close-same-net-segments.test.ts lib\solvers\TraceCleanupSolver\TraceCleanupSolver.ts
  • npx biome format lib\solvers\TraceCleanupSolver\TraceCleanupSolver.ts lib\solvers\TraceCleanupSolver\combineCloseSameNetSegments.ts tests\solvers\TraceCleanupSolver\combine-close-same-net-segments.test.ts
  • git diff --check

Notes:

  • Full npx --yes bun test was also run: 63 passed, 4 skipped, and one unrelated render-comparison test timed out at 5s. Rerunning that failed test alone passed.
  • Full npx biome format . reports existing repo-wide CRLF/LF normalization differences, so I verified formatting on the touched files instead.

Bounty/issues:

Please review, and if everything looks good, approve/release the milestone/order.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 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 21, 2026 6:24am

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.

1 participant