Skip to content

Disambiguate disconnected same-name nets with schematic superscripts - #3660

Merged
seveibar merged 6 commits into
mainfrom
feat/disambiguate-schematic-net-names
Sep 5, 2026
Merged

Disambiguate disconnected same-name nets with schematic superscripts#3660
seveibar merged 6 commits into
mainfrom
feat/disambiguate-schematic-net-names

Conversation

@seveibar

@seveibar seveibar commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Populates display_superscript when a name is displayed on more than one source electrical network. Unused source-net declarations do not create display conflicts. For example, disconnected GND nets in sibling subcircuits render as GND¹ and GND². Connected copies share one suffix; unambiguous names have none.

Applies to both schematic_net_label and trace-associated schematic_text, including inline display labels that have no source_net. Connectivity follows source traces, shared ports, and both forms of internal component pin connections across subcircuits. Scoped connectivity keys and matching names alone do not join networks.

Runs in the dedicated SchematicLabelNetsWithConflictingNames render phase after schematic label/symbol rendering and before PCB phases. The top-level group assigns suffixes for the whole circuit, with initial and dirty-update handlers and declared async dependencies. Clears stale suffixes when networks join and uses source member IDs for deterministic numbering even when Circuit JSON is reordered. Source names, connectivity, and unrelated schematic text remain unchanged. Updates circuit-json to 0.0.484 and circuit-to-svg to 0.0.413, which contain the schema and rendering support.

Core-generated GND and inline SIGNAL superscripts

Validation:

  • Four new tests with visual snapshots cover disconnected and connected subcircuits, shared numbering between label kinds, inline named traces, internal connections, reordered JSON, and removal of stale suffixes.
  • Existing trace/subcircuit/inline-label regression batch: 75 pass, one existing skip. Additional explicit-label and group-port batches: 11 pass and 6 pass.
  • Phase lifecycle tests verify that assignment completes inside the phase, waits for descendant async label work, runs once initially, and reruns on dirty updates.
  • The RP2040 regression verifies XIN remains unsuffixed despite duplicate source-net declarations; its schematic snapshot is updated.
  • bunx tsc --noEmit and bun run build pass.

Related schema/rendering changes: tscircuit/circuit-json#750, tscircuit/circuit-json#754, tscircuit/circuit-to-svg#712.

@vercel

vercel Bot commented Sep 5, 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 Sep 5, 2026 6:17am UTC

Request Review

@@ -0,0 +1,48 @@
import type { SourceNet } from "circuit-json"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The folder name schematic-net-superscripts is inconsistent with the naming used throughout the rest of the project. The utility file is named assign-schematic-net-label-superscripts.ts, the render phase is called SchematicNetLabelSuperscripts, and the base-components test file is named schematic-net-label-superscripts-phase.test.ts. The folder should be renamed to schematic-net-label-superscripts to match the established naming convention (kebab-case, consistent with other file/export names in the project).

Spotted by Graphite (based on custom rule: Custom rule)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@seveibar
seveibar merged commit fea0fcb into main Sep 5, 2026
17 checks passed
@seveibar
seveibar deleted the feat/disambiguate-schematic-net-names branch September 5, 2026 06:24
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.

1 participant