@tscircuit/schematic-trace-solver 0.0.192 → 0.0.193

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/dist/index.js +12 -4
  2. package/lib/solvers/UnroutedTraceRecoverySolver/UnroutedTraceRecoverySolver.ts +10 -2
  3. package/package.json +1 -1
  4. package/site/SchematicTracePipelineSolver/repro173-boost-drv8711-ground-label-overlap.page.tsx +7 -0
  5. package/tests/bug-reports/bug-report-20260707T092615Z/__snapshots__/bug-report-20260707T092615Z.snap.svg +2 -2
  6. package/tests/examples/__snapshots__/example08.snap.svg +29 -29
  7. package/tests/examples/__snapshots__/example32.snap.svg +2 -2
  8. package/tests/examples/__snapshots__/example46.snap.svg +12 -21
  9. package/tests/repros/__snapshots__/repro-esp12f-section.snap.svg +2 -2
  10. package/tests/repros/__snapshots__/repro-ina237-current-monitor.snap.svg +17 -17
  11. package/tests/repros/__snapshots__/repro-netlabel-overlap-trace.snap.svg +2 -2
  12. package/tests/repros/__snapshots__/repro-pmp11282-isolated-dcdc.snap.svg +89 -98
  13. package/tests/repros/__snapshots__/repro173-boost-drv8711-ground-label-overlap.snap.svg +307 -0
  14. package/tests/repros/__snapshots__/rtc-imu-microsd-section.snap.svg +286 -0
  15. package/tests/repros/assets/repro173-boost-drv8711-ground-label-overlap.input.json +865 -0
  16. package/tests/repros/assets/rtc-imu-microsd-section.input.json +894 -0
  17. package/tests/repros/repro-pmp11282-isolated-dcdc.test.ts +10 -3
  18. package/tests/repros/repro173-boost-drv8711-ground-label-overlap.test.ts +41 -0
  19. package/tests/repros/rtc-imu-microsd-section.test.ts +28 -0
  20. package/tests/solvers/UnroutedTraceRecoverySolver/local-elbow-obstacles.test.ts +1 -1
@@ -68,9 +68,16 @@ test("repro PMP11282 isolated DC/DC traces and endpoint net labels", () => {
68
68
  expect(
69
69
  diagnosticPipeline.schematicTraceLinesSolver!.failedConnectionPairs,
70
70
  ).toHaveLength(60)
71
- expect(finalOutput.netLabelPlacements).toHaveLength(108)
72
- expect(endpointPairLabels).toHaveLength(80)
73
- expect(endpointPairNetIds.size).toBe(62)
71
+ expect(finalOutput.netLabelPlacements).toHaveLength(107)
72
+ expect(endpointPairLabels).toHaveLength(79)
73
+ expect(endpointPairNetIds.size).toBe(61)
74
+ expect(
75
+ finalOutput.traces.some(
76
+ (trace) =>
77
+ trace.pinIds.includes("schematic_port_20") &&
78
+ trace.pinIds.includes("schematic_port_34"),
79
+ ),
80
+ ).toBe(true)
74
81
  expect(endpointPairNetIds).toContain("U500.pin8 to C501.pin1")
75
82
  expect(endpointPairNetIds).toContain("L500.pin1 to L500.pin2")
76
83
  expect(diagnosticPipeline).toMatchSolverSnapshot(import.meta.path)
@@ -0,0 +1,41 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import type { InputProblem } from "lib/types/InputProblem"
4
+ import { pathIntersectsRenderedLabel } from "lib/utils/pathIntersectsRenderedLabel"
5
+ import "tests/fixtures/matcher"
6
+ import inputProblem from "./assets/repro173-boost-drv8711-ground-label-overlap.input.json"
7
+
8
+ // Power stage solver input captured via solver:started from core's
9
+ // tests/repros/repro173-boost-drv8711-cross-sheet-netlabel-overlap.test.tsx
10
+ // at 2ad5cd0a, after https://github.com/tscircuit/core/pull/3794.
11
+ // Only symbolName and netLabelText were added for readable snapshots; routing
12
+ // geometry, pin order, and all eight cross-sheet U1 gate-drive labels are intact.
13
+ // The controller sheet is solved independently, so its input is not needed.
14
+ test("repro173 BOOST-DRV8711 ground trace overlaps the R1 GND label", async () => {
15
+ const solver = new SchematicTracePipelineSolver(
16
+ inputProblem as unknown as InputProblem,
17
+ { hideRatsNet: true },
18
+ )
19
+ solver.solve()
20
+
21
+ expect(solver.solved).toBe(true)
22
+
23
+ const { traces, netLabelPlacements } =
24
+ solver.netLabelToTraceSolver!.getOutput()
25
+ const r1GroundLabel = netLabelPlacements.find(
26
+ (label) =>
27
+ label.netId === "GND" && label.pinIds.includes("schematic_port_83"),
28
+ )!
29
+ const c1ToR2GroundTrace = traces.find(
30
+ (trace) =>
31
+ trace.pinIds.includes("schematic_port_78") &&
32
+ trace.pinIds.includes("schematic_port_85"),
33
+ )!
34
+
35
+ // Current bug: the C1-to-R2 ground rail crosses the rendered GND label below
36
+ // R1. Record the observed failure; update this assertion and snapshot when fixed.
37
+ expect(
38
+ pathIntersectsRenderedLabel(c1ToR2GroundTrace.tracePath, r1GroundLabel),
39
+ ).toBe(true)
40
+ await expect(solver).toMatchSolverSnapshot(import.meta.path)
41
+ })
@@ -0,0 +1,28 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import inputProblem from "./assets/rtc-imu-microsd-section.input.json"
4
+ import "tests/fixtures/matcher"
5
+ import type { InputProblem } from "lib/types/InputProblem"
6
+ import { getPathLength } from "lib/solvers/Example28Solver/geometry"
7
+
8
+ test("RTC IMU microSD section trace routing", () => {
9
+ const problem: InputProblem = JSON.parse(JSON.stringify(inputProblem))
10
+ const solver = new SchematicTracePipelineSolver(problem)
11
+ solver.solve()
12
+ const recoveredTrace = solver
13
+ .unroutedTraceRecoverySolver!.getOutput()
14
+ .newTraces.find(
15
+ (trace) =>
16
+ trace.pinIds.includes("schematic_port_53") &&
17
+ trace.pinIds.includes("schematic_port_32"),
18
+ )!
19
+ expect(recoveredTrace).toBeDefined()
20
+ expect(getPathLength(recoveredTrace.tracePath)).toBeLessThan(4)
21
+ expect(recoveredTrace.tracePath[0]).toMatchObject(recoveredTrace.pins[0])
22
+ expect(recoveredTrace.tracePath.at(-1)).toMatchObject(recoveredTrace.pins[1])
23
+ const finalTrace = solver
24
+ .inlineNetLabelSolver!.getOutput()
25
+ .traces.find((trace) => trace.mspPairId === recoveredTrace.mspPairId)!
26
+ expect(getPathLength(finalTrace.tracePath)).toBeLessThan(3.5)
27
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
28
+ })
@@ -67,7 +67,7 @@ test.each(["chip", "text", "trace"] as const)(
67
67
  expect(recovery.solved).toBe(true)
68
68
  expect(recovery.solvedUnroutedTraces).toHaveLength(1)
69
69
  const recoveredPath = recovery.solvedUnroutedTraces[0]!.tracePath
70
- expect(getPathLength(recoveredPath)).toBeGreaterThan(0.8)
70
+ expect(getPathLength(recoveredPath)).toBeCloseTo(0.8)
71
71
  expect(findFirstCollision(recoveredPath, [blockingBounds])).toBeNull()
72
72
  expect(countPathIntersections(recoveredPath, blockingPath)).toBe(0)
73
73
  },