Skip to content

Detect connected source ports missing PCB mappings - #216

Draft
AnasSarkiz wants to merge 2 commits into
tscircuit:mainfrom
AnasSarkiz:fix-missing-pcb-port-check
Draft

Detect connected source ports missing PCB mappings#216
AnasSarkiz wants to merge 2 commits into
tscircuit:mainfrom
AnasSarkiz:fix-missing-pcb-port-check

Conversation

@AnasSarkiz

Copy link
Copy Markdown
Member

Summary

  • add checkSourcePortsHavePcbPorts to placement validation
  • report pcb_port_not_matched_error when a connected, PCB-backed source port lacks an owner-matched PCB port
  • follow internal pin connectivity while avoiding cascades for known footprint-load failures
  • export and document the checker, with regression coverage for mapping and false-positive edge cases

Root cause

The existing routing checks begin from pcb_port records or filter out source ports without a PCB mapping. Removing a pcb_port therefore also removed the evidence those checks needed, so runAllPlacementChecks returned no error.

Impact

Placement validation now diagnoses missing physical port mappings before routing. Unconnected ports, source-only circuits, and components with explicit footprint-load failures remain unaffected.

Testing

  • bun test — 186 passed, 0 failed
  • bun run build
  • Biome check on changed TypeScript files
  • git diff --check

@imrishabh18 imrishabh18 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IIUC this is a core bug if you see this issue

@seveibar seveibar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Visual Snapshot? This does not seem like a user bug but a core bug?

Copy link
Copy Markdown
Member Author

Moved the Core-owned producer invariant to tscircuit/core#3354 based on this review and the natural MangoPi repro.

The trace confirmed that the imported thermalpad alias is erased by the generated wrapper's prop spread before Core receives the <chip>, so Core cannot reconstruct pin 89/9 without heuristic pad-order inference. The Core PR now reports the canonical error after port matching settles and blocks autorouting. The importer generator still needs a separate per-pin alias merge.

This draft should not merge unchanged alongside core#3354 because both implementations would emit the same placement diagnostic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants