Repository navigation
Description
Summary
<board autorouter={{ traceClearance: "0.5mm" }}> has no effect on routing. The board below routes exactly as if the option were absent. The router's input and output files are byte-identical, and two traces end up 0.326 mm apart.
minTraceToPadEdgeClearance="0.5mm" on the same board does widen the spacing (smallest gap 0.516 mm). That's the setting that actually controls trace spacing today. The traceClearance option is accepted without a warning, so it looks like it works.
Reproduction
tscircuit 0.0.3231 (latest on npm), macOS. I built three copies of this board, changing only the <board> props:
export default () => (
<board width="26mm" height="24mm" /* props under test */>
<chip name="U1" footprint="soic8" pcbX={-5} pcbY={0} />
<pinheader name="J1" pinCount={8} pcbX={6} pcbY={0} pcbRotation={90} />
<trace from=".U1 > .pin1" to=".J1 > .pin8" />
<trace from=".U1 > .pin2" to=".J1 > .pin6" />
<trace from=".U1 > .pin3" to=".J1 > .pin4" />
<trace from=".U1 > .pin4" to=".J1 > .pin2" />
<trace from=".U1 > .pin5" to=".J1 > .pin1" />
<trace from=".U1 > .pin6" to=".J1 > .pin3" />
<trace from=".U1 > .pin7" to=".J1 > .pin5" />
<trace from=".U1 > .pin8" to=".J1 > .pin7" />
</board>
)Each copy was built with tsci build <file> --autorouter-debug --autorouter-debug-dir dbg --autorouter-dump-srj all:
<board> props |
SRJ minTraceToPadEdgeClearance |
Smallest gap between traces of different nets | Vias | SRJ and routed traces vs. no props |
|---|---|---|---|---|
| none | 0.1 | 0.326 mm | 1 | (baseline) |
autorouter={{ traceClearance: "0.5mm" }} |
0.1 | 0.326 mm | 1 | byte-identical (same SHA-1 for phase-0.input.simple-route.json and phase-0.output.traces.json) |
minTraceToPadEdgeClearance="0.5mm" |
0.5 | 0.516 mm | 5 | different |
The gap is the edge-to-edge distance between same-layer wire segments of different connections in phase-0.output.traces.json.
Cause
autorouter.traceClearance is read in one place only, lib/components/primitive-components/Group/Group.ts (main, v0.0.2410):
autorouter_configuration: props.autorouter
? {
trace_clearance: props.autorouter.traceClearance,
}
: undefined,Nothing in core reads autorouter_configuration or trace_clearance back. getSimpleRouteJsonFromCircuitJson takes the router's clearance from minTraceToPadEdgeClearance (falling back to board.min_trace_to_pad_edge_clearance). The SimpleRouteJson type has no trace-to-trace clearance field. capacity-autorouter 0.0.1124 (the version tscircuit 0.0.3231 installs) sets its internal traceClearance from srj.minTraceToPadEdgeClearance, with a 0.1 default.
For a <board>, the value isn't even stored. The circuit JSON from the second build has no pcb_group element, so traceClearance doesn't appear anywhere in the output.
Expected
Either of these would fix it:
- Pass
autorouter.traceClearanceinto the SimpleRouteJson. For example, use it as the router's trace clearance, or as a floor onminTraceToPadEdgeClearancewhen it's larger. - Or deprecate the option and point to
minTraceToPadEdgeClearancewith a warning, so users don't believe they've set a spacing rule.
Workaround
Use minTraceToPadEdgeClearance on <board> to set trace spacing.
Activity
nitina-ariveguru commentedon Nov 19, 2026
I tested #5680. It fixes this.
I merged it into current
main(v0.0.2427; it merges cleanly) and built core from the result. tscircuit 0.0.3245 ships core 0.0.2427, so swapping that build into a 0.0.3245 install changes only this PR. Then I rebuilt the board from the issue withtsci build --autorouter-dump-srj all:<board>propsautorouter={{ traceClearance: "0.5mm" }}minTraceToPadEdgeClearance="0.5mm"With the PR, the
traceClearancebuild'sphase-0.output.traces.jsonis byte-identical to theminTraceToPadEdgeClearancebuild's (same SHA-1).I also ran a few more cases as
bun testfixtures on the merged branch:main{ preset: "auto_local", traceClearance: "0.5mm" }<group subcircuit autorouter={{ traceClearance: "0.5mm" }}>traceClearance: "0.3mm"Regressions: the PR's three new tests pass. Across the 65 tests in
tests/features/autorouter-*.test.tsxandautoroutingphase*.test.tsx,mainand the PR give the same result: 44 pass, 21 fail, the same 21 on both (PCB snapshot diffs on my machine), so nothing new fails.Two notes, neither blocking:
traceClearancenow also raises trace-to-pad clearance while routing. That seems like the right reading, and it may be worth a line in the docs.minTraceToPadEdgeClearanceonly. In the TSSOP case the router can't keep 0.3 mm (gaps of 0.100 mm, the known router limit from tscircuit-autorouter#3130), and the build reports no error, because the board's DRC rule is still 0.1 mm. IftraceClearanceis meant as a design rule, DRC could use the samemax()so the shortfall is reported.nitina-ariveguru commentedon Nov 22, 2026
Still reproduces on stock tscircuit 0.0.3279 (core 0.0.2460): with
autorouter={{ traceClearance: "0.5mm" }}, the dumped SRJ still hasminTraceToPadEdgeClearance: 0.1. #5680 (which fixed it in my earlier test) hasn't landed yet.