Normalize through_obstacle autorouter segments before persisting pcb_trace.route#2316
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR fixes an autorouting persistence bug by ensuring internal autorouter-only through_obstacle segments are converted into the public through_pad route shape before pcb_trace.route is stored, keeping downstream route handling consistent with the public data model.
Changes:
- Normalize
through_obstacleroute points tothrough_padbefore inserting autorouter-produced traces intodb.pcb_trace. - Apply the same normalization in the reroute/jumper trace-splitting path.
- Add a regression test to verify persisted routes no longer contain
through_obstacle.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/features/autorouting-through-obstacle-public-route.test.tsx | Adds regression coverage to ensure persisted pcb_trace.route does not contain through_obstacle and includes through_pad. |
| lib/components/primitive-components/Group/Group.ts | Normalizes autorouter output routes to the public route format before persistence and before jumper splitting. |
Comments suppressed due to low confidence (1)
lib/components/primitive-components/Group/Group.ts:1265
- This normalization block duplicates the same
through_obstacle→through_padmapping introduced earlier in_updatePcbTraceRenderFromSimpleRouteJson. It would be more maintainable to centralize this conversion in a single utility (and avoidanyin the mapper) so both flows always produce identical public routes.
const publicRoute = pcb_trace.route.map((point: any) => {
if (point.route_type !== "through_obstacle") return point
return {
route_type: "through_pad",
start: point.start,
end: point.end,
start_layer: point.from_layer,
end_layer: point.to_layer,
width: point.width,
}
})
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
07b3003 to
099b31e
Compare
Co-authored-by: Severin Ibarluzea <seve700@gmail.com>
Co-authored-by: Severin Ibarluzea <seve700@gmail.com>
Co-authored-by: Severin Ibarluzea <seve700@gmail.com>
Co-authored-by: Severin Ibarluzea <seve700@gmail.com>
7ecb4c0 to
34bc696
Compare
…/github.com/rushabhcodes/core into fix/normalize-through-obstacle-public-route
…r options in tests
|
Thank you for your contribution! 🎉 PR Rating: ⭐⭐⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
Summary
This PR fixes a core autorouting bug where local autorouter output could write through_obstacle segments directly into
pcb_trace.route, even though the public route format should expose those segments as through_pad.
What changed
consistently
persisted route no longer contains it
Why this matters
This is a tscircuit/core behavior fix, not just a test update. It improves the public route data model exposed by autorouting and
prevents internal autorouter-specific segment types from leaking into persisted PCB trace data.