Skip to content

fix(schematic): respect schTraceAutoLabelEnabled={false} to suppress port-net auto-labels#2248

Open
gsdali wants to merge 1 commit intotscircuit:mainfrom
gsdali:fix-sch-trace-autolabel-enabled
Open

fix(schematic): respect schTraceAutoLabelEnabled={false} to suppress port-net auto-labels#2248
gsdali wants to merge 1 commit intotscircuit:mainfrom
gsdali:fix-sch-trace-autolabel-enabled

Conversation

@gsdali
Copy link
Copy Markdown

@gsdali gsdali commented May 6, 2026

Summary

Closes #2243.

schTraceAutoLabelEnabled is declared as a tri-state prop in the type definitions, but only the true case was wired up at runtime — for opting INTO net labels at complex multi-junction traces (in Trace_doInitialSchematicTraceRender.ts). Setting the prop to false had no observable effect, because the only consumer treats falsy (undefined or false) as "not opted in".

The user-facing pain: named-net connections (every chip pin tied to net.V3_3 / net.GND / etc.) automatically get a schematic_net_label drawn at every endpoint — the canonical "label, not wire" rendering. Users wanted a way to opt out and got none.

Fix

Wire schTraceAutoLabelEnabled === false (explicit, not undefined) into Group_doInitialSchematicTraceRender so that insertNetLabelsForPortsMissingTrace is skipped when the user explicitly opts out. Both call sites (early-return when no routable connections, and post-routing) honour the opt-out.

Tri-state semantics

value behaviour
undefined (default) existing behaviour, auto labels emitted
true opt INTO labels for complex traces (existing, in Trace_doInitialSchematicTraceRender)
false opt OUT of port-net auto-labels (NEW)

Test plan

  • New tests/components/sch/sch-trace-autolabel-disabled.test.tsx:
    • false0 schematic_net_label records for a chip on net.V3_3 / net.GND
    • unset (default) → ≥1 schematic_net_label (existing behaviour preserved)
  • bun test tests/components/sch: 2/2 pass
  • Full-suite delta vs main: same flaky-test profile (1 fail in tests/repros/repro81-panel-unnamed-pcb-group.test.tsx which flakes under full-suite load on main too — passes in isolation; not caused by this change)

What this PR does NOT solve

  • The true case behaviour is unchanged from current semantics (only opts into complex-trace labels).
  • This PR only suppresses labels at port-missing-trace junctions (the most common user pain). Other auto-label sources (e.g. labels emitted by the trace solver inside applyNetLabelPlacements) are not affected. Reasonable next step is to extend the opt-out to those paths too, but it'd touch more code and is left as follow-up.

Why this scope

The most surprising part of the original report was the prop has zero observable effect when set to false. After this PR, setting false produces an immediately-visible difference (no more port-net auto-labels). Users who want "named nets render as wires, not labels" still need other mechanisms (port-to-port connections via array connections), but at least they have one knob that makes a visible difference.

🤖 Generated with Claude Code

…port-net auto-labels

Closes tscircuit#2243.

`schTraceAutoLabelEnabled` was a tri-state prop in the type definitions
but only the `true` case was wired up at runtime — for opting INTO net
labels at complex multi-junction traces (in
`Trace_doInitialSchematicTraceRender.ts`). Setting the prop to `false`
had no observable effect, because the only consumer treated falsy
(undefined or false) as "not opted in".

The user-facing pain is that named-net connections (every chip pin
tied to `net.V3_3` / `net.GND` / etc.) automatically get a
`schematic_net_label` drawn at every endpoint — the canonical
"label, not wire" rendering. Users wanted a way to opt out and got
none.

Wire `schTraceAutoLabelEnabled === false` (explicit, not undefined)
into `Group_doInitialSchematicTraceRender` so that
`insertNetLabelsForPortsMissingTrace` is skipped when the user
explicitly opts out. The two existing call sites — early-return
when no routable connections exist, and post-routing — both honour
the opt-out.

Tri-state semantics:

  - undefined (default) : existing behaviour, auto labels emitted
  - true                : opt INTO labels for complex traces
                          (existing, in Trace_doInitialSchematicTraceRender)
  - false               : opt OUT of port-net auto-labels (NEW)

Tests:
- Add `tests/components/sch/sch-trace-autolabel-disabled.test.tsx`:
    - false → 0 schematic_net_labels for a chip on net.V3_3 / net.GND
    - unset → ≥1 schematic_net_label (existing default preserved)
- Full-suite delta vs `main`: same flaky-test profile (1 fail in
  `tests/repros/repro81-panel-unnamed-pcb-group.test.tsx` which
  flakes under full-suite load on `main` too — passes in isolation).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

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

Project Deployment Actions Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview, Comment May 6, 2026 6:47am

Request Review

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.

schTraceAutoLabelEnabled={false} has no observable effect on schematic rendering

1 participant