Skip to content

fix(bus_lanes): expose through-hole obstacle span layers on terminals - #5815

Open
devbox-zero-ops wants to merge 2 commits into
tscircuit:mainfrom
devbox-zero-ops:fix/bus-lanes-through-hole-layers
Open

devbox-zero-ops wants to merge 2 commits into
tscircuit:mainfrom
devbox-zero-ops:fix/bus-lanes-through-hole-layers

Conversation

@devbox-zero-ops

Copy link
Copy Markdown

Summary

Fixes #5802.

Root Cause

Core's SimpleRouteJson emits single-layer terminal points (layer: "top" for plated through-holes), while the through-hole pad's full copper layer span (e.g. ["top", "bottom"]) is carried on its matching obstacle in input.obstacles.

@tscircuit/bus-lanes-solver already supports multilayer terminals via Terminal.layers?: string[] (falling back to [point.layer] when omitted), but getBusLanesInputFromSrj did not populate point.layers from matching multilayer obstacles. As a result, routing a bottom-side SMD bus to a through-hole header treated the through-hole terminal as top-only and inserted an unnecessary via per connection.

Changes

  • lib/utils/autorouting/get-bus-lanes-input-from-srj.ts: Populate point.layers on BusLanesInput terminals when a point lies inside a connected multilayer obstacle (obstacle.layers.length > 1 containing point.layer), without mutating the caller's SimpleRouteJson.
  • tests/repros/bus-lanes-through-hole-no-extra-via.test.tsx: Added regression tests covering both the issue repro (bottom SMD → through-hole header routed on bottom with 0 vias) and the top SMD → through-hole header control case.

Verification

  • bun test tests/repros/bus-lanes-through-hole-no-extra-via.test.tsx (2 pass, 0 fail)
  • bun test tests/utils/autorouting/ (all pass)
  • bunx tsc --noEmit (clean)

@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tscircuit-core-benchmarks Ready Ready Preview Nov 25, 2026 7:21pm UTC

Request Review

@nitina-ariveguru

Copy link
Copy Markdown

I filed #5802 and tested this end to end. I merged it onto main (v0.0.2471, whose only change since 0.0.2470 is the harness drawing work), built it, and swapped the build into a tscircuit 0.0.3289 install (core 0.0.2470). Each build started with an empty .tscircuit/cache.

Board Stock 0.0.3289 With #5815
#5802 repro: bottom 0402s → through-hole header 2 vias, bottom + top 0 vias, bottom only
same, layers={4} 2 vias, bottom + top 0 vias, bottom only
same, default router (no <autoroutingphase>) 0 vias, bottom unchanged
top 0402s → through-hole header (control) 0 vias, top unchanged
top 0402s → header with layer="bottom" 0 vias, top (plus a length-skew error) unchanged, same error
SOIC-16 pins 1–8 → 8-pin header, bus_lanes 8 vias: 4 escapes at the SOIC, 4 next to header pins (1.27 mm away) 8 vias, all escapes at the SOIC (0.63 mm), none at the header

So the extra header-side transition is gone, and the SOIC board now needs exactly one escape per SOIC pad, which is what #5802 expected. tsci check shorts is clean on the repro and the SOIC board.

Core tests: I ran the 47 bus-lanes and autoroutingphase test files. With this branch, 38 pass and 11 fail. On main, 36 pass and the same 11 fail. All 11 are toMatchPcbSnapshot image diffs under 1 % on my machine, and their diff percentages are identical on both branches, so no existing routing output changed. The two new tests pass, and tsc --noEmit is clean.

On the approach: core's SRJ uses SingleLayerConnectionPoint, so adding the plated hole's span in getBusLanesInputFromSrj, where bus-lanes-solver already accepts layers, leaves the shared SRJ contract alone. Requiring the obstacle to be connectedTo the same connection or port keeps another net's through-hole from widening a terminal. That looks like the right place for the fix to me.

The docs side is tscircuit/skill#67. I left a note there.

@devbox-zero-ops

Copy link
Copy Markdown
Author

Thanks @nitina-ariveguru for running the full 6-board end-to-end verification and core regression check! I also updated tscircuit/skill#67 (f5dad45) to wrap the new BUS_LANES.md paragraph to 80 columns and note that through-hole pads are reachable on every layer they span.

This branch was successfully deployed

1 active deployment
Preview — 7a8ee819 Deployed Nov 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bus_lanes treats through-hole pads as top-only terminals, adding an unneeded via per connection

2 participants