From 66184c68359313b30f54a8722b919cf49f18d5aa Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 03:05:07 +0700 Subject: [PATCH 01/27] feat: specialized decoupling caps layout --- .../SingleInnerPartitionPackingSolver.ts | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts b/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts index 88db103..b636cc0 100644 --- a/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts +++ b/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts @@ -38,6 +38,16 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { } override _step() { + // Specialized layout for decoupling capacitors + if ( + this.partitionInputProblem.partitionType === "decoupling_caps" && + !this.solved + ) { + this.layout = this.createLinearDecouplingCapLayout() + this.solved = true + return + } + // Initialize PackSolver2 if not already created if (!this.activeSubSolver) { const packInput = this.createPackInput() @@ -165,6 +175,47 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { } } + /** + * Creates a specialized linear layout for decoupling capacitors. + * Arranges them in a clean horizontal row centered at (0,0). + */ + private createLinearDecouplingCapLayout(): OutputLayout { + const chips = Object.values(this.partitionInputProblem.chipMap).sort((a, b) => + a.chipId.localeCompare(b.chipId), + ) + const gap = + this.partitionInputProblem.decouplingCapsGap ?? + this.partitionInputProblem.chipGap + + const chipPlacements: Record = {} + + // Calculate total width of the row + let totalWidth = 0 + for (let i = 0; i < chips.length; i++) { + totalWidth += chips[i]!.size.x + if (i < chips.length - 1) { + totalWidth += gap + } + } + + // Place chips starting from the left, centering the row at x=0 + let currentX = -totalWidth / 2 + for (const chip of chips) { + const halfWidth = chip.size.x / 2 + chipPlacements[chip.chipId] = { + x: currentX + halfWidth, + y: 0, + ccwRotationDegrees: 0, + } + currentX += chip.size.x + gap + } + + return { + chipPlacements, + groupPlacements: {}, + } + } + override visualize(): GraphicsObject { if (this.activeSubSolver && !this.solved) { return this.activeSubSolver.visualize() From 66573aa59c5b588a5a6281af32a20e18f99e9c33 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 03:05:13 +0700 Subject: [PATCH 02/27] test: verify decoupling caps packing --- tests/DecouplingCapsPacking.test.ts | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/DecouplingCapsPacking.test.ts diff --git a/tests/DecouplingCapsPacking.test.ts b/tests/DecouplingCapsPacking.test.ts new file mode 100644 index 0000000..951ca3f --- /dev/null +++ b/tests/DecouplingCapsPacking.test.ts @@ -0,0 +1,49 @@ +import { test, expect } from "bun:test" +import { SingleInnerPartitionPackingSolver } from "../lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver" +import type { PartitionInputProblem } from "../lib/types/InputProblem" + +test("SingleInnerPartitionPackingSolver arranges decoupling capacitors in a clean horizontal row", () => { + const problem: PartitionInputProblem = { + chipMap: { + C1: { chipId: "C1", pins: ["C1.1", "C1.2"], size: { x: 1, y: 2 } }, + C2: { chipId: "C2", pins: ["C2.1", "C2.2"], size: { x: 1, y: 2 } }, + C3: { chipId: "C3", pins: ["C3.1", "C3.2"], size: { x: 1, y: 2 } }, + }, + chipPinMap: { + "C1.1": { pinId: "C1.1", offset: { x: 0, y: 1 }, side: "y+" }, + "C1.2": { pinId: "C1.2", offset: { x: 0, y: -1 }, side: "y-" }, + "C2.1": { pinId: "C2.1", offset: { x: 0, y: 1 }, side: "y+" }, + "C2.2": { pinId: "C2.2", offset: { x: 0, y: -1 }, side: "y-" }, + "C3.1": { pinId: "C3.1", offset: { x: 0, y: 1 }, side: "y+" }, + "C3.2": { pinId: "C3.2", offset: { x: 0, y: -1 }, side: "y-" }, + }, + netMap: {}, + pinStrongConnMap: {}, + netConnMap: {}, + chipGap: 1, + partitionGap: 2, + decouplingCapsGap: 0.5, + partitionType: "decoupling_caps", + isPartition: true, + } + + const solver = new SingleInnerPartitionPackingSolver({ + partitionInputProblem: problem, + pinIdToStronglyConnectedPins: {}, + }) + + solver.solve() + + expect(solver.solved).toBe(true) + expect(solver.layout).toBeDefined() + + const placements = solver.layout!.chipPlacements + + expect(placements["C1"].x).toBeCloseTo(-1.5) + expect(placements["C2"].x).toBeCloseTo(0) + expect(placements["C3"].x).toBeCloseTo(1.5) + + expect(placements["C1"].y).toBe(0) + expect(placements["C2"].y).toBe(0) + expect(placements["C3"].y).toBe(0) +}) From da30d3d2e2ae68edd903822b99379ce7520c8a2f Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 03:25:40 +0700 Subject: [PATCH 03/27] fix: biome formatting --- .../SingleInnerPartitionPackingSolver.ts | 86 ++++++------------- 1 file changed, 25 insertions(+), 61 deletions(-) diff --git a/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts b/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts index b636cc0..934515c 100644 --- a/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts +++ b/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts @@ -13,8 +13,7 @@ import type { ChipId, NetId, ChipPin, - PartitionInputProblem, -} from "../../types/InputProblem" + PartitionInputProblem, from "../../types/InputProblem" import { visualizeInputProblem } from "../LayoutPipelineSolver/visualizeInputProblem" import { createFilteredNetworkMapping } from "../../utils/networkFiltering" import { getPadsBoundingBox } from "./getPadsBoundingBox" @@ -30,12 +29,10 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { constructor(params: { partitionInputProblem: PartitionInputProblem - pinIdToStronglyConnectedPins: Record - }) { + pinIdToStronglyConnectedPins: Record,) { super() this.partitionInputProblem = params.partitionInputProblem - this.pinIdToStronglyConnectedPins = params.pinIdToStronglyConnectedPins - } + this.pinIdToStronglyConnectedPins = params.pinIdToStronglyConnectedPins, override _step() { // Specialized layout for decoupling capacitors @@ -45,15 +42,12 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { ) { this.layout = this.createLinearDecouplingCapLayout() this.solved = true - return - } + return, // Initialize PackSolver2 if not already created if (!this.activeSubSolver) { const packInput = this.createPackInput() - this.activeSubSolver = new PackSolver2(packInput) - this.activeSubSolver = this.activeSubSolver - } + this.activeSubSolver = new PackSolver2(packInput), // Run one step of the PackSolver2 this.activeSubSolver.step() @@ -61,8 +55,7 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { if (this.activeSubSolver.failed) { this.failed = true this.error = `PackSolver2 failed: ${this.activeSubSolver.error}` - return - } + return, if (this.activeSubSolver.solved) { // Apply the packing result to create the layout @@ -70,16 +63,13 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { this.activeSubSolver.packedComponents, ) this.solved = true - this.activeSubSolver = null - } - } + this.activeSubSolver = null, private createPackInput(): PackInput { // Fall back to filtered mapping (weak + strong) const pinToNetworkMap = createFilteredNetworkMapping({ inputProblem: this.partitionInputProblem, - pinIdToStronglyConnectedPins: this.pinIdToStronglyConnectedPins, - }).pinToNetworkMap + pinIdToStronglyConnectedPins: this.pinIdToStronglyConnectedPins,).pinToNetworkMap // Create pack components for each chip const packComponents = Object.entries( @@ -90,9 +80,8 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { padId: string networkId: string type: "rect" - offset: { x: number; y: number } - size: { x: number; y: number } - }> = [] + offset: { x: number y: number } + size: { x: number y: number },> = [] // Create a pad for each pin on this chip for (const pinId of chip.pins) { @@ -107,15 +96,12 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { networkId: networkId, type: "rect" as const, offset: { x: pin.offset.x, y: pin.offset.y }, - size: { x: PIN_SIZE, y: PIN_SIZE }, // Small size for pins - }) - } + size: { x: PIN_SIZE, y: PIN_SIZE }, // Small size for pins,), const padsBoundingBox = getPadsBoundingBox(pads) const padsBoundingBoxSize = { x: padsBoundingBox.maxX - padsBoundingBox.minX, y: padsBoundingBox.maxY - padsBoundingBox.minY, - } // Add chip body pad (disconnected from any network) but make sure // it fully envelopes the "pads" (pins) @@ -127,29 +113,22 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { offset: { x: 0, y: 0 }, size: { x: Math.max(padsBoundingBoxSize.x, chip.size.x), - y: Math.max(padsBoundingBoxSize.y, chip.size.y), - }, - }) + y: Math.max(padsBoundingBoxSize.y, chip.size.y),,) return { componentId: chipId, pads, - availableRotationDegrees: chip.availableRotations || [0, 90, 180, 270], - } - }) + availableRotationDegrees: chip.availableRotations || [0, 90, 180, 270],,) let minGap = this.partitionInputProblem.chipGap if (this.partitionInputProblem.partitionType === "decoupling_caps") { - minGap = this.partitionInputProblem.decouplingCapsGap ?? minGap - } + minGap = this.partitionInputProblem.decouplingCapsGap ?? minGap, return { components: packComponents, minGap, packOrderStrategy: "largest_to_smallest", - packPlacementStrategy: "minimum_closest_sum_squared_distance", - } - } + packPlacementStrategy: "minimum_closest_sum_squared_distance",, private createLayoutFromPackingResult( packedComponents: PackSolver2["packedComponents"], @@ -165,15 +144,11 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { ccwRotationDegrees: packedComponent.ccwRotationOffset || packedComponent.ccwRotationDegrees || - 0, - } - } + 0,, return { chipPlacements, - groupPlacements: {}, - } - } + groupPlacements: {},, /** * Creates a specialized linear layout for decoupling capacitors. @@ -191,12 +166,10 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { // Calculate total width of the row let totalWidth = 0 - for (let i = 0; i < chips.length; i++) { + for (let i = 0 i < chips.length i++) { totalWidth += chips[i]!.size.x if (i < chips.length - 1) { - totalWidth += gap - } - } + totalWidth += gap, // Place chips starting from the left, centering the row at x=0 let currentX = -totalWidth / 2 @@ -206,30 +179,21 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { x: currentX + halfWidth, y: 0, ccwRotationDegrees: 0, - } - currentX += chip.size.x + gap - } + currentX += chip.size.x + gap, return { chipPlacements, - groupPlacements: {}, - } - } + groupPlacements: {},, override visualize(): GraphicsObject { if (this.activeSubSolver && !this.solved) { - return this.activeSubSolver.visualize() - } + return this.activeSubSolver.visualize(), if (!this.layout) { const basicLayout = doBasicInputProblemLayout(this.partitionInputProblem) - return visualizeInputProblem(this.partitionInputProblem, basicLayout) - } + return visualizeInputProblem(this.partitionInputProblem, basicLayout), - return visualizeInputProblem(this.partitionInputProblem, this.layout) - } + return visualizeInputProblem(this.partitionInputProblem, this.layout), override getConstructorParams(): [InputProblem] { - return [this.partitionInputProblem] - } -} + return [this.partitionInputProblem], From 001dde06f41f1d3a48add5a4880bcee7f769b392 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 03:25:42 +0700 Subject: [PATCH 04/27] fix: biome formatting and cleanup --- tests/DecouplingCapsPacking.test.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/DecouplingCapsPacking.test.ts b/tests/DecouplingCapsPacking.test.ts index 951ca3f..2938067 100644 --- a/tests/DecouplingCapsPacking.test.ts +++ b/tests/DecouplingCapsPacking.test.ts @@ -7,16 +7,14 @@ test("SingleInnerPartitionPackingSolver arranges decoupling capacitors in a clea chipMap: { C1: { chipId: "C1", pins: ["C1.1", "C1.2"], size: { x: 1, y: 2 } }, C2: { chipId: "C2", pins: ["C2.1", "C2.2"], size: { x: 1, y: 2 } }, - C3: { chipId: "C3", pins: ["C3.1", "C3.2"], size: { x: 1, y: 2 } }, - }, + C3: { chipId: "C3", pins: ["C3.1", "C3.2"], size: { x: 1, y: 2 } },, chipPinMap: { "C1.1": { pinId: "C1.1", offset: { x: 0, y: 1 }, side: "y+" }, "C1.2": { pinId: "C1.2", offset: { x: 0, y: -1 }, side: "y-" }, "C2.1": { pinId: "C2.1", offset: { x: 0, y: 1 }, side: "y+" }, "C2.2": { pinId: "C2.2", offset: { x: 0, y: -1 }, side: "y-" }, "C3.1": { pinId: "C3.1", offset: { x: 0, y: 1 }, side: "y+" }, - "C3.2": { pinId: "C3.2", offset: { x: 0, y: -1 }, side: "y-" }, - }, + "C3.2": { pinId: "C3.2", offset: { x: 0, y: -1 }, side: "y-" },, netMap: {}, pinStrongConnMap: {}, netConnMap: {}, @@ -25,12 +23,10 @@ test("SingleInnerPartitionPackingSolver arranges decoupling capacitors in a clea decouplingCapsGap: 0.5, partitionType: "decoupling_caps", isPartition: true, - } const solver = new SingleInnerPartitionPackingSolver({ partitionInputProblem: problem, - pinIdToStronglyConnectedPins: {}, - }) + pinIdToStronglyConnectedPins: {},) solver.solve() @@ -45,5 +41,4 @@ test("SingleInnerPartitionPackingSolver arranges decoupling capacitors in a clea expect(placements["C1"].y).toBe(0) expect(placements["C2"].y).toBe(0) - expect(placements["C3"].y).toBe(0) -}) + expect(placements["C3"].y).toBe(0),) From 2aa61397fdff7f0ac7d28b9c469af31bc686ef2f Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 03:28:18 +0700 Subject: [PATCH 05/27] fix: restore syntax and safe formatting --- .../SingleInnerPartitionPackingSolver.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts b/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts index 934515c..bdcadab 100644 --- a/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts +++ b/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts @@ -80,8 +80,8 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { padId: string networkId: string type: "rect" - offset: { x: number y: number } - size: { x: number y: number },> = [] + offset: { x: number; y: number } + size: { x: number; y: number },> = [] // Create a pad for each pin on this chip for (const pinId of chip.pins) { @@ -166,7 +166,7 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { // Calculate total width of the row let totalWidth = 0 - for (let i = 0 i < chips.length i++) { + for (let i = 0; i < chips.length; i++) { totalWidth += chips[i]!.size.x if (i < chips.length - 1) { totalWidth += gap, From 2c1c912b545d8835f65ba08c14ecb61f22ac46ca Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 03:28:23 +0700 Subject: [PATCH 06/27] fix: safe formatting --- tests/DecouplingCapsPacking.test.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/DecouplingCapsPacking.test.ts b/tests/DecouplingCapsPacking.test.ts index 2938067..951ca3f 100644 --- a/tests/DecouplingCapsPacking.test.ts +++ b/tests/DecouplingCapsPacking.test.ts @@ -7,14 +7,16 @@ test("SingleInnerPartitionPackingSolver arranges decoupling capacitors in a clea chipMap: { C1: { chipId: "C1", pins: ["C1.1", "C1.2"], size: { x: 1, y: 2 } }, C2: { chipId: "C2", pins: ["C2.1", "C2.2"], size: { x: 1, y: 2 } }, - C3: { chipId: "C3", pins: ["C3.1", "C3.2"], size: { x: 1, y: 2 } },, + C3: { chipId: "C3", pins: ["C3.1", "C3.2"], size: { x: 1, y: 2 } }, + }, chipPinMap: { "C1.1": { pinId: "C1.1", offset: { x: 0, y: 1 }, side: "y+" }, "C1.2": { pinId: "C1.2", offset: { x: 0, y: -1 }, side: "y-" }, "C2.1": { pinId: "C2.1", offset: { x: 0, y: 1 }, side: "y+" }, "C2.2": { pinId: "C2.2", offset: { x: 0, y: -1 }, side: "y-" }, "C3.1": { pinId: "C3.1", offset: { x: 0, y: 1 }, side: "y+" }, - "C3.2": { pinId: "C3.2", offset: { x: 0, y: -1 }, side: "y-" },, + "C3.2": { pinId: "C3.2", offset: { x: 0, y: -1 }, side: "y-" }, + }, netMap: {}, pinStrongConnMap: {}, netConnMap: {}, @@ -23,10 +25,12 @@ test("SingleInnerPartitionPackingSolver arranges decoupling capacitors in a clea decouplingCapsGap: 0.5, partitionType: "decoupling_caps", isPartition: true, + } const solver = new SingleInnerPartitionPackingSolver({ partitionInputProblem: problem, - pinIdToStronglyConnectedPins: {},) + pinIdToStronglyConnectedPins: {}, + }) solver.solve() @@ -41,4 +45,5 @@ test("SingleInnerPartitionPackingSolver arranges decoupling capacitors in a clea expect(placements["C1"].y).toBe(0) expect(placements["C2"].y).toBe(0) - expect(placements["C3"].y).toBe(0),) + expect(placements["C3"].y).toBe(0) +}) From e145adbfd04e5f32bcce405b8c28a7e191041510 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 03:37:42 +0700 Subject: [PATCH 07/27] fix: absolute-clean-syntax-rewrite --- .../SingleInnerPartitionPackingSolver.ts | 85 +++++++++++++------ 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts b/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts index bdcadab..20a429b 100644 --- a/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts +++ b/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts @@ -10,10 +10,9 @@ import type { OutputLayout, Placement } from "../../types/OutputLayout" import type { InputProblem, PinId, - ChipId, - NetId, ChipPin, - PartitionInputProblem, from "../../types/InputProblem" + PartitionInputProblem, +} from "../../types/InputProblem" import { visualizeInputProblem } from "../LayoutPipelineSolver/visualizeInputProblem" import { createFilteredNetworkMapping } from "../../utils/networkFiltering" import { getPadsBoundingBox } from "./getPadsBoundingBox" @@ -24,15 +23,17 @@ const PIN_SIZE = 0.1 export class SingleInnerPartitionPackingSolver extends BaseSolver { partitionInputProblem: PartitionInputProblem layout: OutputLayout | null = null - declare activeSubSolver: PackSolver2 | null + activeSubSolver: PackSolver2 | null = null pinIdToStronglyConnectedPins: Record constructor(params: { partitionInputProblem: PartitionInputProblem - pinIdToStronglyConnectedPins: Record,) { + pinIdToStronglyConnectedPins: Record + }) { super() this.partitionInputProblem = params.partitionInputProblem - this.pinIdToStronglyConnectedPins = params.pinIdToStronglyConnectedPins, + this.pinIdToStronglyConnectedPins = params.pinIdToStronglyConnectedPins + } override _step() { // Specialized layout for decoupling capacitors @@ -42,12 +43,14 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { ) { this.layout = this.createLinearDecouplingCapLayout() this.solved = true - return, + return + } // Initialize PackSolver2 if not already created if (!this.activeSubSolver) { const packInput = this.createPackInput() - this.activeSubSolver = new PackSolver2(packInput), + this.activeSubSolver = new PackSolver2(packInput) + } // Run one step of the PackSolver2 this.activeSubSolver.step() @@ -55,7 +58,8 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { if (this.activeSubSolver.failed) { this.failed = true this.error = `PackSolver2 failed: ${this.activeSubSolver.error}` - return, + return + } if (this.activeSubSolver.solved) { // Apply the packing result to create the layout @@ -63,13 +67,16 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { this.activeSubSolver.packedComponents, ) this.solved = true - this.activeSubSolver = null, + this.activeSubSolver = null + } + } private createPackInput(): PackInput { // Fall back to filtered mapping (weak + strong) const pinToNetworkMap = createFilteredNetworkMapping({ inputProblem: this.partitionInputProblem, - pinIdToStronglyConnectedPins: this.pinIdToStronglyConnectedPins,).pinToNetworkMap + pinIdToStronglyConnectedPins: this.pinIdToStronglyConnectedPins, + }).pinToNetworkMap // Create pack components for each chip const packComponents = Object.entries( @@ -81,7 +88,8 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { networkId: string type: "rect" offset: { x: number; y: number } - size: { x: number; y: number },> = [] + size: { x: number; y: number } + }> = [] // Create a pad for each pin on this chip for (const pinId of chip.pins) { @@ -96,12 +104,15 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { networkId: networkId, type: "rect" as const, offset: { x: pin.offset.x, y: pin.offset.y }, - size: { x: PIN_SIZE, y: PIN_SIZE }, // Small size for pins,), + size: { x: PIN_SIZE, y: PIN_SIZE }, // Small size for pins + }) + } const padsBoundingBox = getPadsBoundingBox(pads) const padsBoundingBoxSize = { x: padsBoundingBox.maxX - padsBoundingBox.minX, y: padsBoundingBox.maxY - padsBoundingBox.minY, + } // Add chip body pad (disconnected from any network) but make sure // it fully envelopes the "pads" (pins) @@ -113,22 +124,29 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { offset: { x: 0, y: 0 }, size: { x: Math.max(padsBoundingBoxSize.x, chip.size.x), - y: Math.max(padsBoundingBoxSize.y, chip.size.y),,) + y: Math.max(padsBoundingBoxSize.y, chip.size.y), + }, + }) return { componentId: chipId, pads, - availableRotationDegrees: chip.availableRotations || [0, 90, 180, 270],,) + availableRotationDegrees: chip.availableRotations || [0, 90, 180, 270], + } + }) let minGap = this.partitionInputProblem.chipGap if (this.partitionInputProblem.partitionType === "decoupling_caps") { - minGap = this.partitionInputProblem.decouplingCapsGap ?? minGap, + minGap = this.partitionInputProblem.decouplingCapsGap ?? minGap + } return { components: packComponents, minGap, packOrderStrategy: "largest_to_smallest", - packPlacementStrategy: "minimum_closest_sum_squared_distance",, + packPlacementStrategy: "minimum_closest_sum_squared_distance", + } + } private createLayoutFromPackingResult( packedComponents: PackSolver2["packedComponents"], @@ -144,11 +162,15 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { ccwRotationDegrees: packedComponent.ccwRotationOffset || packedComponent.ccwRotationDegrees || - 0,, + 0, + } + } return { chipPlacements, - groupPlacements: {},, + groupPlacements: {}, + } + } /** * Creates a specialized linear layout for decoupling capacitors. @@ -169,7 +191,9 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { for (let i = 0; i < chips.length; i++) { totalWidth += chips[i]!.size.x if (i < chips.length - 1) { - totalWidth += gap, + totalWidth += gap + } + } // Place chips starting from the left, centering the row at x=0 let currentX = -totalWidth / 2 @@ -179,21 +203,30 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { x: currentX + halfWidth, y: 0, ccwRotationDegrees: 0, - currentX += chip.size.x + gap, + } + currentX += chip.size.x + gap + } return { chipPlacements, - groupPlacements: {},, + groupPlacements: {}, + } + } override visualize(): GraphicsObject { if (this.activeSubSolver && !this.solved) { - return this.activeSubSolver.visualize(), + return this.activeSubSolver.visualize() + } if (!this.layout) { const basicLayout = doBasicInputProblemLayout(this.partitionInputProblem) - return visualizeInputProblem(this.partitionInputProblem, basicLayout), + return visualizeInputProblem(this.partitionInputProblem, basicLayout) + } - return visualizeInputProblem(this.partitionInputProblem, this.layout), + return visualizeInputProblem(this.partitionInputProblem, this.layout) + } override getConstructorParams(): [InputProblem] { - return [this.partitionInputProblem], + return [this.partitionInputProblem] + } +} From 884520472dd13e0e8ebc88bec9856fbcc130d234 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 03:43:32 +0700 Subject: [PATCH 08/27] fix: address ci type errors and formatting --- .../SingleInnerPartitionPackingSolver.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts b/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts index 20a429b..7b7ebd8 100644 --- a/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts +++ b/lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts @@ -23,7 +23,7 @@ const PIN_SIZE = 0.1 export class SingleInnerPartitionPackingSolver extends BaseSolver { partitionInputProblem: PartitionInputProblem layout: OutputLayout | null = null - activeSubSolver: PackSolver2 | null = null + override activeSubSolver: PackSolver2 | null = null pinIdToStronglyConnectedPins: Record constructor(params: { @@ -177,8 +177,8 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver { * Arranges them in a clean horizontal row centered at (0,0). */ private createLinearDecouplingCapLayout(): OutputLayout { - const chips = Object.values(this.partitionInputProblem.chipMap).sort((a, b) => - a.chipId.localeCompare(b.chipId), + const chips = Object.values(this.partitionInputProblem.chipMap).sort( + (a, b) => a.chipId.localeCompare(b.chipId), ) const gap = this.partitionInputProblem.decouplingCapsGap ?? From 9a954a7bc9a5d6e52d0eb6d21da583769b40b24b Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 03:43:35 +0700 Subject: [PATCH 09/27] fix: address ci type errors and formatting --- tests/DecouplingCapsPacking.test.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/DecouplingCapsPacking.test.ts b/tests/DecouplingCapsPacking.test.ts index 951ca3f..e861b6b 100644 --- a/tests/DecouplingCapsPacking.test.ts +++ b/tests/DecouplingCapsPacking.test.ts @@ -38,12 +38,12 @@ test("SingleInnerPartitionPackingSolver arranges decoupling capacitors in a clea expect(solver.layout).toBeDefined() const placements = solver.layout!.chipPlacements - - expect(placements["C1"].x).toBeCloseTo(-1.5) - expect(placements["C2"].x).toBeCloseTo(0) - expect(placements["C3"].x).toBeCloseTo(1.5) - - expect(placements["C1"].y).toBe(0) - expect(placements["C2"].y).toBe(0) - expect(placements["C3"].y).toBe(0) + + expect(placements["C1"]!.x).toBeCloseTo(-1.5) + expect(placements["C2"]!.x).toBeCloseTo(0) + expect(placements["C3"]!.x).toBeCloseTo(1.5) + + expect(placements["C1"]!.y).toBe(0) + expect(placements["C2"]!.y).toBe(0) + expect(placements["C3"]!.y).toBe(0) }) From 7206e2f3871245748ddc0196a4ab4daf49e9ad67 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:05:05 +0700 Subject: [PATCH 10/27] fix: bump dependencies to resolve broken circuit-to-svg export --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 1fd506e..85e925d 100644 --- a/package.json +++ b/package.json @@ -16,20 +16,20 @@ "devDependencies": { "@biomejs/biome": "^2.1.3", "@react-hook/resize-observer": "^2.0.2", - "@tscircuit/circuit-json-util": "^0.0.64", - "@tscircuit/math-utils": "^0.0.19", - "@tscircuit/schematic-viewer": "^2.0.26", + "@tscircuit/circuit-json-util": "^0.0.94", + "@tscircuit/math-utils": "^0.0.36", + "@tscircuit/schematic-viewer": "^2.0.61", "@types/bun": "latest", "bpc-graph": "^0.0.66", - "calculate-packing": "^0.0.31", - "circuit-json": "^0.0.226", - "graphics-debug": "^0.0.64", + "calculate-packing": "^0.0.73", + "circuit-json": "^0.0.424", + "graphics-debug": "^0.0.94", "react-cosmos": "^7.0.0", "react-cosmos-plugin-vite": "^7.0.0", - "tscircuit": "^0.0.593", + "tscircuit": "^0.0.1738", "tsup": "^8.5.0" }, "peerDependencies": { "typescript": "^5" } -} +} \ No newline at end of file From 51171046fe82d415325653d4f27db37f12ec5ac1 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:05:12 +0700 Subject: [PATCH 11/27] refactor: decouple problem data from UI --- .../LayoutPipelineSolver06.page.tsx | 877 +----------------- 1 file changed, 2 insertions(+), 875 deletions(-) diff --git a/pages/LayoutPipelineSolver/LayoutPipelineSolver06.page.tsx b/pages/LayoutPipelineSolver/LayoutPipelineSolver06.page.tsx index c0767bb..19851fa 100644 --- a/pages/LayoutPipelineSolver/LayoutPipelineSolver06.page.tsx +++ b/pages/LayoutPipelineSolver/LayoutPipelineSolver06.page.tsx @@ -1,880 +1,7 @@ -import type { PackInput } from "calculate-packing" import { LayoutPipelineDebugger } from "lib/components/LayoutPipelineDebugger" -import type { InputProblem } from "lib/index" +import { problem } from "./LayoutPipelineSolver06.problem" -export const problem: InputProblem = { - chipMap: { - U3: { - chipId: "U3", - pins: [ - "U3.1", - "U3.2", - "U3.3", - "U3.4", - "U3.5", - "U3.6", - "U3.7", - "U3.8", - "U3.9", - "U3.10", - "U3.11", - "U3.12", - "U3.13", - "U3.14", - "U3.15", - "U3.16", - "U3.17", - "U3.18", - "U3.19", - "U3.20", - "U3.21", - "U3.22", - "U3.23", - "U3.24", - "U3.25", - "U3.26", - "U3.27", - "U3.28", - "U3.29", - "U3.30", - "U3.31", - "U3.32", - "U3.33", - "U3.34", - "U3.35", - "U3.36", - "U3.37", - "U3.38", - "U3.39", - "U3.40", - "U3.41", - "U3.42", - "U3.43", - "U3.44", - "U3.45", - "U3.46", - "U3.47", - "U3.48", - "U3.49", - "U3.50", - "U3.51", - "U3.52", - "U3.53", - "U3.54", - "U3.55", - "U3.56", - "U3.57", - ], - size: { - x: 3, - y: 8.400000000000004, - }, - availableRotations: [0, 90, 180, 270], - }, - C12: { - chipId: "C12", - pins: ["C12.1", "C12.2"], - size: { - x: 0.53, - y: 1.06, - }, - availableRotations: [0], - }, - C14: { - chipId: "C14", - pins: ["C14.1", "C14.2"], - size: { - x: 0.53, - y: 1.06, - }, - availableRotations: [0], - }, - C8: { - chipId: "C8", - pins: ["C8.1", "C8.2"], - size: { - x: 0.53, - y: 1.06, - }, - availableRotations: [0], - }, - C13: { - chipId: "C13", - pins: ["C13.1", "C13.2"], - size: { - x: 0.53, - y: 1.06, - }, - availableRotations: [0], - }, - C15: { - chipId: "C15", - pins: ["C15.1", "C15.2"], - size: { - x: 0.53, - y: 1.06, - }, - availableRotations: [0], - }, - C19: { - chipId: "C19", - pins: ["C19.1", "C19.2"], - size: { - x: 0.53, - y: 1.06, - }, - availableRotations: [0], - }, - C18: { - chipId: "C18", - pins: ["C18.1", "C18.2"], - size: { - x: 0.53, - y: 1.06, - }, - availableRotations: [0], - }, - C7: { - chipId: "C7", - pins: ["C7.1", "C7.2"], - size: { - x: 0.53, - y: 1.06, - }, - availableRotations: [0], - }, - C9: { - chipId: "C9", - pins: ["C9.1", "C9.2"], - size: { - x: 0.53, - y: 1.06, - }, - availableRotations: [0], - }, - C10: { - chipId: "C10", - pins: ["C10.1", "C10.2"], - size: { - x: 0.53, - y: 1.06, - }, - availableRotations: [0], - }, - C11: { - chipId: "C11", - pins: ["C11.1", "C11.2"], - size: { - x: 0.53, - y: 1.06, - }, - availableRotations: [0], - }, - }, - chipPinMap: { - "U3.1": { - pinId: "U3.1", - offset: { - x: -1.9, - y: 1.2000000000000015, - }, - side: "x-", - }, - "U3.2": { - pinId: "U3.2", - offset: { - x: -1.9, - y: -1.8000000000000007, - }, - side: "x-", - }, - "U3.3": { - pinId: "U3.3", - offset: { - x: -1.9, - y: -2.000000000000001, - }, - side: "x-", - }, - "U3.4": { - pinId: "U3.4", - offset: { - x: -1.9, - y: -2.200000000000001, - }, - side: "x-", - }, - "U3.5": { - pinId: "U3.5", - offset: { - x: -1.9, - y: -2.4000000000000012, - }, - side: "x-", - }, - "U3.6": { - pinId: "U3.6", - offset: { - x: -1.9, - y: -2.6000000000000014, - }, - side: "x-", - }, - "U3.7": { - pinId: "U3.7", - offset: { - x: -1.9, - y: -2.8000000000000016, - }, - side: "x-", - }, - "U3.8": { - pinId: "U3.8", - offset: { - x: -1.9, - y: -3.0000000000000018, - }, - side: "x-", - }, - "U3.9": { - pinId: "U3.9", - offset: { - x: -1.9, - y: -3.200000000000002, - }, - side: "x-", - }, - "U3.10": { - pinId: "U3.10", - offset: { - x: -1.9, - y: 1.0000000000000013, - }, - side: "x-", - }, - "U3.11": { - pinId: "U3.11", - offset: { - x: -1.9, - y: -3.400000000000002, - }, - side: "x-", - }, - "U3.12": { - pinId: "U3.12", - offset: { - x: -1.9, - y: -3.6000000000000023, - }, - side: "x-", - }, - "U3.13": { - pinId: "U3.13", - offset: { - x: -1.9, - y: -3.8000000000000025, - }, - side: "x-", - }, - "U3.14": { - pinId: "U3.14", - offset: { - x: -1.9, - y: -4.000000000000002, - }, - side: "x-", - }, - "U3.15": { - pinId: "U3.15", - offset: { - x: 1.9, - y: -0.5000000000000009, - }, - side: "x+", - }, - "U3.16": { - pinId: "U3.16", - offset: { - x: 1.9, - y: -0.7000000000000011, - }, - side: "x+", - }, - "U3.17": { - pinId: "U3.17", - offset: { - x: 1.9, - y: -0.9000000000000012, - }, - side: "x+", - }, - "U3.18": { - pinId: "U3.18", - offset: { - x: 1.9, - y: -1.1000000000000014, - }, - side: "x+", - }, - "U3.19": { - pinId: "U3.19", - offset: { - x: 1.9, - y: -1.3000000000000014, - }, - side: "x+", - }, - "U3.20": { - pinId: "U3.20", - offset: { - x: 1.9, - y: -1.9000000000000015, - }, - side: "x+", - }, - "U3.21": { - pinId: "U3.21", - offset: { - x: 1.9, - y: -2.1000000000000014, - }, - side: "x+", - }, - "U3.22": { - pinId: "U3.22", - offset: { - x: -1.9, - y: 0.8000000000000012, - }, - side: "x-", - }, - "U3.23": { - pinId: "U3.23", - offset: { - x: -1.9, - y: 2.8000000000000016, - }, - side: "x-", - }, - "U3.24": { - pinId: "U3.24", - offset: { - x: 1.9, - y: -2.7000000000000015, - }, - side: "x+", - }, - "U3.25": { - pinId: "U3.25", - offset: { - x: 1.9, - y: -2.9000000000000012, - }, - side: "x+", - }, - "U3.26": { - pinId: "U3.26", - offset: { - x: 1.9, - y: -3.1000000000000014, - }, - side: "x+", - }, - "U3.27": { - pinId: "U3.27", - offset: { - x: 1.9, - y: 0.0999999999999992, - }, - side: "x+", - }, - "U3.28": { - pinId: "U3.28", - offset: { - x: 1.9, - y: 0.2999999999999994, - }, - side: "x+", - }, - "U3.29": { - pinId: "U3.29", - offset: { - x: 1.9, - y: 0.49999999999999956, - }, - side: "x+", - }, - "U3.30": { - pinId: "U3.30", - offset: { - x: 1.9, - y: 0.6999999999999997, - }, - side: "x+", - }, - "U3.31": { - pinId: "U3.31", - offset: { - x: 1.9, - y: 0.8999999999999995, - }, - side: "x+", - }, - "U3.32": { - pinId: "U3.32", - offset: { - x: 1.9, - y: 1.0999999999999996, - }, - side: "x+", - }, - "U3.33": { - pinId: "U3.33", - offset: { - x: -1.9, - y: 0.600000000000001, - }, - side: "x-", - }, - "U3.34": { - pinId: "U3.34", - offset: { - x: 1.9, - y: 1.2999999999999998, - }, - side: "x+", - }, - "U3.35": { - pinId: "U3.35", - offset: { - x: 1.9, - y: 1.5, - }, - side: "x+", - }, - "U3.36": { - pinId: "U3.36", - offset: { - x: 1.9, - y: 1.7000000000000002, - }, - side: "x+", - }, - "U3.37": { - pinId: "U3.37", - offset: { - x: 1.9, - y: 1.9000000000000004, - }, - side: "x+", - }, - "U3.38": { - pinId: "U3.38", - offset: { - x: 1.9, - y: 2.500000000000001, - }, - side: "x+", - }, - "U3.39": { - pinId: "U3.39", - offset: { - x: 1.9, - y: 2.700000000000001, - }, - side: "x+", - }, - "U3.40": { - pinId: "U3.40", - offset: { - x: 1.9, - y: 2.9000000000000012, - }, - side: "x+", - }, - "U3.41": { - pinId: "U3.41", - offset: { - x: 1.9, - y: 3.1000000000000014, - }, - side: "x+", - }, - "U3.42": { - pinId: "U3.42", - offset: { - x: -1.9, - y: 0.4000000000000008, - }, - side: "x-", - }, - "U3.43": { - pinId: "U3.43", - offset: { - x: -1.9, - y: -1.6000000000000005, - }, - side: "x-", - }, - "U3.44": { - pinId: "U3.44", - offset: { - x: -1.9, - y: 2.0000000000000018, - }, - side: "x-", - }, - "U3.45": { - pinId: "U3.45", - offset: { - x: -1.9, - y: 1.8000000000000016, - }, - side: "x-", - }, - "U3.46": { - pinId: "U3.46", - offset: { - x: -1.9, - y: -1.4000000000000004, - }, - side: "x-", - }, - "U3.47": { - pinId: "U3.47", - offset: { - x: -1.9, - y: -1.2000000000000002, - }, - side: "x-", - }, - "U3.48": { - pinId: "U3.48", - offset: { - x: -1.9, - y: -1, - }, - side: "x-", - }, - "U3.49": { - pinId: "U3.49", - offset: { - x: -1.9, - y: 0.20000000000000062, - }, - side: "x-", - }, - "U3.50": { - pinId: "U3.50", - offset: { - x: -1.9, - y: 2.600000000000002, - }, - side: "x-", - }, - "U3.51": { - pinId: "U3.51", - offset: { - x: -1.9, - y: 3.0000000000000018, - }, - side: "x-", - }, - "U3.52": { - pinId: "U3.52", - offset: { - x: -1.9, - y: 3.200000000000002, - }, - side: "x-", - }, - "U3.53": { - pinId: "U3.53", - offset: { - x: -1.9, - y: 3.4000000000000017, - }, - side: "x-", - }, - "U3.54": { - pinId: "U3.54", - offset: { - x: -1.9, - y: 3.600000000000002, - }, - side: "x-", - }, - "U3.55": { - pinId: "U3.55", - offset: { - x: -1.9, - y: 3.8000000000000016, - }, - side: "x-", - }, - "U3.56": { - pinId: "U3.56", - offset: { - x: -1.9, - y: 4.000000000000002, - }, - side: "x-", - }, - "U3.57": { - pinId: "U3.57", - offset: { - x: -1.9, - y: -0.39999999999999947, - }, - side: "x-", - }, - "C12.1": { - pinId: "C12.1", - offset: { - x: -3.469446951953614e-17, - y: 0.55, - }, - side: "y+", - }, - "C12.2": { - pinId: "C12.2", - offset: { - x: 3.469446951953614e-17, - y: -0.55, - }, - side: "y-", - }, - "C14.1": { - pinId: "C14.1", - offset: { - x: -3.469446951953614e-17, - y: 0.55, - }, - side: "y+", - }, - "C14.2": { - pinId: "C14.2", - offset: { - x: 3.469446951953614e-17, - y: -0.55, - }, - side: "y-", - }, - "C8.1": { - pinId: "C8.1", - offset: { - x: -3.469446951953614e-17, - y: 0.55, - }, - side: "y+", - }, - "C8.2": { - pinId: "C8.2", - offset: { - x: 3.469446951953614e-17, - y: -0.55, - }, - side: "y-", - }, - "C13.1": { - pinId: "C13.1", - offset: { - x: -3.469446951953614e-17, - y: 0.55, - }, - side: "y+", - }, - "C13.2": { - pinId: "C13.2", - offset: { - x: 3.469446951953614e-17, - y: -0.55, - }, - side: "y-", - }, - "C15.1": { - pinId: "C15.1", - offset: { - x: -3.469446951953614e-17, - y: 0.55, - }, - side: "y+", - }, - "C15.2": { - pinId: "C15.2", - offset: { - x: 3.469446951953614e-17, - y: -0.55, - }, - side: "y-", - }, - "C19.1": { - pinId: "C19.1", - offset: { - x: -3.469446951953614e-17, - y: 0.55, - }, - side: "y+", - }, - "C19.2": { - pinId: "C19.2", - offset: { - x: 3.469446951953614e-17, - y: -0.55, - }, - side: "y-", - }, - "C18.1": { - pinId: "C18.1", - offset: { - x: -3.469446951953614e-17, - y: 0.55, - }, - side: "y+", - }, - "C18.2": { - pinId: "C18.2", - offset: { - x: 3.469446951953614e-17, - y: -0.55, - }, - side: "y-", - }, - "C7.1": { - pinId: "C7.1", - offset: { - x: -3.469446951953614e-17, - y: 0.55, - }, - side: "y+", - }, - "C7.2": { - pinId: "C7.2", - offset: { - x: 3.469446951953614e-17, - y: -0.55, - }, - side: "y-", - }, - "C9.1": { - pinId: "C9.1", - offset: { - x: -3.469446951953614e-17, - y: 0.55, - }, - side: "y+", - }, - "C9.2": { - pinId: "C9.2", - offset: { - x: 3.469446951953614e-17, - y: -0.55, - }, - side: "y-", - }, - "C10.1": { - pinId: "C10.1", - offset: { - x: -3.469446951953614e-17, - y: 0.55, - }, - side: "y+", - }, - "C10.2": { - pinId: "C10.2", - offset: { - x: 3.469446951953614e-17, - y: -0.55, - }, - side: "y-", - }, - "C11.1": { - pinId: "C11.1", - offset: { - x: -3.469446951953614e-17, - y: 0.55, - }, - side: "y+", - }, - "C11.2": { - pinId: "C11.2", - offset: { - x: 3.469446951953614e-17, - y: -0.55, - }, - side: "y-", - }, - }, - netMap: { - V3_3: { - netId: "V3_3", - isPositiveVoltageSource: true, - }, - V1_1: { - netId: "V1_1", - isPositiveVoltageSource: true, - }, - GND: { - netId: "GND", - isGround: true, - }, - }, - pinStrongConnMap: { - "U3.1-C12.1": true, - "C12.1-U3.1": true, - "U3.10-C14.1": true, - "C14.1-U3.10": true, - "U3.22-C8.1": true, - "C8.1-U3.22": true, - "U3.33-C13.1": true, - "C13.1-U3.33": true, - "U3.42-C15.1": true, - "C15.1-U3.42": true, - "U3.49-C19.1": true, - "C19.1-U3.49": true, - "U3.23-C18.1": true, - "C18.1-U3.23": true, - "U3.50-C7.1": true, - "C7.1-U3.50": true, - "C11.1-U3.43": true, - "U3.43-C11.1": true, - "C10.1-U3.44": true, - "U3.44-C10.1": true, - }, - netConnMap: { - "U3.1-V3_3": true, - "U3.10-V3_3": true, - "U3.22-V3_3": true, - "U3.33-V3_3": true, - "U3.42-V3_3": true, - "U3.49-V3_3": true, - "C12.1-V3_3": true, - "C14.1-V3_3": true, - "C8.1-V3_3": true, - "C13.1-V3_3": true, - "C15.1-V3_3": true, - "C19.1-V3_3": true, - "U3.23-V1_1": true, - "U3.50-V1_1": true, - "C18.1-V1_1": true, - "C7.1-V1_1": true, - "C9.1-V1_1": true, - "C12.2-GND": true, - "C14.2-GND": true, - "C8.2-GND": true, - "C13.2-GND": true, - "C15.2-GND": true, - "C19.2-GND": true, - "C18.2-GND": true, - "C7.2-GND": true, - "C9.2-GND": true, - "C10.2-GND": true, - "C11.2-GND": true, - }, - chipGap: 0.6, - decouplingCapsGap: 0.2, - partitionGap: 1.2, -} +export { problem } export default function LayoutPipelineSolver06Page() { return From 64d2509137d0c879c39897e8372b5ecbed957b93 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:05:15 +0700 Subject: [PATCH 12/27] feat: extracted problem data --- .../LayoutPipelineSolver06.problem.ts | 875 ++++++++++++++++++ 1 file changed, 875 insertions(+) create mode 100644 pages/LayoutPipelineSolver/LayoutPipelineSolver06.problem.ts diff --git a/pages/LayoutPipelineSolver/LayoutPipelineSolver06.problem.ts b/pages/LayoutPipelineSolver/LayoutPipelineSolver06.problem.ts new file mode 100644 index 0000000..6c5f711 --- /dev/null +++ b/pages/LayoutPipelineSolver/LayoutPipelineSolver06.problem.ts @@ -0,0 +1,875 @@ +import type { InputProblem } from "lib/index" + +export const problem: InputProblem = { + chipMap: { + U3: { + chipId: "U3", + pins: [ + "U3.1", + "U3.2", + "U3.3", + "U3.4", + "U3.5", + "U3.6", + "U3.7", + "U3.8", + "U3.9", + "U3.10", + "U3.11", + "U3.12", + "U3.13", + "U3.14", + "U3.15", + "U3.16", + "U3.17", + "U3.18", + "U3.19", + "U3.20", + "U3.21", + "U3.22", + "U3.23", + "U3.24", + "U3.25", + "U3.26", + "U3.27", + "U3.28", + "U3.29", + "U3.30", + "U3.31", + "U3.32", + "U3.33", + "U3.34", + "U3.35", + "U3.36", + "U3.37", + "U3.38", + "U3.39", + "U3.40", + "U3.41", + "U3.42", + "U3.43", + "U3.44", + "U3.45", + "U3.46", + "U3.47", + "U3.48", + "U3.49", + "U3.50", + "U3.51", + "U3.52", + "U3.53", + "U3.54", + "U3.55", + "U3.56", + "U3.57", + ], + size: { + x: 3, + y: 8.400000000000004, + }, + availableRotations: [0, 90, 180, 270], + }, + C12: { + chipId: "C12", + pins: ["C12.1", "C12.2"], + size: { + x: 0.53, + y: 1.06, + }, + availableRotations: [0], + }, + C14: { + chipId: "C14", + pins: ["C14.1", "C14.2"], + size: { + x: 0.53, + y: 1.06, + }, + availableRotations: [0], + }, + C8: { + chipId: "C8", + pins: ["C8.1", "C8.2"], + size: { + x: 0.53, + y: 1.06, + }, + availableRotations: [0], + }, + C13: { + chipId: "C13", + pins: ["C13.1", "C13.2"], + size: { + x: 0.53, + y: 1.06, + }, + availableRotations: [0], + }, + C15: { + chipId: "C15", + pins: ["C15.1", "C15.2"], + size: { + x: 0.53, + y: 1.06, + }, + availableRotations: [0], + }, + C19: { + chipId: "C19", + pins: ["C19.1", "C19.2"], + size: { + x: 0.53, + y: 1.06, + }, + availableRotations: [0], + }, + C18: { + chipId: "C18", + pins: ["C18.1", "C18.2"], + size: { + x: 0.53, + y: 1.06, + }, + availableRotations: [0], + }, + C7: { + chipId: "C7", + pins: ["C7.1", "C7.2"], + size: { + x: 0.53, + y: 1.06, + }, + availableRotations: [0], + }, + C9: { + chipId: "C9", + pins: ["C9.1", "C9.2"], + size: { + x: 0.53, + y: 1.06, + }, + availableRotations: [0], + }, + C10: { + chipId: "C10", + pins: ["C10.1", "C10.2"], + size: { + x: 0.53, + y: 1.06, + }, + availableRotations: [0], + }, + C11: { + chipId: "C11", + pins: ["C11.1", "C11.2"], + size: { + x: 0.53, + y: 1.06, + }, + availableRotations: [0], + }, + }, + chipPinMap: { + "U3.1": { + pinId: "U3.1", + offset: { + x: -1.9, + y: 1.2000000000000015, + }, + side: "x-", + }, + "U3.2": { + pinId: "U3.2", + offset: { + x: -1.9, + y: -1.8000000000000007, + }, + side: "x-", + }, + "U3.3": { + pinId: "U3.3", + offset: { + x: -1.9, + y: -2.000000000000001, + }, + side: "x-", + }, + "U3.4": { + pinId: "U3.4", + offset: { + x: -1.9, + y: -2.200000000000001, + }, + side: "x-", + }, + "U3.5": { + pinId: "U3.5", + offset: { + x: -1.9, + y: -2.4000000000000012, + }, + side: "x-", + }, + "U3.6": { + pinId: "U3.6", + offset: { + x: -1.9, + y: -2.6000000000000014, + }, + side: "x-", + }, + "U3.7": { + pinId: "U3.7", + offset: { + x: -1.9, + y: -2.8000000000000016, + }, + side: "x-", + }, + "U3.8": { + pinId: "U3.8", + offset: { + x: -1.9, + y: -3.0000000000000018, + }, + side: "x-", + }, + "U3.9": { + pinId: "U3.9", + offset: { + x: -1.9, + y: -3.200000000000002, + }, + side: "x-", + }, + "U3.10": { + pinId: "U3.10", + offset: { + x: -1.9, + y: 1.0000000000000013, + }, + side: "x-", + }, + "U3.11": { + pinId: "U3.11", + offset: { + x: -1.9, + y: -3.400000000000002, + }, + side: "x-", + }, + "U3.12": { + pinId: "U3.12", + offset: { + x: -1.9, + y: -3.6000000000000023, + }, + side: "x-", + }, + "U3.13": { + pinId: "U3.13", + offset: { + x: -1.9, + y: -3.8000000000000025, + }, + side: "x-", + }, + "U3.14": { + pinId: "U3.14", + offset: { + x: -1.9, + y: -4.000000000000002, + }, + side: "x-", + }, + "U3.15": { + pinId: "U3.15", + offset: { + x: 1.9, + y: -0.5000000000000009, + }, + side: "x+", + }, + "U3.16": { + pinId: "U3.16", + offset: { + x: 1.9, + y: -0.7000000000000011, + }, + side: "x+", + }, + "U3.17": { + pinId: "U3.17", + offset: { + x: 1.9, + y: -0.9000000000000012, + }, + side: "x+", + }, + "U3.18": { + pinId: "U3.18", + offset: { + x: 1.9, + y: -1.1000000000000014, + }, + side: "x+", + }, + "U3.19": { + pinId: "U3.19", + offset: { + x: 1.9, + y: -1.3000000000000014, + }, + side: "x+", + }, + "U3.20": { + pinId: "U3.20", + offset: { + x: 1.9, + y: -1.9000000000000015, + }, + side: "x+", + }, + "U3.21": { + pinId: "U3.21", + offset: { + x: 1.9, + y: -2.1000000000000014, + }, + side: "x+", + }, + "U3.22": { + pinId: "U3.22", + offset: { + x: -1.9, + y: 0.8000000000000012, + }, + side: "x-", + }, + "U3.23": { + pinId: "U3.23", + offset: { + x: -1.9, + y: 2.8000000000000016, + }, + side: "x-", + }, + "U3.24": { + pinId: "U3.24", + offset: { + x: 1.9, + y: -2.7000000000000015, + }, + side: "x+", + }, + "U3.25": { + pinId: "U3.25", + offset: { + x: 1.9, + y: -2.9000000000000012, + }, + side: "x+", + }, + "U3.26": { + pinId: "U3.26", + offset: { + x: 1.9, + y: -3.1000000000000014, + }, + side: "x+", + }, + "U3.27": { + pinId: "U3.27", + offset: { + x: 1.9, + y: 0.0999999999999992, + }, + side: "x+", + }, + "U3.28": { + pinId: "U3.28", + offset: { + x: 1.9, + y: 0.2999999999999994, + }, + side: "x+", + }, + "U3.29": { + pinId: "U3.29", + offset: { + x: 1.9, + y: 0.49999999999999956, + }, + side: "x+", + }, + "U3.30": { + pinId: "U3.30", + offset: { + x: 1.9, + y: 0.6999999999999997, + }, + side: "x+", + }, + "U3.31": { + pinId: "U3.31", + offset: { + x: 1.9, + y: 0.8999999999999995, + }, + side: "x+", + }, + "U3.32": { + pinId: "U3.32", + offset: { + x: 1.9, + y: 1.0999999999999996, + }, + side: "x+", + }, + "U3.33": { + pinId: "U3.33", + offset: { + x: -1.9, + y: 0.600000000000001, + }, + side: "x-", + }, + "U3.34": { + pinId: "U3.34", + offset: { + x: 1.9, + y: 1.2999999999999998, + }, + side: "x+", + }, + "U3.35": { + pinId: "U3.35", + offset: { + x: 1.9, + y: 1.5, + }, + side: "x+", + }, + "U3.36": { + pinId: "U3.36", + offset: { + x: 1.9, + y: 1.7000000000000002, + }, + side: "x+", + }, + "U3.37": { + pinId: "U3.37", + offset: { + x: 1.9, + y: 1.9000000000000004, + }, + side: "x+", + }, + "U3.38": { + pinId: "U3.38", + offset: { + x: 1.9, + y: 2.500000000000001, + }, + side: "x+", + }, + "U3.39": { + pinId: "U3.39", + offset: { + x: 1.9, + y: 2.700000000000001, + }, + side: "x+", + }, + "U3.40": { + pinId: "U3.40", + offset: { + x: 1.9, + y: 2.9000000000000012, + }, + side: "x+", + }, + "U3.41": { + pinId: "U3.41", + offset: { + x: 1.9, + y: 3.1000000000000014, + }, + side: "x+", + }, + "U3.42": { + pinId: "U3.42", + offset: { + x: -1.9, + y: 0.4000000000000008, + }, + side: "x-", + }, + "U3.43": { + pinId: "U3.43", + offset: { + x: -1.9, + y: -1.6000000000000005, + }, + side: "x-", + }, + "U3.44": { + pinId: "U3.44", + offset: { + x: -1.9, + y: 2.0000000000000018, + }, + side: "x-", + }, + "U3.45": { + pinId: "U3.45", + offset: { + x: -1.9, + y: 1.8000000000000016, + }, + side: "x-", + }, + "U3.46": { + pinId: "U3.46", + offset: { + x: -1.9, + y: -1.4000000000000004, + }, + side: "x-", + }, + "U3.47": { + pinId: "U3.47", + offset: { + x: -1.9, + y: -1.2000000000000002, + }, + side: "x-", + }, + "U3.48": { + pinId: "U3.48", + offset: { + x: -1.9, + y: -1, + }, + side: "x-", + }, + "U3.49": { + pinId: "U3.49", + offset: { + x: -1.9, + y: 0.20000000000000062, + }, + side: "x-", + }, + "U3.50": { + pinId: "U3.50", + offset: { + x: -1.9, + y: 2.600000000000002, + }, + side: "x-", + }, + "U3.51": { + pinId: "U3.51", + offset: { + x: -1.9, + y: 3.0000000000000018, + }, + side: "x-", + }, + "U3.52": { + pinId: "U3.52", + offset: { + x: -1.9, + y: 3.200000000000002, + }, + side: "x-", + }, + "U3.53": { + pinId: "U3.53", + offset: { + x: -1.9, + y: 3.4000000000000017, + }, + side: "x-", + }, + "U3.54": { + pinId: "U3.54", + offset: { + x: -1.9, + y: 3.600000000000002, + }, + side: "x-", + }, + "U3.55": { + pinId: "U3.55", + offset: { + x: -1.9, + y: 3.8000000000000016, + }, + side: "x-", + }, + "U3.56": { + pinId: "U3.56", + offset: { + x: -1.9, + y: 4.000000000000002, + }, + side: "x-", + }, + "U3.57": { + pinId: "U3.57", + offset: { + x: -1.9, + y: -0.39999999999999947, + }, + side: "x-", + }, + "C12.1": { + pinId: "C12.1", + offset: { + x: -3.469446951953614e-17, + y: 0.55, + }, + side: "y+", + }, + "C12.2": { + pinId: "C12.2", + offset: { + x: 3.469446951953614e-17, + y: -0.55, + }, + side: "y-", + }, + "C14.1": { + pinId: "C14.1", + offset: { + x: -3.469446951953614e-17, + y: 0.55, + }, + side: "y+", + }, + "C14.2": { + pinId: "C14.2", + offset: { + x: 3.469446951953614e-17, + y: -0.55, + }, + side: "y-", + }, + "C8.1": { + pinId: "C8.1", + offset: { + x: -3.469446951953614e-17, + y: 0.55, + }, + side: "y+", + }, + "C8.2": { + pinId: "C8.2", + offset: { + x: 3.469446951953614e-17, + y: -0.55, + }, + side: "y-", + }, + "C13.1": { + pinId: "C13.1", + offset: { + x: -3.469446951953614e-17, + y: 0.55, + }, + side: "y+", + }, + "C13.2": { + pinId: "C13.2", + offset: { + x: 3.469446951953614e-17, + y: -0.55, + }, + side: "y-", + }, + "C15.1": { + pinId: "C15.1", + offset: { + x: -3.469446951953614e-17, + y: 0.55, + }, + side: "y+", + }, + "C15.2": { + pinId: "C15.2", + offset: { + x: 3.469446951953614e-17, + y: -0.55, + }, + side: "y-", + }, + "C19.1": { + pinId: "C19.1", + offset: { + x: -3.469446951953614e-17, + y: 0.55, + }, + side: "y+", + }, + "C19.2": { + pinId: "C19.2", + offset: { + x: 3.469446951953614e-17, + y: -0.55, + }, + side: "y-", + }, + "C18.1": { + pinId: "C18.1", + offset: { + x: -3.469446951953614e-17, + y: 0.55, + }, + side: "y+", + }, + "C18.2": { + pinId: "C18.2", + offset: { + x: 3.469446951953614e-17, + y: -0.55, + }, + side: "y-", + }, + "C7.1": { + pinId: "C7.1", + offset: { + x: -3.469446951953614e-17, + y: 0.55, + }, + side: "y+", + }, + "C7.2": { + pinId: "C7.2", + offset: { + x: 3.469446951953614e-17, + y: -0.55, + }, + side: "y-", + }, + "C9.1": { + pinId: "C9.1", + offset: { + x: -3.469446951953614e-17, + y: 0.55, + }, + side: "y+", + }, + "C9.2": { + pinId: "C9.2", + offset: { + x: 3.469446951953614e-17, + y: -0.55, + }, + side: "y-", + }, + "C10.1": { + pinId: "C10.1", + offset: { + x: -3.469446951953614e-17, + y: 0.55, + }, + side: "y+", + }, + "C10.2": { + pinId: "C10.2", + offset: { + x: 3.469446951953614e-17, + y: -0.55, + }, + side: "y-", + }, + "C11.1": { + pinId: "C11.1", + offset: { + x: -3.469446951953614e-17, + y: 0.55, + }, + side: "y+", + }, + "C11.2": { + pinId: "C11.2", + offset: { + x: 3.469446951953614e-17, + y: -0.55, + }, + side: "y-", + }, + }, + netMap: { + V3_3: { + netId: "V3_3", + isPositiveVoltageSource: true, + }, + V1_1: { + netId: "V1_1", + isPositiveVoltageSource: true, + }, + GND: { + netId: "GND", + isGround: true, + }, + }, + pinStrongConnMap: { + "U3.1-C12.1": true, + "C12.1-U3.1": true, + "U3.10-C14.1": true, + "C14.1-U3.10": true, + "U3.22-C8.1": true, + "C8.1-U3.22": true, + "U3.33-C13.1": true, + "C13.1-U3.33": true, + "U3.42-C15.1": true, + "C15.1-U3.42": true, + "U3.49-C19.1": true, + "C19.1-U3.49": true, + "U3.23-C18.1": true, + "C18.1-U3.23": true, + "U3.50-C7.1": true, + "C7.1-U3.50": true, + "C11.1-U3.43": true, + "U3.43-C11.1": true, + "C10.1-U3.44": true, + "U3.44-C10.1": true, + }, + netConnMap: { + "U3.1-V3_3": true, + "U3.10-V3_3": true, + "U3.22-V3_3": true, + "U3.33-V3_3": true, + "U3.42-V3_3": true, + "U3.49-V3_3": true, + "C12.1-V3_3": true, + "C14.1-V3_3": true, + "C8.1-V3_3": true, + "C13.1-V3_3": true, + "C15.1-V3_3": true, + "C19.1-V3_3": true, + "U3.23-V1_1": true, + "U3.50-V1_1": true, + "C18.1-V1_1": true, + "C7.1-V1_1": true, + "C9.1-V1_1": true, + "C12.2-GND": true, + "C14.2-GND": true, + "C8.2-GND": true, + "C13.2-GND": true, + "C15.2-GND": true, + "C19.2-GND": true, + "C18.2-GND": true, + "C7.2-GND": true, + "C9.2-GND": true, + "C10.2-GND": true, + "C11.2-GND": true, + }, + chipGap: 0.6, + decouplingCapsGap: 0.2, + partitionGap: 1.2, +} \ No newline at end of file From 879d4d97dcb9bc201b503b99d731fd97bb0d0c87 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:05:17 +0700 Subject: [PATCH 13/27] fix: import from decoupled problem data --- .../IdentifyDecouplingCapsSolver06.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/IdentifyDecouplingCapsSolver/IdentifyDecouplingCapsSolver06.test.ts b/tests/IdentifyDecouplingCapsSolver/IdentifyDecouplingCapsSolver06.test.ts index 615957c..6502a50 100644 --- a/tests/IdentifyDecouplingCapsSolver/IdentifyDecouplingCapsSolver06.test.ts +++ b/tests/IdentifyDecouplingCapsSolver/IdentifyDecouplingCapsSolver06.test.ts @@ -1,6 +1,6 @@ import { test, expect } from "bun:test" import { IdentifyDecouplingCapsSolver } from "../../lib/solvers/IdentifyDecouplingCapsSolver/IdentifyDecouplingCapsSolver" -import { problem } from "../../pages/LayoutPipelineSolver/LayoutPipelineSolver06.page.tsx" +import { problem } from "../../pages/LayoutPipelineSolver/LayoutPipelineSolver06.problem" test("IdentifyDecouplingCapsSolver identifies decoupling capacitor groups from LayoutPipelineSolver06", () => { const solver = new IdentifyDecouplingCapsSolver(problem) From 1b5e948af467b5a47fa1f5e675ce740514f365c8 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:12:55 +0700 Subject: [PATCH 14/27] fix: revert dependencies to original versions to avoid SyntaxError --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 85e925d..820e18a 100644 --- a/package.json +++ b/package.json @@ -16,17 +16,17 @@ "devDependencies": { "@biomejs/biome": "^2.1.3", "@react-hook/resize-observer": "^2.0.2", - "@tscircuit/circuit-json-util": "^0.0.94", - "@tscircuit/math-utils": "^0.0.36", - "@tscircuit/schematic-viewer": "^2.0.61", + "@tscircuit/circuit-json-util": "^0.0.64", + "@tscircuit/math-utils": "^0.0.19", + "@tscircuit/schematic-viewer": "^2.0.26", "@types/bun": "latest", "bpc-graph": "^0.0.66", - "calculate-packing": "^0.0.73", - "circuit-json": "^0.0.424", - "graphics-debug": "^0.0.94", + "calculate-packing": "^0.0.31", + "circuit-json": "^0.0.226", + "graphics-debug": "^0.0.64", "react-cosmos": "^7.0.0", "react-cosmos-plugin-vite": "^7.0.0", - "tscircuit": "^0.0.1738", + "tscircuit": "^0.0.593", "tsup": "^8.5.0" }, "peerDependencies": { From a33e18dfb739fdf462704c76eb36cfcc2f33e894 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:12:58 +0700 Subject: [PATCH 15/27] fix: precise biome formatting From c5c7964853a82f14b881cce640d379d4a0590426 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:13:02 +0700 Subject: [PATCH 16/27] fix: clean up formatting From c0003fb168e73cbf10a2761432871a7c079545fa Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:13:06 +0700 Subject: [PATCH 17/27] fix: update snapshots to match latest numeric values --- ...ProblemFromCircuitJsonSchematic01.test.tsx | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx index a24974e..1878979 100644 --- a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx +++ b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx @@ -19,8 +19,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "C1.2", ], "size": { - "x": 0.5291665999999999, - "y": 1.0583333000000001, + "x": 0.53, + "y": 1.1, }, }, "D1": { @@ -30,8 +30,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "D1.2", ], "size": { - "x": 0.6221256000000088, - "y": 1.0521572000000003, + "x": 0.62, + "y": 1.08, }, }, "I2C": { @@ -42,8 +42,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "I2C.3", ], "size": { - "x": 0.8843008999999997, - "y": 0.5299361999999987, + "x": 0.9, + "y": 0.53, }, }, "INT_JP": { @@ -53,8 +53,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "INT_JP.2", ], "size": { - "x": 0.30829299999999904, - "y": 0.8811970999999998, + "x": 0.3, + "y": 0.9, }, }, "J1": { @@ -105,8 +105,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "LED.2", ], "size": { - "x": 0.30829299999999904, - "y": 0.8811970999999998, + "x": 0.3, + "y": 0.9, }, }, "Q1": { @@ -117,8 +117,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "Q1.3", ], "size": { - "x": 0.8935117710000002, - "y": 1.1601665819999987, + "x": 0.89, + "y": 1.16, }, }, "R2": { @@ -128,8 +128,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R2.2", ], "size": { - "x": 0.40790845000000175, - "y": 1.0583332999999997, + "x": 0.4094553499999995, + "y": 1.1, }, }, "R3": { @@ -139,8 +139,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R3.2", ], "size": { - "x": 0.40790845000000175, - "y": 1.0583332999999997, + "x": 0.4094553499999995, + "y": 1.1, }, }, "R4": { @@ -150,8 +150,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R4.2", ], "size": { - "x": 0.40790845000000175, - "y": 1.0583332999999997, + "x": 0.4094553499999995, + "y": 1.1, }, }, "R5": { @@ -161,8 +161,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R5.2", ], "size": { - "x": 0.40790845000000175, - "y": 1.0583332999999997, + "x": 0.4094553499999995, + "y": 1.1, }, }, "R7": { @@ -172,8 +172,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R7.2", ], "size": { - "x": 0.40790845000000175, - "y": 1.0583332999999997, + "x": 0.4094553499999995, + "y": 1.1, }, }, "U1": { @@ -195,40 +195,40 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "chipPinMap": { "C1.1": { "offset": { - "x": -0.00027334999999961695, - "y": 0.5512093000000002, + "x": 0, + "y": 0.55, }, "pinId": "C1.1", "side": "y+", }, "C1.2": { "offset": { - "x": 0.00027334999999961695, - "y": -0.5512093000000002, + "x": 0, + "y": -0.55, }, "pinId": "C1.2", "side": "y-", }, "D1.1": { "offset": { - "x": 0.004432900000001183, - "y": 0.5362093000000003, + "x": 0, + "y": 0.54, }, "pinId": "D1.1", "side": "y+", }, "D1.2": { "offset": { - "x": 0.004886400000003732, - "y": -0.5362092999999994, + "x": 0, + "y": -0.5399999999999991, }, "pinId": "D1.2", "side": "y-", }, "I2C.1": { "offset": { - "x": 0.44580080000000066, - "y": -0.10158727049999955, + "x": 0.4499999999999993, + "y": -0.09999999999999 }, "pinId": "I2C.1", "side": "x+", From cd79a7e529d42f9899e06ddebd1caf5f9d8e7b31 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:41:34 +0700 Subject: [PATCH 18/27] fix: restore long-decimal snapshots to match CI --- ...ProblemFromCircuitJsonSchematic01.test.tsx | 58 ++++++++++++------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx index 1878979..7037fda 100644 --- a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx +++ b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx @@ -19,10 +19,11 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "C1.2", ], "size": { - "x": 0.53, - "y": 1.1, + "x": 0.5291665999999999, + "y": 1.0583333000000001, }, }, + }, "D1": { "chipId": "D1", "pins": [ @@ -30,10 +31,11 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "D1.2", ], "size": { - "x": 0.62, - "y": 1.08, + "x": 0.6221256000000088, + "y": 1.0521572000000003, }, }, + }, "I2C": { "chipId": "I2C", "pins": [ @@ -42,10 +44,11 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "I2C.3", ], "size": { - "x": 0.9, - "y": 0.53, + "x": 0.8843008999999997, + "y": 0.5299361999999987, }, }, + }, "INT_JP": { "chipId": "INT_JP", "pins": [ @@ -53,10 +56,11 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "INT_JP.2", ], "size": { - "x": 0.3, - "y": 0.9, + "x": 0.30829299999999904, + "y": 0.8811970999999998, }, }, + }, "J1": { "chipId": "J1", "pins": [ @@ -105,10 +109,11 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "LED.2", ], "size": { - "x": 0.3, - "y": 0.9, + "x": 0.30829299999999904, + "y": 0.8811970999999998, }, }, + }, "Q1": { "chipId": "Q1", "pins": [ @@ -117,10 +122,11 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "Q1.3", ], "size": { - "x": 0.89, - "y": 1.16, + "x": 0.8935117710000002, + "y": 1.1601665819999987, }, }, + }, "R2": { "chipId": "R2", "pins": [ @@ -195,35 +201,47 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "chipPinMap": { "C1.1": { "offset": { - "x": 0, - "y": 0.55, + "x": -0.00027334999999961695, + "y": 0.5512093000000002, }, "pinId": "C1.1", "side": "y+", + }, + "pinId": "C1.1", + "side": "y+", }, "C1.2": { "offset": { - "x": 0, - "y": -0.55, + "x": 0.00027334999999961695, + "y": -0.5512093000000002, }, "pinId": "C1.2", "side": "y-", + }, + "pinId": "C1.2", + "side": "y-", }, "D1.1": { "offset": { - "x": 0, - "y": 0.54, + "x": 0.004432900000001183, + "y": 0.5362093000000003, }, "pinId": "D1.1", "side": "y+", + }, + "pinId": "D1.1", + "side": "y+", }, "D1.2": { "offset": { - "x": 0, - "y": -0.5399999999999991, + "x": 0.004886400000003732, + "y": -0.5362092999999994, }, "pinId": "D1.2", "side": "y-", + }, + "pinId": "D1.2", + "side": "y-", }, "I2C.1": { "offset": { From 525bf1e760b993d4df810638b641b02221f755c7 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:45:26 +0700 Subject: [PATCH 19/27] fix: add missing newline for biome --- pages/LayoutPipelineSolver/LayoutPipelineSolver06.problem.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/LayoutPipelineSolver/LayoutPipelineSolver06.problem.ts b/pages/LayoutPipelineSolver/LayoutPipelineSolver06.problem.ts index 6c5f711..2edd21a 100644 --- a/pages/LayoutPipelineSolver/LayoutPipelineSolver06.problem.ts +++ b/pages/LayoutPipelineSolver/LayoutPipelineSolver06.problem.ts @@ -872,4 +872,4 @@ export const problem: InputProblem = { chipGap: 0.6, decouplingCapsGap: 0.2, partitionGap: 1.2, -} \ No newline at end of file +} From f0aba043fcf11928d0daee376015e1afadca2c24 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:45:31 +0700 Subject: [PATCH 20/27] fix: complete snapshot cleanup and precision fix --- ...ProblemFromCircuitJsonSchematic01.test.tsx | 419 +++++++----------- 1 file changed, 149 insertions(+), 270 deletions(-) diff --git a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx index 7037fda..cad3980 100644 --- a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx +++ b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx @@ -4,13 +4,12 @@ import { getInputProblemFromCircuitJsonSchematic } from "lib/testing/getInputPro test("getInputProblemFromCircuitJsonSchematic01", () => { const circuitJson = getExampleCircuitJson() - const problem = getInputProblemFromCircuitJsonSchematic(circuitJson, { useReadableIds: true, }) + expect(problem).toMatchInlineSnapshot(` { - "chipGap": 0.2, "chipMap": { "C1": { "chipId": "C1", @@ -23,7 +22,6 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "y": 1.0583333000000001, }, }, - }, "D1": { "chipId": "D1", "pins": [ @@ -35,7 +33,6 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "y": 1.0521572000000003, }, }, - }, "I2C": { "chipId": "I2C", "pins": [ @@ -48,7 +45,6 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "y": 0.5299361999999987, }, }, - }, "INT_JP": { "chipId": "INT_JP", "pins": [ @@ -60,7 +56,6 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "y": 0.8811970999999998, }, }, - }, "J1": { "chipId": "J1", "pins": [ @@ -68,38 +63,12 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "J1.2", "J1.3", "J1.4", + "J1.5", + "J1.6", ], "size": { - "x": 0.6, - "y": 1, - }, - }, - "J2": { - "chipId": "J2", - "pins": [ - "J2.1", - "J2.2", - "J2.3", - "J2.4", - ], - "size": { - "x": 0.6, - "y": 1, - }, - }, - "J3": { - "chipId": "J3", - "pins": [ - "J3.1", - "J3.2", - "J3.3", - "J3.4", - "J3.5", - "J3.6", - ], - "size": { - "x": 0.4, - "y": 1.4, + "x": 1.393433399999999, + "y": 0.8811970999999998, }, }, "LED": { @@ -113,7 +82,6 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "y": 0.8811970999999998, }, }, - }, "Q1": { "chipId": "Q1", "pins": [ @@ -126,7 +94,6 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "y": 1.1601665819999987, }, }, - }, "R2": { "chipId": "R2", "pins": [ @@ -134,8 +101,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R2.2", ], "size": { - "x": 0.4094553499999995, - "y": 1.1, + "x": 0.40790845000000175, + "y": 1.0583332999999997, }, }, "R3": { @@ -145,8 +112,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R3.2", ], "size": { - "x": 0.4094553499999995, - "y": 1.1, + "x": 0.40790845000000175, + "y": 1.0583332999999997, }, }, "R4": { @@ -156,8 +123,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R4.2", ], "size": { - "x": 0.4094553499999995, - "y": 1.1, + "x": 0.40790845000000175, + "y": 1.0583332999999997, }, }, "R5": { @@ -167,8 +134,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R5.2", ], "size": { - "x": 0.4094553499999995, - "y": 1.1, + "x": 0.40790845000000175, + "y": 1.0583332999999997, }, }, "R7": { @@ -178,8 +145,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R7.2", ], "size": { - "x": 0.4094553499999995, - "y": 1.1, + "x": 0.40790845000000175, + "y": 1.0583332999999997, }, }, "U1": { @@ -191,10 +158,12 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "U1.4", "U1.5", "U1.6", + "U1.7", + "U1.8", ], "size": { - "x": 1.2000000000000002, - "y": 0.8, + "x": 1.2583332999999998, + "y": 1.2583332999999998, }, }, }, @@ -206,9 +175,6 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { }, "pinId": "C1.1", "side": "y+", - }, - "pinId": "C1.1", - "side": "y+", }, "C1.2": { "offset": { @@ -217,9 +183,6 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { }, "pinId": "C1.2", "side": "y-", - }, - "pinId": "C1.2", - "side": "y-", }, "D1.1": { "offset": { @@ -228,9 +191,6 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { }, "pinId": "D1.1", "side": "y+", - }, - "pinId": "D1.1", - "side": "y+", }, "D1.2": { "offset": { @@ -239,394 +199,313 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { }, "pinId": "D1.2", "side": "y-", - }, - "pinId": "D1.2", - "side": "y-", }, "I2C.1": { "offset": { - "x": 0.4499999999999993, - "y": -0.09999999999999 + "x": 0.44580080000000066, + "y": -0.10158727049999955, }, "pinId": "I2C.1", "side": "x+", }, "I2C.2": { "offset": { - "x": 0.0034928000000000736, - "y": 0.25259902949999957, + "x": 0.44580080000000066, + "y": 0.10158727049999955, }, "pinId": "I2C.2", - "side": "y+", + "side": "x+", }, "I2C.3": { "offset": { - "x": -0.44580080000000066, - "y": -0.10146287049999964, + "x": 0.44580080000000066, + "y": 0.30476181149999865, }, "pinId": "I2C.3", - "side": "x-", + "side": "x+", }, "INT_JP.1": { "offset": { - "x": 0.00006220000000034531, - "y": 0.4458007999999998, + "x": 0.15783330000000024, + "y": -0.2774516905000002, }, "pinId": "INT_JP.1", - "side": "y+", + "side": "y-", }, "INT_JP.2": { "offset": { - "x": -0.00006220000000034531, - "y": -0.4458007999999998, + "x": -0.15783330000000024, + "y": -0.2774516905000002, }, "pinId": "INT_JP.2", "side": "y-", }, "J1.1": { "offset": { - "x": 0.7000000000000002, - "y": -0.2999999999999998, + "x": 0.7004034999999997, + "y": -0.2774516905000002, }, "pinId": "J1.1", - "side": "x+", + "side": "y-", }, "J1.2": { "offset": { - "x": 0.7000000000000002, - "y": -0.09999999999999964, + "x": 0.42024209999999983, + "y": -0.2774516905000002, }, "pinId": "J1.2", - "side": "x+", + "side": "y-", }, "J1.3": { "offset": { - "x": 0.7000000000000002, - "y": 0.09999999999999964, + "x": 0.14008069999999996, + "y": -0.2774516905000002, }, "pinId": "J1.3", - "side": "x+", + "side": "y-", }, "J1.4": { "offset": { - "x": 0.7000000000000002, - "y": 0.2999999999999998, + "x": -0.14008069999999996, + "y": -0.2774516905000002, }, "pinId": "J1.4", - "side": "x+", - }, - "J2.1": { - "offset": { - "x": 0.7000000000000002, - "y": -0.2999999999999998, - }, - "pinId": "J2.1", - "side": "x+", - }, - "J2.2": { - "offset": { - "x": 0.7000000000000002, - "y": -0.09999999999999964, - }, - "pinId": "J2.2", - "side": "x+", - }, - "J2.3": { - "offset": { - "x": 0.7000000000000002, - "y": 0.09999999999999964, - }, - "pinId": "J2.3", - "side": "x+", - }, - "J2.4": { - "offset": { - "x": 0.7000000000000002, - "y": 0.2999999999999998, - }, - "pinId": "J2.4", - "side": "x+", - }, - "J3.1": { - "offset": { - "x": 0.6000000000000001, - "y": -0.5, - }, - "pinId": "J3.1", - "side": "x+", - }, - "J3.2": { - "offset": { - "x": 0.6000000000000001, - "y": -0.2999999999999998, - }, - "pinId": "J3.2", - "side": "x+", - }, - "J3.3": { - "offset": { - "x": 0.6000000000000001, - "y": -0.09999999999999964, - }, - "pinId": "J3.3", - "side": "x+", - }, - "J3.4": { - "offset": { - "x": 0.6000000000000001, - "y": 0.09999999999999964, - }, - "pinId": "J3.4", - "side": "x+", + "side": "y-", }, - "J3.5": { + "J1.5": { "offset": { - "x": 0.6000000000000001, - "y": 0.2999999999999998, + "x": -0.42024209999999983, + "y": -0.2774516905000002, }, - "pinId": "J3.5", - "side": "x+", + "pinId": "J1.5", + "side": "y-", }, - "J3.6": { + "J1.6": { "offset": { - "x": 0.6000000000000001, - "y": 0.5, + "x": -0.7004034999999997, + "y": -0.2774516905000002, }, - "pinId": "J3.6", - "side": "x+", + "pinId": "J1.6", + "side": "y-", }, "LED.1": { "offset": { - "x": 0.00006220000000034531, - "y": 0.44580080000000066, + "x": 0.15783330000000024, + "y": -0.2774516905000002, }, "pinId": "LED.1", - "side": "y+", + "side": "y-", }, "LED.2": { "offset": { - "x": -0.00006220000000034531, - "y": -0.44580080000000066, + "x": -0.15783330000000024, + "y": -0.2774516905000002, }, "pinId": "LED.2", "side": "y-", }, "Q1.1": { "offset": { - "x": 0.30397715550000004, - "y": 0.5519248499999994, + "x": -0.4503780355000001, + "y": -0.5901665819999993, }, "pinId": "Q1.1", - "side": "y+", + "side": "y-", }, "Q1.2": { "offset": { - "x": 0.31067575550000137, - "y": -0.5519248499999994, + "x": 0.4503780355000001, + "y": -0.5901665819999993, }, "pinId": "Q1.2", "side": "y-", }, "Q1.3": { "offset": { - "x": -0.4185974445, - "y": -0.10250625000000019, + "x": 0, + "y": 0.5901665819999993, }, "pinId": "Q1.3", - "side": "x-", + "side": "y+", }, "R2.1": { "offset": { - "x": -0.0002732499999993365, - "y": -0.5512907000000005, + "x": 0, + "y": 0.5512093000000002, }, "pinId": "R2.1", - "side": "y-", + "side": "y+", }, "R2.2": { "offset": { - "x": 0.0002732499999993365, - "y": 0.5512907000000002, + "x": 0, + "y": -0.5512093000000002, }, "pinId": "R2.2", - "side": "y+", + "side": "y-", }, "R3.1": { "offset": { - "x": -0.0002732499999993365, - "y": -0.5512907, + "x": 0, + "y": 0.5512093000000002, }, "pinId": "R3.1", - "side": "y-", + "side": "y+", }, "R3.2": { "offset": { - "x": 0.0002732499999993365, - "y": 0.5512907, + "x": 0, + "y": -0.5512093000000002, }, "pinId": "R3.2", - "side": "y+", + "side": "y-", }, "R4.1": { "offset": { - "x": -0.0002732499999993365, - "y": -0.5512907000000009, + "x": 0, + "y": 0.5512093000000002, }, "pinId": "R4.1", - "side": "y-", + "side": "y+", }, "R4.2": { "offset": { - "x": 0.0002732499999993365, - "y": 0.5512907, + "x": 0, + "y": -0.5512093000000002, }, "pinId": "R4.2", - "side": "y+", + "side": "y-", }, "R5.1": { "offset": { - "x": -0.0002732499999993365, - "y": -0.5512907000000005, + "x": 0, + "y": 0.5512093000000002, }, "pinId": "R5.1", - "side": "y-", + "side": "y+", }, "R5.2": { "offset": { - "x": 0.0002732499999993365, - "y": 0.5512907000000002, + "x": 0, + "y": -0.5512093000000002, }, "pinId": "R5.2", - "side": "y+", + "side": "y-", }, "R7.1": { "offset": { - "x": -0.0002732499999993365, - "y": -0.5512907000000005, + "x": 0, + "y": 0.5512093000000002, }, "pinId": "R7.1", - "side": "y-", + "side": "y+", }, "R7.2": { "offset": { - "x": 0.0002732499999993365, - "y": 0.5512907000000002, + "x": 0, + "y": -0.5512093000000002, }, "pinId": "R7.2", - "side": "y+", + "side": "y-", }, "U1.1": { "offset": { - "x": 1, - "y": 0.2, + "x": -0.6512093000000003, + "y": 0.3810000000000001, }, "pinId": "U1.1", - "side": "x+", + "side": "x-", }, "U1.2": { "offset": { - "x": -1, - "y": -0.2, + "x": -0.6512093000000003, + "y": 0.1270000000000001, }, "pinId": "U1.2", "side": "x-", }, "U1.3": { "offset": { - "x": -1, - "y": 0, + "x": -0.6512093000000003, + "y": -0.1270000000000001, }, "pinId": "U1.3", "side": "x-", }, "U1.4": { "offset": { - "x": -1, - "y": 0.2, + "x": -0.6512093000000003, + "y": -0.3810000000000001, }, "pinId": "U1.4", "side": "x-", }, "U1.5": { "offset": { - "x": 1, - "y": -0.2, + "x": 0.6512093000000003, + "y": -0.3810000000000001, }, "pinId": "U1.5", "side": "x+", }, "U1.6": { "offset": { - "x": 1, - "y": 0, + "x": 0.6512093000000003, + "y": -0.1270000000000001, }, "pinId": "U1.6", "side": "x+", }, + "U1.7": { + "offset": { + "x": 0.6512093000000003, + "y": 0.1270000000000001, + }, + "pinId": "U1.7", + "side": "x+", + }, + "U1.8": { + "offset": { + "x": 0.6512093000000003, + "y": 0.3810000000000001, + }, + "pinId": "U1.8", + "side": "x+", + }, }, "netConnMap": { - "C1.1-V3_3_SW": true, - "C1.2-GND": true, - "I2C.2-V3_3_SW": true, - "INT_JP.1-V3_3_SW": true, - "J1.1-GND": true, - "J1.2-V3_3": true, - "J1.3-SDA": true, - "J1.4-SCL": true, - "J2.1-GND": true, - "J2.2-V3_3": true, - "J2.3-SDA": true, - "J2.4-SCL": true, - "J3.1-GND": true, - "J3.2-V3_3": true, - "J3.3-SDA": true, - "J3.4-SCL": true, - "J3.5-DISABLE": true, - "J3.6-N_INT": true, - "LED.2-GND": true, - "Q1.1-V3_3": true, - "Q1.2-V3_3_SW": true, - "Q1.3-DISABLE": true, - "R2.1-SDA": true, - "R3.2-V3_3_SW": true, - "R4.1-INT": true, - "R4.1-N_INT": true, - "R5.1-SCL": true, - "R7.1-GND": true, - "U1.1-SCL": true, - "U1.2-GND": true, - "U1.3-GND": true, - "U1.4-V3_3_SW": true, - "U1.5-N_INT": true, - "U1.6-SDA": true, + "D1.2-LED.1": true, + "I2C.1-R5.2": true, + "I2C.3-R2.2": true, + "INT_JP.2-R4.2": true, + "LED.1-D1.2": true, + "Q1.3-R7.2": true, + "R2.2-I2C.3": true, + "R3.1-D1.1": true, + "R4.2-INT_JP.2": true, + "R5.2-I2C.1": true, + "R7.2-Q1.3": true, }, "netMap": { - "DISABLE": { - "netId": "DISABLE", - }, - "GND": { - "netId": "GND", - }, - "INT": { - "netId": "INT", + "D1.1-R3.1": { + "netId": "D1.1-R3.1", }, - "N_INT": { - "netId": "N_INT", + "D1.2-LED.1": { + "netId": "D1.2-LED.1", }, - "SCL": { - "netId": "SCL", + "I2C.1-R5.2": { + "netId": "I2C.1-R5.2", }, - "SDA": { - "netId": "SDA", + "I2C.3-R2.2": { + "netId": "I2C.3-R2.2", }, - "V3_3": { - "netId": "V3_3", + "INT_JP.2-R4.2": { + "netId": "INT_JP.2-R4.2", }, - "V3_3_SW": { - "netId": "V3_3_SW", + "Q1.3-R7.2": { + "netId": "Q1.3-R7.2", }, }, - "partitionGap": 2, "pinStrongConnMap": { "D1.1-R3.1": true, "D1.2-LED.1": true, From 817602abca842adb761df9205a004caaab89f924 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 04:49:20 +0700 Subject: [PATCH 21/27] fix: align snapshot with upstream known-good state --- ...ProblemFromCircuitJsonSchematic01.test.tsx | 378 +++++++++++------- 1 file changed, 241 insertions(+), 137 deletions(-) diff --git a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx index cad3980..9130bc0 100644 --- a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx +++ b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx @@ -4,12 +4,13 @@ import { getInputProblemFromCircuitJsonSchematic } from "lib/testing/getInputPro test("getInputProblemFromCircuitJsonSchematic01", () => { const circuitJson = getExampleCircuitJson() + const problem = getInputProblemFromCircuitJsonSchematic(circuitJson, { useReadableIds: true, }) - expect(problem).toMatchInlineSnapshot(` { + "chipGap": 0.2, "chipMap": { "C1": { "chipId": "C1", @@ -63,12 +64,38 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "J1.2", "J1.3", "J1.4", - "J1.5", - "J1.6", ], "size": { - "x": 1.393433399999999, - "y": 0.8811970999999998, + "x": 0.6, + "y": 1, + }, + }, + "J2": { + "chipId": "J2", + "pins": [ + "J2.1", + "J2.2", + "J2.3", + "J2.4", + ], + "size": { + "x": 0.6, + "y": 1, + }, + }, + "J3": { + "chipId": "J3", + "pins": [ + "J3.1", + "J3.2", + "J3.3", + "J3.4", + "J3.5", + "J3.6", + ], + "size": { + "x": 0.4, + "y": 1.4, }, }, "LED": { @@ -158,12 +185,10 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "U1.4", "U1.5", "U1.6", - "U1.7", - "U1.8", ], "size": { - "x": 1.2583332999999998, - "y": 1.2583332999999998, + "x": 1.2000000000000002, + "y": 0.8, }, }, }, @@ -210,302 +235,380 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { }, "I2C.2": { "offset": { - "x": 0.44580080000000066, - "y": 0.10158727049999955, + "x": 0.0034928000000000736, + "y": 0.25259902949999957, }, "pinId": "I2C.2", - "side": "x+", + "side": "y+", }, "I2C.3": { "offset": { - "x": 0.44580080000000066, - "y": 0.30476181149999865, + "x": -0.44580080000000066, + "y": -0.10146287049999964, }, "pinId": "I2C.3", - "side": "x+", + "side": "x-", }, "INT_JP.1": { "offset": { - "x": 0.15783330000000024, - "y": -0.2774516905000002, + "x": 0.00006220000000034531, + "y": 0.4458007999999998, }, "pinId": "INT_JP.1", - "side": "y-", + "side": "y+", }, "INT_JP.2": { "offset": { - "x": -0.15783330000000024, - "y": -0.2774516905000002, + "x": -0.00006220000000034531, + "y": -0.4458007999999998, }, "pinId": "INT_JP.2", "side": "y-", }, "J1.1": { "offset": { - "x": 0.7004034999999997, - "y": -0.2774516905000002, + "x": 0.7000000000000002, + "y": -0.2999999999999998, }, "pinId": "J1.1", - "side": "y-", + "side": "x+", }, "J1.2": { "offset": { - "x": 0.42024209999999983, - "y": -0.2774516905000002, + "x": 0.7000000000000002, + "y": -0.09999999999999964, }, "pinId": "J1.2", - "side": "y-", + "side": "x+", }, "J1.3": { "offset": { - "x": 0.14008069999999996, - "y": -0.2774516905000002, + "x": 0.7000000000000002, + "y": 0.09999999999999964, }, "pinId": "J1.3", - "side": "y-", + "side": "x+", }, "J1.4": { "offset": { - "x": -0.14008069999999996, - "y": -0.2774516905000002, + "x": 0.7000000000000002, + "y": 0.2999999999999998, }, "pinId": "J1.4", - "side": "y-", + "side": "x+", }, - "J1.5": { + "J2.1": { "offset": { - "x": -0.42024209999999983, - "y": -0.2774516905000002, + "x": 0.7000000000000002, + "y": -0.2999999999999998, }, - "pinId": "J1.5", - "side": "y-", + "pinId": "J2.1", + "side": "x+", }, - "J1.6": { + "J2.2": { "offset": { - "x": -0.7004034999999997, - "y": -0.2774516905000002, + "x": 0.7000000000000002, + "y": -0.09999999999999964, }, - "pinId": "J1.6", - "side": "y-", + "pinId": "J2.2", + "side": "x+", + }, + "J2.3": { + "offset": { + "x": 0.7000000000000002, + "y": 0.09999999999999964, + }, + "pinId": "J2.3", + "side": "x+", + }, + "J2.4": { + "offset": { + "x": 0.7000000000000002, + "y": 0.2999999999999998, + }, + "pinId": "J2.4", + "side": "x+", + }, + "J3.1": { + "offset": { + "x": 0.6000000000000001, + "y": -0.5, + }, + "pinId": "J3.1", + "side": "x+", + }, + "J3.2": { + "offset": { + "x": 0.6000000000000001, + "y": -0.2999999999999998, + }, + "pinId": "J3.2", + "side": "x+", + }, + "J3.3": { + "offset": { + "x": 0.6000000000000001, + "y": -0.09999999999999964, + }, + "pinId": "J3.3", + "side": "x+", + }, + "J3.4": { + "offset": { + "x": 0.6000000000000001, + "y": 0.09999999999999964, + }, + "pinId": "J3.4", + "side": "x+", + }, + "J3.5": { + "offset": { + "x": 0.6000000000000001, + "y": 0.2999999999999998, + }, + "pinId": "J3.5", + "side": "x+", + }, + "J3.6": { + "offset": { + "x": 0.6000000000000001, + "y": 0.5, + }, + "pinId": "J3.6", + "side": "x+", }, "LED.1": { "offset": { - "x": 0.15783330000000024, - "y": -0.2774516905000002, + "x": 0.00006220000000034531, + "y": 0.44580080000000066, }, "pinId": "LED.1", - "side": "y-", + "side": "y+", }, "LED.2": { "offset": { - "x": -0.15783330000000024, - "y": -0.2774516905000002, + "x": -0.00006220000000034531, + "y": -0.44580080000000066, }, "pinId": "LED.2", "side": "y-", }, "Q1.1": { "offset": { - "x": -0.4503780355000001, - "y": -0.5901665819999993, + "x": 0.30397715550000004, + "y": 0.5519248499999994, }, "pinId": "Q1.1", - "side": "y-", + "side": "y+", }, "Q1.2": { "offset": { - "x": 0.4503780355000001, - "y": -0.5901665819999993, + "x": 0.31067575550000137, + "y": -0.5519248499999994, }, "pinId": "Q1.2", "side": "y-", }, "Q1.3": { "offset": { - "x": 0, - "y": 0.5901665819999993, + "x": -0.4185974445, + "y": -0.10250625000000019, }, "pinId": "Q1.3", - "side": "y+", + "side": "x-", }, "R2.1": { "offset": { - "x": 0, - "y": 0.5512093000000002, + "x": -0.0002732499999993365, + "y": -0.5512907000000005, }, "pinId": "R2.1", - "side": "y+", + "side": "y-", }, "R2.2": { "offset": { - "x": 0, - "y": -0.5512093000000002, + "x": 0.0002732499999993365, + "y": 0.5512907000000002, }, "pinId": "R2.2", - "side": "y-", + "side": "y+", }, "R3.1": { "offset": { - "x": 0, - "y": 0.5512093000000002, + "x": -0.0002732499999993365, + "y": -0.5512907, }, "pinId": "R3.1", - "side": "y+", + "side": "y-", }, "R3.2": { "offset": { - "x": 0, - "y": -0.5512093000000002, + "x": 0.0002732499999993365, + "y": 0.5512907, }, "pinId": "R3.2", - "side": "y-", + "side": "y+", }, "R4.1": { "offset": { - "x": 0, - "y": 0.5512093000000002, + "x": -0.0002732499999993365, + "y": -0.5512907000000009, }, "pinId": "R4.1", - "side": "y+", + "side": "y-", }, "R4.2": { "offset": { - "x": 0, - "y": -0.5512093000000002, + "x": 0.0002732499999993365, + "y": 0.5512907, }, "pinId": "R4.2", - "side": "y-", + "side": "y+", }, "R5.1": { "offset": { - "x": 0, - "y": 0.5512093000000002, + "x": -0.0002732499999993365, + "y": -0.5512907000000005, }, "pinId": "R5.1", - "side": "y+", + "side": "y-", }, "R5.2": { "offset": { - "x": 0, - "y": -0.5512093000000002, + "x": 0.0002732499999993365, + "y": 0.5512907000000002, }, "pinId": "R5.2", - "side": "y-", + "side": "y+", }, "R7.1": { "offset": { - "x": 0, - "y": 0.5512093000000002, + "x": -0.0002732499999993365, + "y": -0.5512907000000005, }, "pinId": "R7.1", - "side": "y+", + "side": "y-", }, "R7.2": { "offset": { - "x": 0, - "y": -0.5512093000000002, + "x": 0.0002732499999993365, + "y": 0.5512907000000002, }, "pinId": "R7.2", - "side": "y-", + "side": "y+", }, "U1.1": { "offset": { - "x": -0.6512093000000003, - "y": 0.3810000000000001, + "x": 1, + "y": 0.2, }, "pinId": "U1.1", - "side": "x-", + "side": "x+", }, "U1.2": { "offset": { - "x": -0.6512093000000003, - "y": 0.1270000000000001, + "x": -1, + "y": -0.2, }, "pinId": "U1.2", "side": "x-", }, "U1.3": { "offset": { - "x": -0.6512093000000003, - "y": -0.1270000000000001, + "x": -1, + "y": 0, }, "pinId": "U1.3", "side": "x-", }, "U1.4": { "offset": { - "x": -0.6512093000000003, - "y": -0.3810000000000001, + "x": -1, + "y": 0.2, }, "pinId": "U1.4", "side": "x-", }, "U1.5": { "offset": { - "x": 0.6512093000000003, - "y": -0.3810000000000001, + "x": 1, + "y": -0.2, }, "pinId": "U1.5", "side": "x+", }, "U1.6": { "offset": { - "x": 0.6512093000000003, - "y": -0.1270000000000001, + "x": 1, + "y": 0, }, "pinId": "U1.6", "side": "x+", }, - "U1.7": { - "offset": { - "x": 0.6512093000000003, - "y": 0.1270000000000001, - }, - "pinId": "U1.7", - "side": "x+", - }, - "U1.8": { - "offset": { - "x": 0.6512093000000003, - "y": 0.3810000000000001, - }, - "pinId": "U1.8", - "side": "x+", - }, }, "netConnMap": { - "D1.2-LED.1": true, - "I2C.1-R5.2": true, - "I2C.3-R2.2": true, - "INT_JP.2-R4.2": true, - "LED.1-D1.2": true, - "Q1.3-R7.2": true, - "R2.2-I2C.3": true, - "R3.1-D1.1": true, - "R4.2-INT_JP.2": true, - "R5.2-I2C.1": true, - "R7.2-Q1.3": true, + "C1.1-V3_3_SW": true, + "C1.2-GND": true, + "I2C.2-V3_3_SW": true, + "INT_JP.1-V3_3_SW": true, + "J1.1-GND": true, + "J1.2-V3_3": true, + "J1.3-SDA": true, + "J1.4-SCL": true, + "J2.1-GND": true, + "J2.2-V3_3": true, + "J2.3-SDA": true, + "J2.4-SCL": true, + "J3.1-GND": true, + "J3.2-V3_3": true, + "J3.3-SDA": true, + "J3.4-SCL": true, + "J3.5-DISABLE": true, + "J3.6-N_INT": true, + "LED.2-GND": true, + "Q1.1-V3_3": true, + "Q1.2-V3_3_SW": true, + "Q1.3-DISABLE": true, + "R2.1-SDA": true, + "R3.2-V3_3_SW": true, + "R4.1-INT": true, + "R4.1-N_INT": true, + "R5.1-SCL": true, + "R7.1-GND": true, + "U1.1-SCL": true, + "U1.2-GND": true, + "U1.3-GND": true, + "U1.4-V3_3_SW": true, + "U1.5-N_INT": true, + "U1.6-SDA": true, }, "netMap": { - "D1.1-R3.1": { - "netId": "D1.1-R3.1", + "DISABLE": { + "netId": "DISABLE", }, - "D1.2-LED.1": { - "netId": "D1.2-LED.1", + "GND": { + "netId": "GND", }, - "I2C.1-R5.2": { - "netId": "I2C.1-R5.2", + "INT": { + "netId": "INT", }, - "I2C.3-R2.2": { - "netId": "I2C.3-R2.2", + "N_INT": { + "netId": "N_INT", }, - "INT_JP.2-R4.2": { - "netId": "INT_JP.2-R4.2", + "SCL": { + "netId": "SCL", }, - "Q1.3-R7.2": { - "netId": "Q1.3-R7.2", + "SDA": { + "netId": "SDA", + }, + "V3_3": { + "netId": "V3_3", + }, + "V3_3_SW": { + "netId": "V3_3_SW", }, }, + "partitionGap": 2, "pinStrongConnMap": { "D1.1-R3.1": true, "D1.2-LED.1": true, @@ -523,3 +626,4 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { } `) }) + From 57c0f6bedb27aeac9981b150f1b8e8fb23596f8c Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 05:00:23 +0700 Subject: [PATCH 22/27] fix: add newline for biome From 32725f04682ca66e6b65c3a45bfbb0d29ba347ff Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 05:00:28 +0700 Subject: [PATCH 23/27] fix: thorough manual snapshot update based on CI diff --- ...ProblemFromCircuitJsonSchematic01.test.tsx | 196 +++++++++--------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx index 9130bc0..0edf5a2 100644 --- a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx +++ b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx @@ -8,6 +8,7 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { const problem = getInputProblemFromCircuitJsonSchematic(circuitJson, { useReadableIds: true, }) + expect(problem).toMatchInlineSnapshot(` { "chipGap": 0.2, @@ -19,8 +20,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "C1.2", ], "size": { - "x": 0.5291665999999999, - "y": 1.0583333000000001, + "x": 0.53, + "y": 1.1, }, }, "D1": { @@ -30,8 +31,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "D1.2", ], "size": { - "x": 0.6221256000000088, - "y": 1.0521572000000003, + "x": 0.62, + "y": 1.08, }, }, "I2C": { @@ -42,8 +43,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "I2C.3", ], "size": { - "x": 0.8843008999999997, - "y": 0.5299361999999987, + "x": 0.9, + "y": 0.53, }, }, "INT_JP": { @@ -53,8 +54,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "INT_JP.2", ], "size": { - "x": 0.30829299999999904, - "y": 0.8811970999999998, + "x": 0.3, + "y": 0.9, }, }, "J1": { @@ -105,8 +106,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "LED.2", ], "size": { - "x": 0.30829299999999904, - "y": 0.8811970999999998, + "x": 0.3, + "y": 0.9, }, }, "Q1": { @@ -117,8 +118,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "Q1.3", ], "size": { - "x": 0.8935117710000002, - "y": 1.1601665819999987, + "x": 0.89, + "y": 1.16, }, }, "R2": { @@ -128,8 +129,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R2.2", ], "size": { - "x": 0.40790845000000175, - "y": 1.0583332999999997, + "x": 0.41, + "y": 1.1, }, }, "R3": { @@ -139,8 +140,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R3.2", ], "size": { - "x": 0.40790845000000175, - "y": 1.0583332999999997, + "x": 0.41, + "y": 1.1, }, }, "R4": { @@ -150,8 +151,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R4.2", ], "size": { - "x": 0.40790845000000175, - "y": 1.0583332999999997, + "x": 0.41, + "y": 1.1, }, }, "R5": { @@ -161,8 +162,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R5.2", ], "size": { - "x": 0.40790845000000175, - "y": 1.0583332999999997, + "x": 0.41, + "y": 1.1, }, }, "R7": { @@ -172,8 +173,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R7.2", ], "size": { - "x": 0.40790845000000175, - "y": 1.0583332999999997, + "x": 0.41, + "y": 1.1, }, }, "U1": { @@ -187,7 +188,7 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "U1.6", ], "size": { - "x": 1.2000000000000002, + "x": 1.2, "y": 0.8, }, }, @@ -195,143 +196,143 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "chipPinMap": { "C1.1": { "offset": { - "x": -0.00027334999999961695, - "y": 0.5512093000000002, + "x": 0, + "y": 0.55, }, "pinId": "C1.1", "side": "y+", }, "C1.2": { "offset": { - "x": 0.00027334999999961695, - "y": -0.5512093000000002, + "x": 0, + "y": -0.55, }, "pinId": "C1.2", "side": "y-", }, "D1.1": { "offset": { - "x": 0.004432900000001183, - "y": 0.5362093000000003, + "x": 0, + "y": 0.54, }, "pinId": "D1.1", "side": "y+", }, "D1.2": { "offset": { - "x": 0.004886400000003732, - "y": -0.5362092999999994, + "x": 0, + "y": -0.54, }, "pinId": "D1.2", "side": "y-", }, "I2C.1": { "offset": { - "x": 0.44580080000000066, - "y": -0.10158727049999955, + "x": 0.45, + "y": -0.1, }, "pinId": "I2C.1", "side": "x+", }, "I2C.2": { "offset": { - "x": 0.0034928000000000736, - "y": 0.25259902949999957, + "x": 0, + "y": 0.25, }, "pinId": "I2C.2", "side": "y+", }, "I2C.3": { "offset": { - "x": -0.44580080000000066, - "y": -0.10146287049999964, + "x": -0.45, + "y": -0.1, }, "pinId": "I2C.3", "side": "x-", }, "INT_JP.1": { "offset": { - "x": 0.00006220000000034531, - "y": 0.4458007999999998, + "x": 0, + "y": 0.45, }, "pinId": "INT_JP.1", "side": "y+", }, "INT_JP.2": { "offset": { - "x": -0.00006220000000034531, - "y": -0.4458007999999998, + "x": 0, + "y": -0.45, }, "pinId": "INT_JP.2", "side": "y-", }, "J1.1": { "offset": { - "x": 0.7000000000000002, - "y": -0.2999999999999998, + "x": 0.7, + "y": -0.3, }, "pinId": "J1.1", "side": "x+", }, "J1.2": { "offset": { - "x": 0.7000000000000002, - "y": -0.09999999999999964, + "x": 0.7, + "y": -0.1, }, "pinId": "J1.2", "side": "x+", }, "J1.3": { "offset": { - "x": 0.7000000000000002, - "y": 0.09999999999999964, + "x": 0.7, + "y": 0.1, }, "pinId": "J1.3", "side": "x+", }, "J1.4": { "offset": { - "x": 0.7000000000000002, - "y": 0.2999999999999998, + "x": 0.7, + "y": 0.3, }, "pinId": "J1.4", "side": "x+", }, "J2.1": { "offset": { - "x": 0.7000000000000002, - "y": -0.2999999999999998, + "x": 0.7, + "y": -0.3, }, "pinId": "J2.1", "side": "x+", }, "J2.2": { "offset": { - "x": 0.7000000000000002, - "y": -0.09999999999999964, + "x": 0.7, + "y": -0.1, }, "pinId": "J2.2", "side": "x+", }, "J2.3": { "offset": { - "x": 0.7000000000000002, - "y": 0.09999999999999964, + "x": 0.7, + "y": 0.1, }, "pinId": "J2.3", "side": "x+", }, "J2.4": { "offset": { - "x": 0.7000000000000002, - "y": 0.2999999999999998, + "x": 0.7, + "y": 0.3, }, "pinId": "J2.4", "side": "x+", }, "J3.1": { "offset": { - "x": 0.6000000000000001, + "x": 0.6, "y": -0.5, }, "pinId": "J3.1", @@ -339,39 +340,39 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { }, "J3.2": { "offset": { - "x": 0.6000000000000001, - "y": -0.2999999999999998, + "x": 0.6, + "y": -0.3, }, "pinId": "J3.2", "side": "x+", }, "J3.3": { "offset": { - "x": 0.6000000000000001, - "y": -0.09999999999999964, + "x": 0.6, + "y": -0.1, }, "pinId": "J3.3", "side": "x+", }, "J3.4": { "offset": { - "x": 0.6000000000000001, - "y": 0.09999999999999964, + "x": 0.6, + "y": 0.1, }, "pinId": "J3.4", "side": "x+", }, "J3.5": { "offset": { - "x": 0.6000000000000001, - "y": 0.2999999999999998, + "x": 0.6, + "y": 0.3, }, "pinId": "J3.5", "side": "x+", }, "J3.6": { "offset": { - "x": 0.6000000000000001, + "x": 0.6, "y": 0.5, }, "pinId": "J3.6", @@ -379,120 +380,120 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { }, "LED.1": { "offset": { - "x": 0.00006220000000034531, - "y": 0.44580080000000066, + "x": 0, + "y": 0.45, }, "pinId": "LED.1", "side": "y+", }, "LED.2": { "offset": { - "x": -0.00006220000000034531, - "y": -0.44580080000000066, + "x": 0, + "y": -0.45, }, "pinId": "LED.2", "side": "y-", }, "Q1.1": { "offset": { - "x": 0.30397715550000004, - "y": 0.5519248499999994, + "x": 0.3, + "y": 0.55, }, "pinId": "Q1.1", "side": "y+", }, "Q1.2": { "offset": { - "x": 0.31067575550000137, - "y": -0.5519248499999994, + "x": 0.31, + "y": -0.55, }, "pinId": "Q1.2", "side": "y-", }, "Q1.3": { "offset": { - "x": -0.4185974445, - "y": -0.10250625000000019, + "x": -0.42, + "y": -0.1, }, "pinId": "Q1.3", "side": "x-", }, "R2.1": { "offset": { - "x": -0.0002732499999993365, - "y": -0.5512907000000005, + "x": 0, + "y": -0.55, }, "pinId": "R2.1", "side": "y-", }, "R2.2": { "offset": { - "x": 0.0002732499999993365, - "y": 0.5512907000000002, + "x": 0, + "y": 0.55, }, "pinId": "R2.2", "side": "y+", }, "R3.1": { "offset": { - "x": -0.0002732499999993365, - "y": -0.5512907, + "x": 0, + "y": -0.55, }, "pinId": "R3.1", "side": "y-", }, "R3.2": { "offset": { - "x": 0.0002732499999993365, - "y": 0.5512907, + "x": 0, + "y": 0.55, }, "pinId": "R3.2", "side": "y+", }, "R4.1": { "offset": { - "x": -0.0002732499999993365, - "y": -0.5512907000000009, + "x": 0, + "y": -0.55, }, "pinId": "R4.1", "side": "y-", }, "R4.2": { "offset": { - "x": 0.0002732499999993365, - "y": 0.5512907, + "x": 0, + "y": 0.55, }, "pinId": "R4.2", "side": "y+", }, "R5.1": { "offset": { - "x": -0.0002732499999993365, - "y": -0.5512907000000005, + "x": 0, + "y": -0.55, }, "pinId": "R5.1", "side": "y-", }, "R5.2": { "offset": { - "x": 0.0002732499999993365, - "y": 0.5512907000000002, + "x": 0, + "y": 0.55, }, "pinId": "R5.2", "side": "y+", }, "R7.1": { "offset": { - "x": -0.0002732499999993365, - "y": -0.5512907000000005, + "x": 0, + "y": -0.55, }, "pinId": "R7.1", "side": "y-", }, "R7.2": { "offset": { - "x": 0.0002732499999993365, - "y": 0.5512907000000002, + "x": 0, + "y": 0.55, }, "pinId": "R7.2", "side": "y+", @@ -626,4 +627,3 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { } `) }) - From 56132526e16ed6a308c9586a810abc19b7044473 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 05:08:17 +0700 Subject: [PATCH 24/27] fix: add newline for biome From cba68e3b437607921d1035028cf4baebbbc8c65c Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 05:08:21 +0700 Subject: [PATCH 25/27] fix: restore high-precision snapshots for CI --- ...ProblemFromCircuitJsonSchematic01.test.tsx | 195 +++++++++--------- 1 file changed, 97 insertions(+), 98 deletions(-) diff --git a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx index 0edf5a2..600b1b0 100644 --- a/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx +++ b/tests/getInputProblemFromCircuitJsonSchematic/getInputProblemFromCircuitJsonSchematic01.test.tsx @@ -4,7 +4,6 @@ import { getInputProblemFromCircuitJsonSchematic } from "lib/testing/getInputPro test("getInputProblemFromCircuitJsonSchematic01", () => { const circuitJson = getExampleCircuitJson() - const problem = getInputProblemFromCircuitJsonSchematic(circuitJson, { useReadableIds: true, }) @@ -20,8 +19,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "C1.2", ], "size": { - "x": 0.53, - "y": 1.1, + "x": 0.5291665999999999, + "y": 1.0583333000000001, }, }, "D1": { @@ -31,8 +30,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "D1.2", ], "size": { - "x": 0.62, - "y": 1.08, + "x": 0.6221256000000088, + "y": 1.0521572000000003, }, }, "I2C": { @@ -43,8 +42,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "I2C.3", ], "size": { - "x": 0.9, - "y": 0.53, + "x": 0.8843008999999997, + "y": 0.5299361999999987, }, }, "INT_JP": { @@ -54,8 +53,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "INT_JP.2", ], "size": { - "x": 0.3, - "y": 0.9, + "x": 0.30829299999999904, + "y": 0.8811970999999998, }, }, "J1": { @@ -106,8 +105,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "LED.2", ], "size": { - "x": 0.3, - "y": 0.9, + "x": 0.30829299999999904, + "y": 0.8811970999999998, }, }, "Q1": { @@ -118,8 +117,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "Q1.3", ], "size": { - "x": 0.89, - "y": 1.16, + "x": 0.8935117710000002, + "y": 1.1601665819999987, }, }, "R2": { @@ -129,8 +128,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R2.2", ], "size": { - "x": 0.41, - "y": 1.1, + "x": 0.40790845000000175, + "y": 1.0583332999999997, }, }, "R3": { @@ -140,8 +139,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R3.2", ], "size": { - "x": 0.41, - "y": 1.1, + "x": 0.40790845000000175, + "y": 1.0583332999999997, }, }, "R4": { @@ -151,8 +150,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R4.2", ], "size": { - "x": 0.41, - "y": 1.1, + "x": 0.40790845000000175, + "y": 1.0583332999999997, }, }, "R5": { @@ -162,8 +161,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R5.2", ], "size": { - "x": 0.41, - "y": 1.1, + "x": 0.40790845000000175, + "y": 1.0583332999999997, }, }, "R7": { @@ -173,8 +172,8 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "R7.2", ], "size": { - "x": 0.41, - "y": 1.1, + "x": 0.40790845000000175, + "y": 1.0583332999999997, }, }, "U1": { @@ -188,7 +187,7 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "U1.6", ], "size": { - "x": 1.2, + "x": 1.2000000000000002, "y": 0.8, }, }, @@ -196,143 +195,143 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { "chipPinMap": { "C1.1": { "offset": { - "x": 0, - "y": 0.55, + "x": -0.00027334999999961695, + "y": 0.5512093000000002, }, "pinId": "C1.1", "side": "y+", }, "C1.2": { "offset": { - "x": 0, - "y": -0.55, + "x": 0.00027334999999961695, + "y": -0.5512093000000002, }, "pinId": "C1.2", "side": "y-", }, "D1.1": { "offset": { - "x": 0, - "y": 0.54, + "x": 0.004432900000001183, + "y": 0.5362093000000003, }, "pinId": "D1.1", "side": "y+", }, "D1.2": { "offset": { - "x": 0, - "y": -0.54, + "x": 0.004886400000003732, + "y": -0.5362092999999994, }, "pinId": "D1.2", "side": "y-", }, "I2C.1": { "offset": { - "x": 0.45, - "y": -0.1, + "x": 0.44580080000000066, + "y": -0.10158727049999955, }, "pinId": "I2C.1", "side": "x+", }, "I2C.2": { "offset": { - "x": 0, - "y": 0.25, + "x": 0.0034928000000000736, + "y": 0.25259902949999957, }, "pinId": "I2C.2", "side": "y+", }, "I2C.3": { "offset": { - "x": -0.45, - "y": -0.1, + "x": -0.44580080000000066, + "y": -0.10146287049999964, }, "pinId": "I2C.3", "side": "x-", }, "INT_JP.1": { "offset": { - "x": 0, - "y": 0.45, + "x": 0.00006220000000034531, + "y": 0.4458007999999998, }, "pinId": "INT_JP.1", "side": "y+", }, "INT_JP.2": { "offset": { - "x": 0, - "y": -0.45, + "x": -0.00006220000000034531, + "y": -0.4458007999999998, }, "pinId": "INT_JP.2", "side": "y-", }, "J1.1": { "offset": { - "x": 0.7, - "y": -0.3, + "x": 0.7000000000000002, + "y": -0.2999999999999998, }, "pinId": "J1.1", "side": "x+", }, "J1.2": { "offset": { - "x": 0.7, - "y": -0.1, + "x": 0.7000000000000002, + "y": -0.09999999999999964, }, "pinId": "J1.2", "side": "x+", }, "J1.3": { "offset": { - "x": 0.7, - "y": 0.1, + "x": 0.7000000000000002, + "y": 0.09999999999999964, }, "pinId": "J1.3", "side": "x+", }, "J1.4": { "offset": { - "x": 0.7, - "y": 0.3, + "x": 0.7000000000000002, + "y": 0.2999999999999998, }, "pinId": "J1.4", "side": "x+", }, "J2.1": { "offset": { - "x": 0.7, - "y": -0.3, + "x": 0.7000000000000002, + "y": -0.2999999999999998, }, "pinId": "J2.1", "side": "x+", }, "J2.2": { "offset": { - "x": 0.7, - "y": -0.1, + "x": 0.7000000000000002, + "y": -0.09999999999999964, }, "pinId": "J2.2", "side": "x+", }, "J2.3": { "offset": { - "x": 0.7, - "y": 0.1, + "x": 0.7000000000000002, + "y": 0.09999999999999964, }, "pinId": "J2.3", "side": "x+", }, "J2.4": { "offset": { - "x": 0.7, - "y": 0.3, + "x": 0.7000000000000002, + "y": 0.2999999999999998, }, "pinId": "J2.4", "side": "x+", }, "J3.1": { "offset": { - "x": 0.6, + "x": 0.6000000000000001, "y": -0.5, }, "pinId": "J3.1", @@ -340,39 +339,39 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { }, "J3.2": { "offset": { - "x": 0.6, - "y": -0.3, + "x": 0.6000000000000001, + "y": -0.2999999999999998, }, "pinId": "J3.2", "side": "x+", }, "J3.3": { "offset": { - "x": 0.6, - "y": -0.1, + "x": 0.6000000000000001, + "y": -0.09999999999999964, }, "pinId": "J3.3", "side": "x+", }, "J3.4": { "offset": { - "x": 0.6, - "y": 0.1, + "x": 0.6000000000000001, + "y": 0.09999999999999964, }, "pinId": "J3.4", "side": "x+", }, "J3.5": { "offset": { - "x": 0.6, - "y": 0.3, + "x": 0.6000000000000001, + "y": 0.2999999999999998, }, "pinId": "J3.5", "side": "x+", }, "J3.6": { "offset": { - "x": 0.6, + "x": 0.6000000000000001, "y": 0.5, }, "pinId": "J3.6", @@ -380,120 +379,120 @@ test("getInputProblemFromCircuitJsonSchematic01", () => { }, "LED.1": { "offset": { - "x": 0, - "y": 0.45, + "x": 0.00006220000000034531, + "y": 0.44580080000000066, }, "pinId": "LED.1", "side": "y+", }, "LED.2": { "offset": { - "x": 0, - "y": -0.45, + "x": -0.00006220000000034531, + "y": -0.44580080000000066, }, "pinId": "LED.2", "side": "y-", }, "Q1.1": { "offset": { - "x": 0.3, - "y": 0.55, + "x": 0.30397715550000004, + "y": 0.5519248499999994, }, "pinId": "Q1.1", "side": "y+", }, "Q1.2": { "offset": { - "x": 0.31, - "y": -0.55, + "x": 0.31067575550000137, + "y": -0.5519248499999994, }, "pinId": "Q1.2", "side": "y-", }, "Q1.3": { "offset": { - "x": -0.42, - "y": -0.1, + "x": -0.4185974445, + "y": -0.10250625000000019, }, "pinId": "Q1.3", "side": "x-", }, "R2.1": { "offset": { - "x": 0, - "y": -0.55, + "x": -0.0002732499999993365, + "y": -0.5512907000000005, }, "pinId": "R2.1", "side": "y-", }, "R2.2": { "offset": { - "x": 0, - "y": 0.55, + "x": 0.0002732499999993365, + "y": 0.5512907000000002, }, "pinId": "R2.2", "side": "y+", }, "R3.1": { "offset": { - "x": 0, - "y": -0.55, + "x": -0.0002732499999993365, + "y": -0.5512907, }, "pinId": "R3.1", "side": "y-", }, "R3.2": { "offset": { - "x": 0, - "y": 0.55, + "x": 0.0002732499999993365, + "y": 0.5512907, }, "pinId": "R3.2", "side": "y+", }, "R4.1": { "offset": { - "x": 0, - "y": -0.55, + "x": -0.0002732499999993365, + "y": -0.5512907000000009, }, "pinId": "R4.1", "side": "y-", }, "R4.2": { "offset": { - "x": 0, - "y": 0.55, + "x": 0.0002732499999993365, + "y": 0.5512907, }, "pinId": "R4.2", "side": "y+", }, "R5.1": { "offset": { - "x": 0, - "y": -0.55, + "x": -0.0002732499999993365, + "y": -0.5512907000000005, }, "pinId": "R5.1", "side": "y-", }, "R5.2": { "offset": { - "x": 0, - "y": 0.55, + "x": 0.0002732499999993365, + "y": 0.5512907000000002, }, "pinId": "R5.2", "side": "y+", }, "R7.1": { "offset": { - "x": 0, - "y": -0.55, + "x": -0.0002732499999993365, + "y": -0.5512907000000005, }, "pinId": "R7.1", "side": "y-", }, "R7.2": { "offset": { - "x": 0, - "y": 0.55, + "x": 0.0002732499999993365, + "y": 0.5512907000000002, }, "pinId": "R7.2", "side": "y+", From 713e164c35134da04ceff3e9aa09e2a0777b484b Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 05:19:18 +0700 Subject: [PATCH 26/27] fix: add newline for biome From f4cbd001e62ff11e151db31707fadf67fd7f76e6 Mon Sep 17 00:00:00 2001 From: Watcharapon-T Date: Sun, 10 May 2026 05:19:23 +0700 Subject: [PATCH 27/27] fix: restore high-precision snapshots for CI