Preserve imported trace topology during subcircuit circuit-json inflation and reroute reproduction fixes#2443
Open
rushabhcodes wants to merge 7 commits into
Open
Preserve imported trace topology during subcircuit circuit-json inflation and reroute reproduction fixes#2443rushabhcodes wants to merge 7 commits into
rushabhcodes wants to merge 7 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
seveibar
reviewed
Jun 14, 2026
seveibar
left a comment
Contributor
There was a problem hiding this comment.
Why is source trace storing a pcb trace? Does it need to?
Im afk and not really able to review this, but we should try to eliminate the hacky behavior in multiple stages- the FIRST PR should make sure source traces properly manage multiple pcb traces without misleading properties
| trace._portsRoutedOnPcb = ports | ||
| trace.pcb_trace_id = pcb_trace.pcb_trace_id | ||
| trace._insertErrorIfTraceIsOutsideBoard(pcb_trace.route, ports) | ||
| trace.pcb_trace_id = firstPcbTraceId |
Contributor
There was a problem hiding this comment.
Hmm that doesnt seem right
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a core trace-inflation bug in
tscircuit/corewhere imported subcircuitcircuitJsoncould lose or distort source-trace/pcb-trace relationships during inflation, especially for multi-segment imported traces and rerouted Arduino Uno regions.This PR keeps one logical
source_tracemapped to all of its imported physicalpcb_tracesegments, preserves imported trace metadata during runtime trace creation, and updates reroute expectations to validate the runtime board state correctly.Why this matters
This was a subtle but important core data-modeling bug:
pcb_tracesegments were not represented correctly after inflationsource_tracerecordsThe fix improves correctness in
tscircuit/corerather than only adjusting fixtures.What changed
Traceper importedsource_tracepcb_tracesegments and vias to that logical tracesource_traceentriesTests
Reproduced and fixed with coverage including:
tests/features/subcircuit-circuit-json/subcircuit-circuit-json06.test.tsxtests/repros/repro116-arduino-uno.test.tsxtests/repros/repro116-arduino-uno-reroute.test.tsxtests/repros/repro116-arduino-uno-reroute-center.test.tsxtests/repros/repro116-arduino-uno-reroute-lower-mid.test.tsxtests/repros/repro116-arduino-uno-reroute-invalid-source-ids.test.tsxImpact
This is a bug reproduction + fix in
tscircuit/corewith direct improvements to trace data modeling, imported subcircuit correctness, and reroute stability.