Skip to content

Save inline label positions on their schematic wires - #4811

Merged
MustafaMulla29 merged 10 commits into
repro/inline-label-wire-positionsfrom
fix/inline-label-wire-positions
Oct 21, 2026
Merged

MustafaMulla29 merged 10 commits into
repro/inline-label-wire-positionsfrom
fix/inline-label-wire-positions

Conversation

@MustafaMulla29

@MustafaMulla29 MustafaMulla29 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Core currently saves inline text positions away from their wires. Save the solver's on-wire attachment in schematic_text.position and use the existing anchor field for the label's side and alignment. Preserve terminal-stub alignment, rotation, sheet assignment, and the source_trace_id relationship. No Circuit JSON schema fields are added.

Update the published schematic-trace-solver dependency from 0.0.236 to 0.0.237, which includes the merged solver fix #1339. Validation uses the installed release, without a locally linked solver.

This supports cleaning up the inline-label converter PR #658: the converter can create local electrical labels from the saved position and alignment, using the existing trace relationship, and remove nearest-wire attachment inference.

Stacked on repro PR #4812.

The test-generated repro snapshots are shown below. Blue dots mark saved positions; dashed boxes mark text bounds. Compare each dot with its wire.

Horizontal labels: OUT_A_P / OUT_B_P

Before (repro #4812) After (this fix)
Before: Horizontal labels: OUT_A_P / OUT_B_P After: Horizontal labels: OUT_A_P / OUT_B_P

Straight vertical stub: AGC_OUT

Before (repro #4812) After (this fix)
Before: Straight vertical stub: AGC_OUT After: Straight vertical stub: AGC_OUT

The straight vertical stub makes the change particularly clear: its saved position moves from 0.06 mm beside the wire onto the wire, while the dashed text bounds stay in place. These images reference the tested commits, so the before/after comparison stays stable.

Both examples include full-circuit snapshots. Dashed rectangles use the existing getSchematicTextBounds helper, with the existing transform utilities for rotated text. The guides exist only in the tests' snapshot input. The new vertical example requires no additional production changes.

Validation with the published 0.0.237 package:

  • All ten Linux Bun 1.4.0 test jobs pass on commit 78a7e9f: CI run. Type checking, formatting, package preview, and the build smoke test also pass.
  • Corrected the old left / right expectations in the crystal and custom-symbol tests to bottom_left / bottom_right, and regenerated 76 affected schematic and simulation snapshots through their existing tests. No snapshot tolerances were loosened, and no PCB snapshots were changed.
  • Reviewed the generated snapshot differences: visible wire coverage matches in schematic-world coordinates across all 76 updated snapshots, including those whose automatic viewport changed. Simulation chart geometry and displayed values are unchanged.
  • The updated crystal/custom-symbol assertions and both TB67 attachment repros pass locally without snapshot updates (four tests, 33 assertions).
  • Both repro tests independently pass with published solver 0.0.236. Adding the new vertical-stub on-wire assertion to the old core behavior fails at a measured distance of 0.06 mm.

Both branches include the main update. The solver dependency blocker is resolved. This remains a draft for the previously identified text-rendering review: OUT_B_P glyphs can cross the wire in SVG/PNG output. That overlap was also reproduced on core main with solver main, and varies by SVG renderer. The electrical attachment point is correct; this PR does not include a renderer change.

Merge the core repro first, then this fix after the remaining rendering review.

@vercel

vercel Bot commented Oct 21, 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 Oct 21, 2026 11:07am UTC

Request Review

@MustafaMulla29
MustafaMulla29 marked this pull request as ready for review October 21, 2026 10:55
@MustafaMulla29
MustafaMulla29 requested review from imrishabh18 and seveibar and removed request for imrishabh18 October 21, 2026 11:00
Comment thread package.json
"@tscircuit/props": "^0.0.705",
"@tscircuit/schematic-match-adapt": "^0.0.18",
"@tscircuit/schematic-trace-solver": "https://jscdn.tscircuit.com/@tscircuit/schematic-trace-solver/0.0.236.tgz",
"@tscircuit/schematic-trace-solver": "https://jscdn.tscircuit.com/@tscircuit/schematic-trace-solver/0.0.237.tgz",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use the npm package version

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think seve told us it's better to use jscdn last week in the meeting.

@MustafaMulla29
MustafaMulla29 merged commit 0fdf0cc into main Oct 21, 2026
20 checks passed
@MustafaMulla29
MustafaMulla29 deleted the fix/inline-label-wire-positions branch October 21, 2026 12:17
@tscircuitbot

Copy link
Copy Markdown
Contributor

Thank you for your contribution! 🎉

PR Rating: ⭐⭐
Impact: Minor

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


This branch was successfully deployed

1 active deployment
Preview — 78a7e9fd Deployed Oct 21, 2026 by vercel[bot]
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.

3 participants