Skip to content

fix(testpoint): honor padDiameter on through-hole test points - #5907

Open
siribi007-del wants to merge 2 commits into
tscircuit:mainfrom
siribi007-del:fix/testpoint-through-hole-pad-diameter
Open

siribi007-del wants to merge 2 commits into
tscircuit:mainfrom
siribi007-del:fix/testpoint-through-hole-pad-diameter

Conversation

@siribi007-del

Copy link
Copy Markdown

padDiameter is documented as "Diameter of the copper pad (applies to both SMD pads and plated holes)", but through-hole test points ignore it:

<testpoint name="TP1" footprintVariant="through_hole" holeDiameter="1mm" padDiameter="2.5mm" />

On main this produces a pcb_plated_hole with outer_diameter: 1.5 (footprinter's 1.5× hole default), while source_component.pad_diameter says 2.5, so the generated PCB pad does not match the requested size and the Circuit JSON contradicts itself.

Cause: TestPoint._getImpliedFootprintString() always returned platedhole_d<hole> for the through-hole variant.

Fix: when padDiameter is set, return platedhole_d<hole>_pd<pad> (footprinter's platedhole already parses pd). Without padDiameter the footprint string is unchanged.

Tests

  • New tests/components/normal-components/testpoint-through-hole-pad-diameter.test.tsx: fails on main (outer_diameter 1.5, expected 2.5), passes with the fix.
  • 7 tests/features/autoroutingphase-* snapshots change: those tests already pass padDiameter to default (through-hole) test points, which was ignored. Their pads now use the requested size (e.g. 0.8mm instead of 0.75mm, 0.7mm in fixed-pcb-path), the reference labels move with the pad edge, and routes are recomputed. All of their assertions still pass.
  • bunx tsc --noEmit passes, and the PR checker (tscircuit-pullrequest-deterministic-checks) reports 0 errors. Its 3 warnings are pre-existing repo-tooling ones.

Before / after (hole 1mm, padDiameter 2.5mm):

Before/after: hole 1mm, padDiameter 2.5mm

Not addressed here: a padDiameter that is not larger than the hole is passed through as-is. That validation is a separate question.

AI-assisted (Claude); I ran and verified the tests locally.

<testpoint footprintVariant="through_hole" padDiameter=... /> ignored
padDiameter: the implied footprint was always `platedhole_d<hole>`, so the
plated hole's outer_diameter fell back to 1.5x the hole diameter while the
source_component still reported the requested pad_diameter.

Pass padDiameter to the footprinter as `_pd<diameter>` when it is set.
Seven autoroutingphase snapshots already set padDiameter on default
(through-hole) test points; their pads now render at the requested size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
tscircuit-core-benchmarks Ready Ready Preview Nov 26, 2026 3:44am UTC

Request Review

@nitina-ariveguru

Copy link
Copy Markdown

I tested this merged onto current main (v0.0.2482), swapped into tscircuit 0.0.3294 with an empty .tscircuit/cache. It merges cleanly and tsc --noEmit is clean.

<testpoint> main with #5907
through_hole, holeDiameter="1mm" padDiameter="2.5mm" plated hole, outer 1.5 outer 2.5
through_hole, holeDiameter="1mm" (no padDiameter) outer 1.5 outer 1.5 (unchanged)
pad, padDiameter="2mm" SMD pad, 2 2 (unchanged)
through_hole, holeDiameter="1mm" padDiameter="0.8mm" outer 1.5 outer 0.8, smaller than the 1 mm hole

The last row now builds with no error or warning, but it produces a plated hole whose copper is smaller than its drill, so there's no annular ring at all. On main, padDiameter was ignored there. Since this PR makes padDiameter reach the footprint, a check that it's larger than holeDiameter (or an error naming the test point) would stop it from silently generating an unmanufacturable pad.

The new test fails on main and passes here. The 9 autorouting-phase test files that use test points give the same 8 pass / 1 fail on main and this branch (the same simplify … Pipeline 11 test fails on both), so the larger pads in the updated snapshots don't break routing.

A through-hole test point with padDiameter <= holeDiameter would now
produce a plated hole whose copper is no wider than its drill (no
annular ring). Report a source_invalid_component_property_error naming
the test point and fall back to the default pad size instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@siribi007-del

Copy link
Copy Markdown
Author

Thanks for testing this. Good catch on the last row. Pushed 32ad8fa: when padDiameter <= holeDiameter on a through-hole test point, it now inserts a source_invalid_component_property_error naming the test point and falls back to the default pad size, so it no longer produces a plated hole with no annular ring. Added a test for that case.

@nitina-ariveguru

Copy link
Copy Markdown

Retested 32ad8fa merged onto current main (v0.0.2483), swapped into tscircuit 0.0.3294 with an empty .tscircuit/cache:

holeDiameter="1mm" + plated hole outer errors
padDiameter="2.5mm" 2.5 none
no padDiameter 1.5 none
padDiameter="0.8mm" 1.5 (default) Invalid padDiameter on testpoint "TP4": 0.8mm must be larger than holeDiameter (1mm); using the default pad size instead
padDiameter="1mm" 1.5 (default) same error, for TP5
padDiameter="1.05mm" 1.05 none

The SMD pad variant is unchanged (2 mm). Both tests in the new file pass, and tsc --noEmit is clean.

The last row is legal under the new rule, but it leaves a 0.025 mm annular ring. That's probably fine to leave to DRC rather than this prop check.

This branch was successfully deployed

1 active deployment
Preview — 32ad8faa Deployed Nov 26, 2026 by vercel[bot]
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.

2 participants