fix: avoid net-label connector traces crossing other nets (#674)#703
fix: avoid net-label connector traces crossing other nets (#674)#703DPS0340 wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Progress on tscircuit#674. AvailableNetOrientationSolver generated connector traces (from a label's original anchor to its corrected position) without checking whether the connector crosses an existing trace from a different net. Each crossing renders as a false junction. On the tscircuit#674 board this produced 3 crossings, e.g. the V3_3 connector slicing through the JP1.1-SJ3.1 trace; example45 and bug-report-20260708T055430Z each had one more. Candidate evaluation now rejects candidates whose connector would cross another net's trace, with a fallback pass that permits crossings when no crossing-free candidate exists (so orientation constraints still win over crossing avoidance, matching repro51's pinned behavior). Crossings drop 2->1 on example45 and bug-report-20260708T055430Z (snapshots updated). The tscircuit#674 board's remaining 3 crossings need connector rerouting around blocking traces — pinned with a test.failing for follow-up.
f73e581 to
0a2d382
Compare
|
Rebased onto current |
|
@mohan-bee thanks again for #700 — if you're up for one more, this is the next real fix in the same area (5 files). I re-verified the numbers against current
To be upfront about the limitation: the three crossings on the #674 board itself are not fixed here. Their shifted-anchor candidates are walled in by another net's trace along the whole shift axis, so resolving them needs the connector routed around the blocking trace rather than the anchor shifted. That's a bigger change, so I pinned them with a Full suite: 145 pass / 0 fail. Rebased onto current Happy to do the connector-rerouting pass as a follow-up if this direction looks right to you. |
There was a problem hiding this comment.
why no snapshots for this ?
|
@mohan-bee good catch — fixed in c18cc86. The reason there was no snapshot: the existing assertion is That makes the three remaining crossings visually reviewable instead of just being a number in an assertion, and it'll catch any visual regression while the connector-rerouting follow-up is still outstanding. Full suite: 146 pass / 0 fail. |
Following @mohan-bee's snapshot feedback on tscircuit#703/tscircuit#707, applying the same here pre-emptively: the assertion only checked which labels overlapped a chip body, so the board was never rendered. Now the relocated labels are visually reviewable.
There was a problem hiding this comment.
i still don't see anything .. for this input.json
|
@mohan-bee you were right, and I misread your first comment — sorry for the round trip. I thought you were asking me to add a snapshot, so I added one. The actual problem was that the Fixed in 5c8a733:
So no hand-made bug reports and no duplicated board. Full suite 145 pass / 0 fail. Separately, e3cb03c actually fixes part of what this PR was leaving behind. The remaining crossings had a root cause I'd missed: labels are processed one at a time, so a connector is only validated against traces that exist at that moment. On this board Added a post-pass that runs once every connector exists and swaps in the mirrored L-route where that clears a crossing:
The last 2 on the #674 board are still walled in — the mirrored route crosses something too, so those need the connector routed around the blocker. Still pinned by the existing Happy to split that post-pass into its own PR if you'd rather keep this one to the original scope. |
Applying @mohan-bee's feedback from tscircuit#703/tscircuit#707 here too. The tscircuit#655 board is already a bot-imported bug report (bug-report-20260707T230831Z) with its own snapshot test, so the snapshot I added to this repro duplicated it. The repro keeps only the assertion specific to tscircuit#655 — which labels overlap a chip body. That assertion still fails on main and passes here. Full suite 145 pass / 0 fail.
@mohan-bee was right that the hand-made bug report was wrong. The tscircuit#674 issue already has a bot-imported report at tests/bug-reports/bug-report-20260717T022934Z (directory name derived from the issue's created_at by .github/scripts/import-json-bug-report.ts), and I had hand-created a second directory holding a byte-identical copy. Removes the hand-made directory and points the repro at the existing bug report, which already carries its own snapshot test. Full suite 145 pass / 0 fail.
5c8a733 to
a8b95d9
Compare
|
Cleaned this PR back to its original scope (a8b95d9). It's now just two commits:
The post-pass work I mentioned has been split out into #716 as you'd expect, so this PR stays reviewable on its own. #716 is stacked on this branch, so this one goes first. Worth mentioning what #716 turned up, since it changes the story here: I said the remaining crossings needed "routing around the blocking trace", and that turned out to be exactly right — for the last two, the blocker sits between the endpoints on both axes, so no L-shape avoids it. With detours added, the #674 board goes to 0 crossings and the repro's assertion is no longer This PR on its own: full suite 145 pass / 0 fail, CI green. |
The previous commit added tests/bug-reports/bug-report-636/, which repeats the mistake @mohan-bee already flagged on tscircuit#703/tscircuit#707: bug report directories are generated by .github/scripts/import-json-bug-report.ts and named from the issue's created_at, so they must not be hand-created. Issue tscircuit#636 was opened at 2026-07-07T23:08:31Z, and the bot-imported report for it already exists as bug-report-20260707T230831Z. The hand-made bug-report-636.json was a byte-identical copy of it — so tscircuit#636 is not a second board as its comment claimed, it is the same board tscircuit#655 already covers. Removes the duplicate directory and the duplicate test file, keeping the one assertion tscircuit#636 added that tscircuit#655 did not have: labels must stay on an orientation the input allows. Both assertions fail on main and pass here. Full suite 146 pass / 0 fail.
Same issue @mohan-bee flagged on tscircuit#703/tscircuit#707: bug report directories are generated by .github/scripts/import-json-bug-report.ts and named from the issue's created_at, so they must not be hand-created. Issue tscircuit#670 was opened at 2026-07-16T14:48:56Z and its bot-imported report already exists as bug-report-20260716T144856Z. The hand-made bug-report-20260716-long-trace-670/input.json was a byte-identical copy. Removes the duplicate and points the repro at the existing bug report. Full suite 145 pass / 0 fail.
|
@MustafaMulla29 @ShiboSoftwareDev — adding you two; you're the top two mergers here (19 and 10 of the last ~60) and I'd only tagged @mohan-bee. Small: 4 files, but only 2 are source — Progress on #674. Net-label connector traces were being routed across other nets' traces. The connector is validated only against traces that exist at the moment it's routed, so a connector created early can't see one created later — concretely, This picks the mirrored L-route when the default one crosses. Measured different-net crossings vs The #674 board's own 3 crossings are unchanged here — those need the detour routing, which is split into #716 (stacked on this one) to keep this PR reviewable. #716 takes that board 3 → 0. Full suite green, |
|
Closing this in favour of #719, which fixes the same root cause more effectively. I should have caught the duplication before opening both — apologies for the extra review surface. Both PRs add the same missing check to
I measured both against Per board, this PR is worse on six of them:
The reason is that the fallback fires on nearly every label, so this PR degrades to the original behaviour and removes one crossing out of forty. The retry was meant to guarantee a label still gets placed, but in practice it just disables the fix. They are also not stackable — merging both would leave the disabled-check path as dead code alongside a redundant scan. So: #719 is the one worth reviewing, and it is best read after #718, which adds the counter both were measured with. On @mohan-bee's review here — the snapshots and the bot-imported bug report were addressed in the commits above, and that work carries over to #719, so nothing is lost by closing this. |
Same issue @mohan-bee flagged on tscircuit#703/tscircuit#707: bug report directories are generated by .github/scripts/import-json-bug-report.ts and named from the issue's created_at, so they must not be hand-created. Issue tscircuit#670 was opened at 2026-07-16T14:48:56Z and its bot-imported report already exists as bug-report-20260716T144856Z. The hand-made bug-report-20260716-long-trace-670/input.json was a byte-identical copy. Removes the duplicate and points the repro at the existing bug report. Full suite 145 pass / 0 fail.
Following @mohan-bee's snapshot feedback on tscircuit#703/tscircuit#707, applying the same here pre-emptively: the assertion only checked which labels overlapped a chip body, so the board was never rendered. Now the relocated labels are visually reviewable.
Applying @mohan-bee's feedback from tscircuit#703/tscircuit#707 here too. The tscircuit#655 board is already a bot-imported bug report (bug-report-20260707T230831Z) with its own snapshot test, so the snapshot I added to this repro duplicated it. The repro keeps only the assertion specific to tscircuit#655 — which labels overlap a chip body. That assertion still fails on main and passes here. Full suite 145 pass / 0 fail.
The previous commit added tests/bug-reports/bug-report-636/, which repeats the mistake @mohan-bee already flagged on tscircuit#703/tscircuit#707: bug report directories are generated by .github/scripts/import-json-bug-report.ts and named from the issue's created_at, so they must not be hand-created. Issue tscircuit#636 was opened at 2026-07-07T23:08:31Z, and the bot-imported report for it already exists as bug-report-20260707T230831Z. The hand-made bug-report-636.json was a byte-identical copy of it — so tscircuit#636 is not a second board as its comment claimed, it is the same board tscircuit#655 already covers. Removes the duplicate directory and the duplicate test file, keeping the one assertion tscircuit#636 added that tscircuit#655 did not have: labels must stay on an orientation the input allows. Both assertions fail on main and pass here. Full suite 146 pass / 0 fail.
Following @mohan-bee's snapshot feedback on tscircuit#703/tscircuit#707, applying the same here pre-emptively: the assertion only checked which labels overlapped a chip body, so the board was never rendered. Now the relocated labels are visually reviewable.
Applying @mohan-bee's feedback from tscircuit#703/tscircuit#707 here too. The tscircuit#655 board is already a bot-imported bug report (bug-report-20260707T230831Z) with its own snapshot test, so the snapshot I added to this repro duplicated it. The repro keeps only the assertion specific to tscircuit#655 — which labels overlap a chip body. That assertion still fails on main and passes here. Full suite 145 pass / 0 fail.
The previous commit added tests/bug-reports/bug-report-636/, which repeats the mistake @mohan-bee already flagged on tscircuit#703/tscircuit#707: bug report directories are generated by .github/scripts/import-json-bug-report.ts and named from the issue's created_at, so they must not be hand-created. Issue tscircuit#636 was opened at 2026-07-07T23:08:31Z, and the bot-imported report for it already exists as bug-report-20260707T230831Z. The hand-made bug-report-636.json was a byte-identical copy of it — so tscircuit#636 is not a second board as its comment claimed, it is the same board tscircuit#655 already covers. Removes the duplicate directory and the duplicate test file, keeping the one assertion tscircuit#636 added that tscircuit#655 did not have: labels must stay on an orientation the input allows. Both assertions fail on main and pass here. Full suite 146 pass / 0 fail.
Progress on #674.
Problem
AvailableNetOrientationSolvergenerates a connector trace from a label's original anchor to its corrected position, but never checks whether that connector crosses an existing trace from a different net. Every such crossing renders as a false junction on the schematic.On the #674 board (
_board#665input), 3 crossings appear:example45andbug-report-20260708T055430Zeach had one more (visible in their snapshots as a GND connector slicing through a same-column V3_3 trace).Fix
getCandidateStatusnow computes the candidate's connector trace and rejects the candidate (trace-collision) when the connector would cross another net's trace. A fallback pass inprocessLabelre-runs the search allowing crossings when no crossing-free candidate exists — so the orientation constraint still wins over crossing avoidance (this preserves repro51's pinned "orientation over purity" behavior; that test still passes unchanged).Results
example45: crossings 2 → 1 (snapshot updated; the GND connector now attaches from the clear side)bug-report-20260708T055430Z: crossings 2 → 1 (snapshot updated)#674board: the shifted-anchor candidates for the remaining 3 are all walled in by another net's trace along the entire shift axis — fixing those requires routing the connector around the blocking trace, which is a bigger change. Pinned with atest.failingregression (board input included) so the remaining work is tracked by CI and this PR stays reviewable.Verification
bun test— 141 pass, 0 fail (1 new intentionaltest.failing)bunx tsc --noEmit/biome check— cleanHappy to follow up with the connector-rerouting pass for the walled-in cases if this direction looks right.