Skip to content

Place same-rail load partitions after decoupling capacitor rows - #192

Draft
mohan-bee wants to merge 1 commit into
tscircuit:mainfrom
mohan-bee:agent/place-rail-loads-after-decoupling-caps
Draft

Place same-rail load partitions after decoupling capacitor rows#192
mohan-bee wants to merge 1 commit into
tscircuit:mainfrom
mohan-bee:agent/place-rail-loads-after-decoupling-caps

Conversation

@mohan-bee

Copy link
Copy Markdown
Contributor

Motivation

Generic partition packing can place a rail-connected load chain on the opposite side of its matching decoupling capacitors. In the captured power-section repro, the R1LED1 partition bridges the same positive and ground rails as C3/C4, but it was placed to the left instead of following the capacitor row on the right. This makes the power section harder to read even though the internal load-chain placement is valid.

Change

  • Add a dedicated PlaceRailConnectedLoadsSolver pipeline phase after decoupling-row placement.
  • Detect non-capacitor, two-pin load partitions that bridge the same rail pair as a decoupling-capacitor partition.
  • Treat the capacitor row as the anchor and place matching load partitions sequentially to its right using partitionGap.
  • Translate each load partition as a rigid group so internal offsets and rotations are preserved.
  • Roll back a candidate translation when it collides with another component.

Evidence

The existing repro-power-section.input.json fixture now produces this order on the shared rails:

U3 → C3 → C4 → R1/LED1

The regression asserts that:

  • the load partition begins exactly one partitionGap after the capacitor row;
  • R1 and LED1 stay vertically aligned;
  • their original 1.54 internal spacing is preserved;
  • the final layout contains no overlaps.

The SVG snapshot records the corrected schematic placement.

Tests

  • bunx biome format .
  • bunx tsc --noEmit
  • bun test — 81 passed, 1 skipped, 0 failed
  • bun run build

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
matchpack Ready Ready Preview Jul 31, 2026 4:19pm

Request Review

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.

1 participant