Skip to content

Add grouped same-net trace segment alignment#407

Open
blackblue1 wants to merge 1 commit into
tscircuit:mainfrom
blackblue1:codex/align-same-net-trace-segments
Open

Add grouped same-net trace segment alignment#407
blackblue1 wants to merge 1 commit into
tscircuit:mainfrom
blackblue1:codex/align-same-net-trace-segments

Conversation

@blackblue1
Copy link
Copy Markdown

/claim #29
/claim #34

Summary

  • Adds an aligning_same_net_segments TraceCleanupSolver phase after untangling and before turn minimization.
  • Groups nearby same-net interior segments by net and orientation, then aligns each group to the longest segment axis so close traces share the same X/Y line.
  • Keeps endpoint-only segments anchored and rejects moves that would add chip, different-net trace, or different-net label intersections.

Proof / reproduction

  • Focused unit coverage for horizontal groups, vertical alignment, different-net no-op behavior, endpoint-only no-op behavior, same-trace no-op behavior, and blocked chip intersection rejection.
  • Updated example18/example19 SVG snapshots where the cleanup phase now coalesces nearby same-net segments.
  • Verified example29 and example34 still pass against their snapshots.

AI assistance

This work was implemented with AI assistance and verified locally before submission.

Tests

  • npx biome check lib/solvers/TraceCleanupSolver/TraceCleanupSolver.ts lib/solvers/TraceCleanupSolver/alignSameNetTraceSegments.ts tests/solvers/TraceCleanupSolver/align-same-net-trace-segments.test.ts
  • git diff --check
  • npx bun test tests/solvers/TraceCleanupSolver/align-same-net-trace-segments.test.ts tests/solvers/TraceCleanupSolver tests/examples/example29.test.ts tests/examples/example34.test.ts
  • npm exec --package typescript@5.9.3 -- tsc --noEmit
  • npm run build
  • npx bun test

The cleanup solver now runs a bounded alignment phase after untangling so close interior segments on the same net share the longest nearby axis before later simplification steps run. The phase leaves terminal segments anchored and rejects moves that would add chip, label, or different-net trace intersections.

Constraint: Algora bounty issues tscircuit#29 and tscircuit#34 ask for close same-net trace segments to be combined/aligned without breaking pin attachments.

Rejected: Move endpoint segments too | would detach traces from pins and labels.

Rejected: Treat same-net traces as obstacles | would prevent the intended overlap/coalescing behavior.

Confidence: medium

Scope-risk: moderate

Directive: Keep same-net alignment before turn minimization so later cleanup can simplify the adjusted paths.

Tested: npx bun test

Tested: npm exec --package typescript@5.9.3 -- tsc --noEmit

Tested: npm run build

Not-tested: Browser demo video capture in the Vercel/Cosmos UI.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 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 22, 2026 9:16am

Request Review

@blackblue1
Copy link
Copy Markdown
Author

/claim #34

Traceability for issue #34: this PR aligns close same-net horizontal/vertical interior segments onto a shared Y/X axis, preserves endpoints, and rejects unsafe chip/different-net collisions. CI is green for Bun Test, Format Check, Type Check, Vercel, and Vercel Preview Comments.

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