Skip to content

Conversation

seveibar
Copy link
Contributor

@seveibar seveibar commented Oct 3, 2025

Summary

  • update the simple route json outline test to use a U-shaped board with the local autorouter enabled
  • capture a PCB snapshot proving the autorouted trace follows the U-shaped outline

Testing

  • BUN_UPDATE_SNAPSHOTS=1 bun test tests/utils/autorouting/simple-route-json-outline.test.tsx
  • bunx tsc --noEmit

https://chatgpt.com/codex/tasks/task_b_68df59bb16c0832e829d0a91fc50736c

Copy link

vercel bot commented Oct 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview Comment Oct 3, 2025 5:07pm

Comment on lines 1 to 50
import { expect, test } from "bun:test"
import { getTestFixture } from "tests/fixtures/get-test-fixture"
import { getSimpleRouteJsonFromCircuitJson } from "lib/utils/autorouting/getSimpleRouteJsonFromCircuitJson"

const uShapedOutline = [
{ x: -6, y: -6 },
{ x: -2, y: -6 },
{ x: -2, y: 2 },
{ x: 2, y: 2 },
{ x: 2, y: -6 },
{ x: 6, y: -6 },
{ x: 6, y: 6 },
{ x: -6, y: 6 },
]

test("simple route json includes board outline when provided", async () => {
const { circuit } = getTestFixture()

circuit.add(
<board
outline={uShapedOutline}
autorouter={{
local: true,
groupMode: "subcircuit",
}}
>
<resistor
name="R1"
resistance="1k"
footprint="0402"
pcbX={-4}
pcbY={-4}
/>
<resistor name="R2" resistance="1k" footprint="0402" pcbX={4} pcbY={-4} />
<trace from=".R1 > .pin2" to=".R2 > .pin2" />
</board>,
)

await circuit.renderUntilSettled()

const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
db: circuit.db,
})

expect(simpleRouteJson.outline).toBeDefined()
expect(simpleRouteJson.outline).toHaveLength(uShapedOutline.length)
expect(simpleRouteJson.outline).toEqual(uShapedOutline)

expect(circuit).toMatchPcbSnapshot(import.meta.path)
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file name simple-route-json-outline.test.tsx violates the project's naming convention. Test files with the *.test.ts extension may contain at most one test(...) function. When multiple tests are needed, they should be split into numbered files (e.g., add1.test.ts, add2.test.ts). Since this file contains only one test, it should be renamed to follow the convention, such as simple-route-json-outline1.test.tsx or use a more descriptive name that reflects the specific test's purpose.

Spotted by Diamond (based on custom rule: Custom rule)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@seveibar seveibar changed the title Add autorouter U-outline regression snapshot Fix autorouter routing through board outline, Add autorouter U-outline regression snapshot Oct 3, 2025
@seveibar seveibar merged commit dee3cf2 into main Oct 3, 2025
10 checks passed
@seveibar seveibar deleted the codex/update-capacity-autorouter-for-outline-support branch October 3, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant