Skip to content

Conversation

@seveibar
Copy link
Contributor

Motivation

  • Provide a non-fatal warning counterpart to pcb_panelization_placement_error so minor panelization placement issues can be represented separately from errors.
  • Ensure the new warning is discoverable and parseable across the codebase by including it in the central PCB exports and the any_circuit_element union.

Description

  • Add a new Zod schema and TypeScript types in src/pcb/pcb_panelization_placement_warning.ts that define pcb_panelization_placement_warning with ID, warning_type, message, and optional context fields.
  • Export the new warning from src/pcb/index.ts and import its type so it is included in the PcbCircuitElement union.
  • Include pcb.pcb_panelization_placement_warning in the any_circuit_element union in src/any_circuit_element.ts so it can be parsed by the general parser.
  • Add unit tests in tests/pcb_panelization_placement_warning.test.ts to validate parsing and union membership.

Testing

  • Ran bun test tests/pcb_panelization_placement_warning.test.ts and it passed (2 tests, 0 failures).
  • Ran bunx tsc --noEmit for a TypeScript typecheck and it completed with no type errors.

Codex Task

Comment on lines +5 to +30
test("pcb_panelization_placement_warning parses", () => {
const warning = pcb_panelization_placement_warning.parse({
type: "pcb_panelization_placement_warning",
message: "panelized board placement has minor issues",
pcb_panel_id: "pcb_panel_1",
pcb_board_id: "pcb_board_1",
})

expect(warning.pcb_panelization_placement_warning_id).toBeDefined()
expect(
warning.pcb_panelization_placement_warning_id.startsWith(
"pcb_panelization_placement_warning",
),
).toBe(true)
expect(warning.pcb_panel_id).toBe("pcb_panel_1")
expect(warning.pcb_board_id).toBe("pcb_board_1")
})

test("any_circuit_element includes pcb_panelization_placement_warning", () => {
const parsed = any_circuit_element.parse({
type: "pcb_panelization_placement_warning",
message: "panelized board placement has minor issues",
})

expect(parsed.type).toBe("pcb_panelization_placement_warning")
})
Copy link
Contributor

Choose a reason for hiding this comment

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

This test file contains 2 test() functions (lines 5 and 23), but according to the style guide rule about test file structure, a *.test.ts file may have AT MOST one test(...) function. After that, the user should split into multiple numbered files. To fix this, split the tests into separate files like 'pcb_panelization_placement_warning1.test.ts' and 'pcb_panelization_placement_warning2.test.ts', with each file containing only one test() function.

Spotted by Graphite Agent (based on custom rule: Custom rule)

Fix in Graphite


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

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.

2 participants