@tscircuit/schematic-trace-solver 0.0.197 → 0.0.199
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.
- package/dist/index.d.ts +4 -0
- package/dist/index.js +84 -5
- package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationSolver.ts +10 -1
- package/lib/solvers/RailNetLabelCornerPlacementSolver/RailNetLabelCornerPlacementSolver.ts +128 -2
- package/lib/solvers/RailNetLabelCornerPlacementSolver/types.ts +1 -0
- package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +2 -0
- package/package.json +1 -1
- package/site/SchematicTracePipelineSolver/repro-am3352-sheet3-power-rails.page.tsx +7 -0
- package/site/bug-reports/bug-report-20260911T195723Z.page.tsx +4 -0
- package/site/bug-reports/bug-report-20260916T054012Z.page.tsx +4 -0
- package/tests/bug-reports/bug-report-20260911T195723Z/__snapshots__/bug-report-20260911T195723Z.snap.svg +559 -0
- package/tests/bug-reports/bug-report-20260911T195723Z/bug-report-20260911T195723Z.json +1792 -0
- package/tests/bug-reports/bug-report-20260911T195723Z/bug-report-20260911T195723Z.test.ts +35 -0
- package/tests/bug-reports/bug-report-20260916T054012Z/__snapshots__/bug-report-20260916T054012Z.snap.svg +504 -0
- package/tests/bug-reports/bug-report-20260916T054012Z/bug-report-20260916T054012Z.json +1847 -0
- package/tests/bug-reports/bug-report-20260916T054012Z/bug-report-20260916T054012Z.test.ts +28 -0
- package/tests/repros/__snapshots__/repro-am3352-sheet3-power-rails.snap.svg +187 -0
- package/tests/repros/__snapshots__/repro-normal-net-label-branch-from-junction.snap.svg +31 -31
- package/tests/repros/assets/repro-am3352-sheet3-power-rails.input.json +698 -0
- package/tests/repros/repro-am3352-sheet3-power-rails.md +66 -0
- package/tests/repros/repro-am3352-sheet3-power-rails.test.ts +39 -0
- package/tests/repros/repro-normal-net-label-branch-from-junction.test.ts +13 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# AM3352 sheet 3: connector power and ground rails
|
|
2
|
+
|
|
3
|
+
This is a reduced, runnable solver repro for the J_SD, J_SPI, J_I2C and J_USB0
|
|
4
|
+
section of **03-Interfaces — Storage, USB and cable interfaces** (sheet 3).
|
|
5
|
+
It records the baseline for future V3V3/GND label and trace improvements.
|
|
6
|
+
No solver implementation is changed.
|
|
7
|
+
|
|
8
|
+
## Source and reduction
|
|
9
|
+
|
|
10
|
+
- Deployment: https://am3352-dev-board.vercel.app/#file=index.circuit.tsx
|
|
11
|
+
- Circuit JSON: https://am3352-dev-board.vercel.app/index/circuit.json
|
|
12
|
+
- User-supplied source link: https://github.com/tscircuit/am3352-dev-board
|
|
13
|
+
(returned 404 when this repro was made).
|
|
14
|
+
- Retrieved 2026-09-15. Circuit JSON SHA-256:
|
|
15
|
+
`a9216069870f58ab841446871ed9101d09aabe2eb7457d130e1285cc204006c3`.
|
|
16
|
+
- Solver baseline: `77c271b` (`@tscircuit/schematic-trace-solver` 0.0.197).
|
|
17
|
+
|
|
18
|
+
The fixture preserves the deployed component centers, sizes, all 36 port
|
|
19
|
+
positions and directions, eight component text obstacles, and 19 named nets.
|
|
20
|
+
Component/port IDs become readable `J_SD` / `J_SD.4` identifiers. Net membership
|
|
21
|
+
comes from source-port connectivity keys, not intersections in the screenshot.
|
|
22
|
+
V3V3 connects J_SD.4, J_SPI.2 and J_I2C.2; GND has 16 terminals, including shield
|
|
23
|
+
and mounting pins. USB0_VBUS remains a separate power net.
|
|
24
|
+
|
|
25
|
+
Other sheet components are omitted. Signals leaving this crop become named
|
|
26
|
+
one-pin nets. The fixture contains no pre-routed output or manually imposed
|
|
27
|
+
trace paths. All selected source connections are port-to-net connections, so
|
|
28
|
+
`directConnections` is empty.
|
|
29
|
+
|
|
30
|
+
This is reconstructed solver input, not a captured original solver invocation.
|
|
31
|
+
Label dimensions and text obstacles follow the current core conventions:
|
|
32
|
+
0.42 rail height; net text width `0.12 * (length + 1)` at 0.18 font size;
|
|
33
|
+
0.12 inline font size with proportionately smaller width; refdes clearance
|
|
34
|
+
0.06 with 0.01 overlap into the component. `maxMspPairDistance: 2.4` uses the
|
|
35
|
+
current core default; the deployment does not expose its original setting.
|
|
36
|
+
|
|
37
|
+
## What it reproduces
|
|
38
|
+
|
|
39
|
+
The baseline routes V3V3 from J_SD.4 down and across to J_I2C.2, and routes GND
|
|
40
|
+
from J_SPI.1 down to J_I2C.1. J_SPI.2 has its own V3V3 label. Ground pin banks
|
|
41
|
+
on the connectors form short buses. These are generated by the solver, not
|
|
42
|
+
hard-coded. The screenshot's external MMC0_DAT2/I2C0_SCL runs are intentionally
|
|
43
|
+
reduced to labeled stubs.
|
|
44
|
+
|
|
45
|
+
The standard snapshot includes both the solver debug view and the semantic
|
|
46
|
+
schematic renderer. Its diagnostic text boxes and generic label rendering are
|
|
47
|
+
not a pixel-for-pixel copy of the deployed site's rail symbols. Use the
|
|
48
|
+
pipeline debugger and stage artifacts to inspect actual placement geometry.
|
|
49
|
+
|
|
50
|
+
## Run
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
bun install
|
|
54
|
+
bun test tests/repros/repro-am3352-sheet3-power-rails.test.ts
|
|
55
|
+
bun run debug:pipeline tests/repros/assets/repro-am3352-sheet3-power-rails.input.json --svg
|
|
56
|
+
bunx tsc --noEmit
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
For interactive investigation, run `bun start` and open
|
|
60
|
+
`SchematicTracePipelineSolver/repro-am3352-sheet3-power-rails` in Cosmos.
|
|
61
|
+
|
|
62
|
+
To intentionally update the baseline after an improvement:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
BUN_UPDATE_SNAPSHOTS=1 bun test tests/repros/repro-am3352-sheet3-power-rails.test.ts
|
|
66
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
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 "tests/fixtures/matcher"
|
|
5
|
+
import input from "./assets/repro-am3352-sheet3-power-rails.input.json"
|
|
6
|
+
|
|
7
|
+
// Reduced from the deployed AM3352 board, sheet 3 (03-Interfaces).
|
|
8
|
+
// See the companion .md for provenance and reconstruction details.
|
|
9
|
+
test("repro AM3352 sheet 3 connector power and ground rails", async () => {
|
|
10
|
+
const problem = structuredClone(input) as InputProblem
|
|
11
|
+
expect(problem.chips.map((chip) => chip.chipId).sort()).toEqual([
|
|
12
|
+
"J_I2C",
|
|
13
|
+
"J_SD",
|
|
14
|
+
"J_SPI",
|
|
15
|
+
"J_USB0",
|
|
16
|
+
])
|
|
17
|
+
expect(
|
|
18
|
+
problem.netConnections.find((net) => net.netId === "V3V3")?.pinIds,
|
|
19
|
+
).toEqual(["J_SD.4", "J_SPI.2", "J_I2C.2"])
|
|
20
|
+
expect(
|
|
21
|
+
problem.netConnections.find((net) => net.netId === "GND")?.pinIds,
|
|
22
|
+
).toHaveLength(16)
|
|
23
|
+
|
|
24
|
+
const pinIds = problem.chips.flatMap((chip) =>
|
|
25
|
+
chip.pins.map((pin) => pin.pinId),
|
|
26
|
+
)
|
|
27
|
+
expect(new Set(pinIds).size).toBe(36)
|
|
28
|
+
expect(problem.netConnections.flatMap((net) => net.pinIds).sort()).toEqual(
|
|
29
|
+
pinIds.sort(),
|
|
30
|
+
)
|
|
31
|
+
expect(problem.availableNetLabelOrientations.V3V3).toEqual(["y+"])
|
|
32
|
+
expect(problem.availableNetLabelOrientations.GND).toEqual(["y-"])
|
|
33
|
+
|
|
34
|
+
const solver = new SchematicTracePipelineSolver(problem)
|
|
35
|
+
solver.solve()
|
|
36
|
+
expect(solver.solved).toBe(true)
|
|
37
|
+
expect(solver.failed).toBe(false)
|
|
38
|
+
await expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
39
|
+
})
|
|
@@ -69,5 +69,18 @@ test("repro: V3V3 net-label branch does not start at the R8 edge", () => {
|
|
|
69
69
|
expect(
|
|
70
70
|
solver.inlineNetLabelSolver!.getOutput().inlineNetLabelPlacements,
|
|
71
71
|
).toHaveLength(0)
|
|
72
|
+
const connector = solver.netLabelToTraceSolver!.outputTraces.find(
|
|
73
|
+
(trace) => trace.mspPairId === "available-net-orientation-1-V3V3",
|
|
74
|
+
)
|
|
75
|
+
expect(connector?.tracePath[0]).toEqual({ x: -6.5, y: -19 })
|
|
76
|
+
const hostTrace = solver.netLabelToTraceSolver!.outputTraces.find((trace) =>
|
|
77
|
+
trace.pinIds.includes("R8.pin2"),
|
|
78
|
+
)
|
|
79
|
+
const v3v3Label = solver.netLabelToTraceSolver!.outputNetLabelPlacements.find(
|
|
80
|
+
(label) => label.netId === "V3V3",
|
|
81
|
+
)
|
|
82
|
+
expect(hostTrace?.tracePath).toContainEqual(connector!.tracePath[0]!)
|
|
83
|
+
expect(connector?.tracePath.at(-1)).toEqual(v3v3Label?.anchorPoint)
|
|
84
|
+
expect(connector?.tracePath.at(-1)?.y).toBeCloseTo(-18.649)
|
|
72
85
|
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
73
86
|
})
|