Skip to content

<board autorouter={{ traceClearance }}> is silently ignored: the value never reaches the autorouter #5677

Open

Description

@nitina-ariveguru

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.traceClearance into the SimpleRouteJson. For example, use it as the router's trace clearance, or as a floor on minTraceToPadEdgeClearance when it's larger.
  • Or deprecate the option and point to minTraceToPadEdgeClearance with a warning, so users don't believe they've set a spacing rule.

Workaround

Use minTraceToPadEdgeClearance on <board> to set trace spacing.

Activity

  1. nitina-ariveguru commented on Nov 19, 2026

    @nitina-ariveguru
    Author

    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 with tsci build --autorouter-dump-srj all:

    <board> props Stock 0.0.3245: SRJ clearance / smallest gap / vias With #5680
    none 0.1 / 0.326 mm / 1 0.1 / 0.326 mm / 1 (unchanged, byte-identical output)
    autorouter={{ traceClearance: "0.5mm" }} 0.1 / 0.326 mm / 1 0.5 / 0.516 mm / 5
    minTraceToPadEdgeClearance="0.5mm" 0.5 / 0.516 mm / 5 0.5 / 0.516 mm / 5

    With the PR, the traceClearance build's phase-0.output.traces.json is byte-identical to the minTraceToPadEdgeClearance build's (same SHA-1).

    I also ran a few more cases as bun test fixtures on the merged branch:

    Case main #5680
    issue board, { preset: "auto_local", traceClearance: "0.5mm" } 0.1 / 0.326 mm 0.5 / 0.516 mm
    same board inside <group subcircuit autorouter={{ traceClearance: "0.5mm" }}> 0.1 / 0.271 mm 0.5 / 0.585 mm
    two TSSOP-16s, 8 crossing traces, traceClearance: "0.3mm" 0.1 / 0.115 mm 0.3 / 0.100 mm

    Regressions: the PR's three new tests pass. Across the 65 tests in tests/features/autorouter-*.test.tsx and autoroutingphase*.test.tsx, main and 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:

    1. SimpleRouteJson has one clearance field, so traceClearance now also raises trace-to-pad clearance while routing. That seems like the right reading, and it may be worth a line in the docs.
    2. DRC still checks against minTraceToPadEdgeClearance only. 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. If traceClearance is meant as a design rule, DRC could use the same max() so the shortfall is reported.
  2. nitina-ariveguru commented on Nov 22, 2026

    @nitina-ariveguru
    Author

    Still reproduces on stock tscircuit 0.0.3279 (core 0.0.2460): with autorouter={{ traceClearance: "0.5mm" }}, the dumped SRJ still has minTraceToPadEdgeClearance: 0.1. #5680 (which fixed it in my earlier test) hasn't landed yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions