Skip to content

Restore hyphenated SOT-23 aliases - #762

Merged
seveibar merged 1 commit into
mainfrom
fix/sot-hyphen-alias
Aug 3, 2026
Merged

Restore hyphenated SOT-23 aliases#762
seveibar merged 1 commit into
mainfrom
fix/sot-hyphen-alias

Conversation

@seveibar

@seveibar seveibar commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Restore support for standard sot-23 footprint strings.
  • Normalize sot-23, sot-23-3, sot-23-5, and sot-23-6 to their canonical SOT-23 definitions.
  • Add circuit JSON equality checks and PCB SVG snapshots for each alias.

Root cause

The RJ45 footprint parser change allowed - to begin a parameter value so signed values such as holey-3.43mm work. Before normalization, that caused sot-23 to be parsed as sot("-23"); the generic six-pin SOT parser then failed validation instead of selecting the standard SOT-23 footprint.

This keeps signed parameter parsing intact while handling the hyphenated SOT-23 family as aliases before tokenization.

Validation

  • bun test tests/sot23.test.ts (9 passing)
  • bun run build
  • git diff --check
  • Full suite: 506 passing, with five unrelated existing visual snapshot mismatches (melf, sod323fl, diode1210, diode0603, sod923).

@seveibar
seveibar marked this pull request as ready for review August 3, 2026 01:17
@seveibar
seveibar requested a review from techmannih as a code owner August 3, 2026 01:17
@seveibar
seveibar merged commit 036c02d into main Aug 3, 2026
5 checks passed
Comment thread tests/sot23.test.ts
Comment on lines +11 to +33
test("sot-23 legacy alias", () => {
const circuitJson = fp.string("sot-23").circuitJson()
expect(circuitJson).toEqual(fp.string("sot23").circuitJson())

const svgContent = convertCircuitJsonToPcbSvg(circuitJson)
expect(svgContent).toMatchSvgSnapshot(import.meta.path, "sot23_legacy_alias")
})

test("sot-23 pin-count aliases", () => {
const aliases = [
["sot-23-3", "sot23_3"],
["sot-23-5", "sot23_5"],
["sot-23-6", "sot23_6"],
] as const

for (const [alias, canonical] of aliases) {
const circuitJson = fp.string(alias).circuitJson()
expect(circuitJson).toEqual(fp.string(canonical).circuitJson())

const svgContent = convertCircuitJsonToPcbSvg(circuitJson)
expect(svgContent).toMatchSvgSnapshot(import.meta.path, alias)
}
})

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.

This file now contains more than one test(...) call, which violates the rule that a *.test.ts file may have AT MOST one test(...). The two new tests ('sot-23 legacy alias' on line 11 and 'sot-23 pin-count aliases' on line 19) should be split into separate numbered files, e.g., sot231.test.ts, sot232.test.ts, sot233.test.ts (or similar numbering scheme consistent with the project).

Suggested change
test("sot-23 legacy alias", () => {
const circuitJson = fp.string("sot-23").circuitJson()
expect(circuitJson).toEqual(fp.string("sot23").circuitJson())
const svgContent = convertCircuitJsonToPcbSvg(circuitJson)
expect(svgContent).toMatchSvgSnapshot(import.meta.path, "sot23_legacy_alias")
})
test("sot-23 pin-count aliases", () => {
const aliases = [
["sot-23-3", "sot23_3"],
["sot-23-5", "sot23_5"],
["sot-23-6", "sot23_6"],
] as const
for (const [alias, canonical] of aliases) {
const circuitJson = fp.string(alias).circuitJson()
expect(circuitJson).toEqual(fp.string(canonical).circuitJson())
const svgContent = convertCircuitJsonToPcbSvg(circuitJson)
expect(svgContent).toMatchSvgSnapshot(import.meta.path, alias)
}
})
test("sot-23 legacy alias", () => {
const circuitJson = fp.string("sot-23").circuitJson()
expect(circuitJson).toEqual(fp.string("sot23").circuitJson())
const svgContent = convertCircuitJsonToPcbSvg(circuitJson)
expect(svgContent).toMatchSvgSnapshot(import.meta.path, "sot23_legacy_alias")
})

Spotted by Graphite (based on custom rule: Custom rule)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

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