Add pcbTracePaths for reusable pre-generated fanout routes - #837
Conversation
| test("saved fanout paths reject invalid geometry and layer transitions", () => { | ||
| const wire = { route_type: "wire", x: 0, y: 0, width: 0.2, layer: "top" } | ||
| for (const invalid of [ | ||
| { connection: "", route: [wire, wire] }, | ||
| { connection: "U1.1", route: [] }, | ||
| { connection: "U1.1", route: [wire] }, | ||
| { connection: "U1.1", route: [wire, { ...wire, x: Number.NaN }] }, | ||
| { connection: "U1.1", route: [wire, { ...wire, width: 0 }] }, | ||
| { connection: "U1.1", route: [wire, { ...wire, layer: "bottom" }] }, | ||
| { | ||
| connection: "U1.1", | ||
| route: [ | ||
| wire, | ||
| { | ||
| route_type: "via", | ||
| x: 1, | ||
| y: 1, | ||
| from_layer: "top", | ||
| to_layer: "bottom", | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| connection: "U1.1", | ||
| route: [ | ||
| { | ||
| route_type: "via", | ||
| x: 0, | ||
| y: 0, | ||
| from_layer: "top", | ||
| to_layer: "bottom", | ||
| }, | ||
| wire, | ||
| ], | ||
| }, | ||
| { | ||
| connection: "U1.1", | ||
| route: [wire, { ...path.route[1], from_layer: "inner1" }, path.route[2]], | ||
| }, | ||
| ]) | ||
| expect(fanoutTracePath.safeParse(invalid).success).toBe(false) | ||
| }) |
There was a problem hiding this comment.
This file contains two test(...) calls (one at line 26 and another at line 53). The style guide rule states that a *.test.ts file may have AT MOST one test(...). The second test should be moved to a separate, numbered file. For example, split into fanout-trace-paths1.test.ts (containing the first test: 'breakout retains JSON-serializable saved routes and normalizes distances') and fanout-trace-paths2.test.ts (containing the second test: 'saved fanout paths reject invalid geometry and layer transitions').
Spotted by Graphite (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
|
Thank you for your contribution! 🎉 PR Rating: ⭐⭐⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
Adds
pcbTracePathstoBreakoutProps(used by<breakout>and<fanout>) so pre-generated port-to-exit routes can be stored as JSON and reused without generated Circuit JSON IDs. ExportsFanoutTracePathandfanoutTracePath, with wire/via validation and unit-aware distances normalized to millimeters.The prop is optional and preserves existing automatic fanout defaults. Its declaration documents the coordinate frame, physical layer semantics, automatic-routing precedence, and duplicate-exit restrictions. Runtime route placement and preservation are implemented in the companion core PR: tscircuit/core#3809.
Validation: all 481 tests pass; typecheck, package build, and formatting pass. Ran all four required documentation generators and included the generated output.