Skip to content

Add same-net trace combining phase#368

Open
1aday wants to merge 2 commits into
tscircuit:mainfrom
1aday:codex/same-net-trace-combining-bounty
Open

Add same-net trace combining phase#368
1aday wants to merge 2 commits into
tscircuit:mainfrom
1aday:codex/same-net-trace-combining-bounty

Conversation

@1aday
Copy link
Copy Markdown

@1aday 1aday commented May 20, 2026

/claim #29

Summary

  • add a dedicated SameNetTraceCombiningSolver post-cleanup pipeline phase
  • group traces by globalConnNetId and snap close overlapping same-net internal horizontal/vertical segments onto a shared axis
  • preserve terminal pin segments and reject candidates that introduce new different-net intersections

Verification

  • bun test tests/solvers/SameNetTraceCombiningSolver/SameNetTraceCombiningSolver.test.ts
  • bun test
  • bunx tsc --noEmit
  • bun run format:check
  • bun run build

@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 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 20, 2026 12:58am

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 07e441c29e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +386 to +392
if (
!this.isStrictlyBetween(vertical.axis, horizontal.min, horizontal.max)
) {
return null
}
if (!this.isStrictlyBetween(horizontal.axis, vertical.min, vertical.max)) {
return null
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject endpoint net touches when validating a snap

Treating orthogonal intersections as valid only when both coordinates are strictly inside each segment misses new endpoint contacts between different nets. If a moved segment endpoint lands on another-net segment (a T-junction or endpoint touch), getSegmentIntersectionKey returns null, so canApplyCandidate can accept a geometry that electrically shorts nets. This path is reachable whenever an internal segment is shifted onto a nearby axis and one end aligns with an existing different-net segment.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a5cc264: endpoint contacts now count as intersections during candidate validation, including orthogonal endpoint touches and collinear endpoint touches. That makes canApplyCandidate reject snaps that would create a new different-net touch. Added a regression for the exact endpoint-touch case.

Verification:

  • bun test tests/solvers/SameNetTraceCombiningSolver/SameNetTraceCombiningSolver.test.ts
  • bun run format:check
  • bunx tsc --noEmit
  • bun test
  • bun run build
  • git diff --check

Comment on lines +235 to +242
const oldIntersections = this.getDifferentNetIntersectionKeys(sourceTrace)
const newIntersections = this.getDifferentNetIntersectionKeys(proposedTrace)

for (const key of newIntersections) {
if (!oldIntersections.has(key)) return false
}

return true
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate chip-obstacle collisions before applying snaps

Candidate acceptance only compares different-net trace intersections and never checks chip obstacle crossings, so a snap can move a legal segment into a chip/body obstacle and still be accepted. Because this phase runs after cleanup in the pipeline and no later phase globally revalidates trace-vs-chip collisions, the final routed traces can become physically invalid for some layouts with nearby parallel same-net segments and tight chip clearances.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a5cc264: same-net snap validation now compares chip-obstacle collision keys before and after the proposed move and rejects any newly introduced chip/body collision. Pin endpoint chips are only excluded when the segment leaves the chip rather than entering it. Added a regression where the moved connector would enter a nearby chip obstacle.

Verification:

  • bun test tests/solvers/SameNetTraceCombiningSolver/SameNetTraceCombiningSolver.test.ts
  • bun run format:check
  • bunx tsc --noEmit
  • bun test
  • bun run build
  • git diff --check

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