Skip to content

Improve PCB overlap error messages and add sample-style repro test#106

Merged
seveibar merged 2 commits intomainfrom
codex/fix-drc-error-in-circuit-example
Mar 4, 2026
Merged

Improve PCB overlap error messages and add sample-style repro test#106
seveibar merged 2 commits intomainfrom
codex/fix-drc-error-in-circuit-example

Conversation

@seveibar
Copy link
Contributor

@seveibar seveibar commented Mar 4, 2026

Motivation

  • Make PCB footprint overlap diagnostics more actionable by including clearer identifiers and spatial context for overlapping elements to simplify debugging of errors like pcb_smtpad element overlaps with pcb_smtpad element.
  • Provide a small, reproducible test in the same JSX/style as the provided sample circuit to ensure the new message format is emitted and rendered.

Description

  • Added a formatOverlapElementDescription helper that produces a descriptive string for an overlapped element including readable name + element id, owning component (when present), port (when present), and center coordinates in millimeters, and wired it into the overlap error message creation in checkPcbComponentOverlap.
  • Expanded imports to use getReadableNameForComponent and getReadableNameForPort and replaced the terse overlap message with the new detailed format.
  • Added a repro test tests/lib/check-pcb-component-overlap/test.tsx that renders a small board/chip footprint (sample003-style) to reproduce a pcb_smtpad overlap and added/updated SVG snapshots to assert the error is drawn.

Testing

  • Ran BUN_UPDATE_SNAPSHOTS=1 bun test tests/lib/check-pcb-component-overlap and the suite passed (4 tests, snapshots refreshed for overlap cases).
  • Ran BUN_UPDATE_SNAPSHOTS=1 bun test ./tests/lib/check-pcb-component-overlap/test.tsx and the new repro test passed and wrote the snapshot (1 pass).
  • Ran bunx tsc --noEmit for type-checking and it completed successfully with no errors.
  • Ran bun run format, which completed successfully but reported Biome size warnings for large fixture JSON files while formatting the repository.

Codex Task

@seveibar seveibar merged commit f20cc82 into main Mar 4, 2026
6 checks passed
@seveibar seveibar deleted the codex/fix-drc-error-in-circuit-example branch March 4, 2026 21:36
@tscircuitbot
Copy link
Contributor


Thank you for your contribution! 🎉

PR Rating: ⭐⭐
Impact: Minor

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


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