Skip to content

Normalize string-valued supplier part numbers during chip inflation#2566

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/normalize-string-supplier-part-number
Draft

Normalize string-valued supplier part numbers during chip inflation#2566
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/normalize-string-supplier-part-number

Conversation

@posthog

@posthog posthog Bot commented Jul 3, 2026

Copy link
Copy Markdown

Summary

A <chip> inflated from circuit JSON crashes with Could not create chip when a source_component's supplier_part_numbers.jlcpcb arrives as a bare string (e.g. "C7484") instead of an array (["C7484"]). The chipProps zod schema rejects the string with "Expected array, received string"; that error is swallowed in create-instance-from-react-element.ts and swapped for an ErrorPlaceholder, producing a broken render.

inflateSourceChip now coerces any string-valued supplier part number into a single-element array before handing it to Chip, mirroring the Array.isArray guard already used in NormalComponent_doInitialSupplierFootprintMismatchWarning.ts. The render now degrades gracefully instead of throwing.

Added a reproduction test under tests/subcircuits/ that inflates a chip whose supplier part number is the malformed bare-string shape and asserts no errors are produced.

Why

Affected users hit a repeating broken-chip render because a JLCPCB supplier part number was coming through as a plain string rather than an array, throwing during chip instantiation.


Created with PostHog Code from an inbox report.

When a source_component's supplier_part_numbers.jlcpcb arrives as a bare
string (e.g. "C7484") instead of an array (["C7484"]), the chipProps zod
schema rejects it with "Expected array, received string". That error was
swallowed during instantiation and swapped for an ErrorPlaceholder, producing
a broken "Could not create chip" render.

inflateSourceChip now coerces any string-valued supplier part number into a
single-element array before handing it to Chip, mirroring the Array.isArray
guard already used in the supplier footprint mismatch check, so the render
degrades gracefully instead of throwing.

Generated-By: PostHog Code
Task-Id: b5710550-0905-46f1-ac00-80b6ede2dc7e
@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
tscircuit-core-benchmarks Error Error Jul 3, 2026 1:17am

Request Review

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

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.

0 participants