Skip to content

feat: deterministic row layout for decoupling cap partitions#96

Open
Guz007 wants to merge 1 commit into
tscircuit:mainfrom
Guz007:feat/decoupling-cap-row-layout
Open

feat: deterministic row layout for decoupling cap partitions#96
Guz007 wants to merge 1 commit into
tscircuit:mainfrom
Guz007:feat/decoupling-cap-row-layout

Conversation

@Guz007
Copy link
Copy Markdown

@Guz007 Guz007 commented May 12, 2026

Summary

  • When partitionType === "decoupling_caps", SingleInnerPartitionPackingSolver now bypasses PackSolver2 and places capacitors in a deterministic centered horizontal row
  • Caps sorted by chipId for consistent ordering across runs
  • Spacing uses decouplingCapsGap with fallback to chipGap
  • Non-decoupling partitions continue through the existing PackSolver2 path unchanged

What changed

lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts

  • Added createDecouplingCapRowLayout() — sorts chips by chipId, computes total row width, centers at origin
  • Added early-exit in _step() for partitionType === "decoupling_caps" before PackSolver2 initialization

tests/SingleInnerPartitionPackingSolver/DecouplingCapRow.test.ts (new)

  • 3-cap centered row (order, centering, y=0, rotation=0)
  • decouplingCapsGap spacing when provided
  • chipGap fallback when decouplingCapsGap absent
  • Single cap at origin
  • Non-decoupling partition regression guard

Verification

bun test tests/SingleInnerPartitionPackingSolver/DecouplingCapRow.test.ts
# 5 pass, 0 fail

bun test
# 27 pass (was 22), 1 fail (pre-existing circuit-to-svg import error in deps), 0 new failures

/claim #15

When partitionType === "decoupling_caps", bypass PackSolver2 and place
caps in a centered horizontal row sorted by chipId. Uses decouplingCapsGap
(falling back to chipGap) for spacing between components.

Adds focused tests for row centering, natural ordering, gap parameter
priority, single-cap case, and regression guard for default partitions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 12, 2026

@Guz007 is attempting to deploy a commit to the tscircuit Team on Vercel.

A member of the Team first needs to authorize it.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant