fix: keep the widest nominalTraceWidth when merging connections (#1721) - #1773
fix: keep the widest nominalTraceWidth when merging connections (#1721)#1773DPS0340 wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Benchmark This PRRun benchmarks by commenting on this PR: Comment Everything after Use Any PR whose title contains |
The CI format-check was failing on the multi-line Math.max call.
|
@imrishabh18 mind taking a look at this one when you get a chance? 2 files, +137/-8. In Tests cover the merge cases (5 pass). I just pushed a formatting fix — the earlier |
|
@0hmX adding you — you've merged 7 of the last ~25 non-bot PRs here, and I'd only tagged @imrishabh18. Whoever gets to it. Small: the source change is 14 lines in Addresses the root cause behind #1721 (1.0 mm motor traces emitted at 0.15 mm). // Take the nominalTraceWidth from the first connection for now
if (nominalTraceWidth === undefined && conn.nominalTraceWidth !== undefined) {
nominalTraceWidth = conn.nominalTraceWidth
}These are minimum requirements, so a 1 mm motor output merging with a thinner branch on the same net loses its requirement whenever the thin branch is visited first. That explains the reporter's observation that the loss is branch/merge dependent rather than a global parsing failure — it was connection order, not the value. The fix takes the max across the merged group. Demonstrated on Full suite: 411 pass / 13 fail vs 406 pass / 13 fail on unmodified |
|
Process note, not code: this repo's stalebot closes PRs after 3 days of inactivity ( That's not theoretical — in So if this one sits, it will be closed on its own regardless of whether the fix is wanted. To avoid me bumping it purely to outrun a bot, either:
For the merge decision itself, it's 14 lines of source ( CI is green (12 checks), |
c307c7d to
0139f75
Compare
|
This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. |
|
This PR was closed because it has been inactive for 1 day since being marked as stale. |
Addresses the root cause behind #1721, where 1.0 mm motor traces were emitted at 0.15 mm.
Root cause
mergeConnectionsmerges everySimpleRouteConnectionthat shares a point into one connection, but it kept only the firstnominalTraceWidthit happened to encounter:These widths are minimum requirements. When a 1 mm motor output merged with a thinner branch on the same net, whichever connection came first won — so the 1 mm requirement was silently dropped and the route fell back to the default width.
This also explains the otherwise puzzling detail in the report that the loss is branch/merge dependent rather than a global parsing failure: nets whose wide connection happened to be visited first kept 0.8 mm, and nets where a thin branch came first lost it. The outcome depended on connection order.
Fix
Take the maximum requested width across the merged group, so a merge can never narrow a trace below what any member asked for. Connections that request nothing still merge to
undefinedand keep the existing default behavior.Tests
Added
tests/solvers/merge-connections-nominal-trace-width.test.tswith 5 cases: widest-wins, order independence (the failing direction and the passing one), no-width-stays-undefined, a single width surviving merges with unspecified branches, and separate nets keeping their own widths.The widest-wins case fails on
mainwithExpected: 1, Received: 0.15and passes here.Verification
Full
bun test: 411 pass / 13 fail, versus 406 pass / 13 fail on an unmodified checkout — same 13 pre-existing failures (bugreport fixtures hitting the 5 s timeout), plus the 5 new tests. No regressions.Note this fixes width preservation through connection merging. If #1721 also involves width loss further down the pipeline (e.g. in
TraceWidthSolveror HD route conversion), that would be a separate follow-up — happy to dig in if you can confirm from the gist data.