Skip to content

Add same-net trace consolidation phase#411

Open
ColumbusLabs wants to merge 3 commits into
tscircuit:mainfrom
ColumbusLabs:algora-tscircuit-same-net-trace-merge
Open

Add same-net trace consolidation phase#411
ColumbusLabs wants to merge 3 commits into
tscircuit:mainfrom
ColumbusLabs:algora-tscircuit-same-net-trace-merge

Conversation

@ColumbusLabs
Copy link
Copy Markdown

@ColumbusLabs ColumbusLabs commented May 22, 2026

Summary

  • Add a dedicated SameNetTraceConsolidationSolver pipeline phase after trace cleanup and before final label placement.
  • Consolidate close same-net horizontal and vertical trace segments onto the longest compatible segment coordinate.
  • Preserve pin anchors and trace metadata by using terminal jogs instead of moving endpoints.
  • Reject unsafe candidates that would create diagonals, increase chip collisions, or add different-net intersections.
  • Keep downstream label placement and example rendering on the consolidated trace output.

Fixes #29.
Addresses #34 by aligning close same-net segments onto a shared X/Y coordinate.

Why this approach

This keeps the behavior in a standalone solver phase, matching #29's request for a new pipeline phase rather than folding the logic into unrelated cleanup code. The phase is intentionally conservative: it groups only same-net orthogonal segments, uses deterministic ordering, preserves endpoint anchors, and refuses changes that make collisions worse.

Coverage

  • Focused solver coverage for horizontal and vertical consolidation.
  • No-op coverage for different nets and distant projections.
  • Endpoint preservation coverage for terminal jogs and endpoint-only traces.
  • Collision guards for chip obstacles and different-net intersections, including later-pass interactions.
  • Pipeline coverage proving final label placement and downstream solvers consume consolidated traces.
  • Visual regression coverage in example38 after rebasing around upstream's newly merged example37.

Verification

  • bun test tests/solvers/SameNetTraceConsolidationSolver/SameNetTraceConsolidationSolver.test.ts tests/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver_sameNetTraceConsolidationPhase.test.ts tests/examples/example38.test.ts -> 13 pass, 0 fail
  • bun test -> 73 pass, 4 skip, 0 fail
  • bun run format:check -> pass
  • bun run build -> pass
  • git diff --check -> pass

Note: GitHub Actions check suites for this fork currently show action_required/awaiting maintainer approval, so the repository's Bun Test, Format Check, and Type Check workflows are not visible on the PR yet. I ran their local equivalents above; Vercel is green.

/claim #29
/claim #34

@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 26, 2026 10:30pm

Request Review

@ColumbusLabs
Copy link
Copy Markdown
Author

Rebased onto latest main; moved the same-net consolidation repro from example37 to example38 to avoid the newly merged repro-37 conflict. Local bun test, bun run format:check, and bun run build pass.

@ColumbusLabs
Copy link
Copy Markdown
Author

Updated the PR body to include the #34 claim and added a traceability comment on issue #34: #34 (comment)

The PR is rebased and mergeable. Vercel is green. The repository GitHub Actions suites for Bun Test, Format Check, and Type Check are currently action_required for this fork, so they need maintainer approval before they will appear on the PR; I ran the local equivalents after the rebase:

  • bun test -> 73 pass, 4 skip, 0 fail
  • bun run format:check -> pass
  • bun run build -> pass
  • git diff --check -> pass

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.

New Phase To combine same-net trace segments that are close together

1 participant