Autorouter replaces `pcbStraightLine` traces with its own route (adds vias, can short on dense boards)

Open
#5,462 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@OLuHneschastniy is already working on this.

Since Nov 13, 2026.

  • #5473 by @OLuHneschastniy — open
  • #5475 by @cocvn157 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
react, typescript
Domain
backend, design

Research direction

Start by reading the autorouter behavior described in #3146 and compare the reproduced pcbStraightLine trace with its output in the circuit JSON, especially __replaces_pcb_trace_id and the added vias. Reproduce the example with tsci build and check whether the other route crosses the original straight trace. Done means fixed traces remain unchanged, the other connection routes around them, and the dense-board case no longer reports a short; two open linked pull requests already address this issue.

Written by the indexing model from the issue text.

Description

Summary

A trace with pcbStraightLine is supposed to be fixed input to autorouting (as described in #3146). When another routed connection has to cross it, the autorouter instead replaces the straight-line trace: the output pcb_trace carries __replaces_pcb_trace_id pointing at the original, and the straight segment becomes a 12-point route that drops to the bottom layer through two vias. The other trace keeps the top layer. The build passes with no error or warning.

Reproduction

export default () => (
  <board width="20mm" height="12mm">
    <chip name="U1" footprint="soic8" pcbX={-4} pcbY={0} />
    <resistor name="R1" resistance="1k" footprint="0402" pcbX={1} pcbY={1.905} />
    <capacitor name="C1" capacitance="1uF" footprint="0402" pcbX={4} pcbY={4} />
    <trace from="U1.pin8" to="R1.pin1" pcbStraightLine />
    <trace from="U1.pin7" to="C1.pin1" />
  </board>
)

tsci build reports 1 passed. In the circuit JSON:

Expected Actual
pcb_trace_0 (U1.pin8 → R1.pin1) 2 points, straight on top 12 points, 2 vias, __replaces_pcb_trace_id: "pcb_trace_0"
U1.pin7 → C1.pin1 routed around the fixed trace 7 points on top, crossing where the straight line was

Route of the replaced trace:

(-1.85,1.91 top) → (-1.0,1.9 top) → via → (-1.0,1.9 bottom) → (-0.19,1.9 bottom) → via → (-0.19,1.9 top) → (0.49,1.91 top)

Why it matters

On a denser board (USB-C receptacle with pcbStraightLine on the CC1/CC2 escapes and an unbroken bottom <copperpour>), the replacement route collided with the VBUS trace: tsci check shorts reported a short between CC2 and VBUS, and the measured copper gap was 0 mm. The same board without pcbStraightLine has no short.

Without the pour or the fine-pitch connector, the result is no short but still a straight trace silently turned into a two-via detour, which defeats the purpose of pcbStraightLine.

Notes

  • A straight trace that only passes close to another net's pad is kept as is and gets a normal pad/trace clearance error, so the replacement seems specific to another connection needing to cross the fixed trace.
  • I didn't find an existing issue for this. Related: #3146 (preserve early-rendered copper during autorouting), #4084 (exact preloaded trace geometry to Pipeline9), #4477 (unmerged, pcbPaths replaced by simplify).

Environment

  • tscircuit 0.0.3169, @tscircuit/core 0.0.2359 (latest on npm, 2026-11-13); also seen on 0.0.3062 / 0.0.2259
  • Bun 1.4.4, macOS 26.6.2 (Apple Silicon)
Dominant language
TypeScript
Stars
61
Forks
256
Avg merge
20h 21m
Merged PRs (30d)
289

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tscircuit/core

All issues in tscircuit/core

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.