Skip to content

fix: reject invalid EasyEDA component detail responses - #560

Open
alexci04 wants to merge 1 commit into
tscircuit:mainfrom
alexci04:fix/validate-component-detail-response
Open

fix: reject invalid EasyEDA component detail responses#560
alexci04 wants to merge 1 commit into
tscircuit:mainfrom
alexci04:fix/validate-component-detail-response

Conversation

@alexci04

Copy link
Copy Markdown

The component-details request currently checks HTTP status but ignores the JSON success flag. A response with success: false can return geometry as if it succeeded; a missing result returns undefined when model metadata is disabled or produces a TypeError when enabled.

This adds component-envelope validation before model metadata lookup, preserving the raw geometry for the existing conversion layer. Failures identify the requested part and include the API error code/message when available. The change follows the existing search-response validation pattern.

Validation:

  • 18 initial offline regression cases failed on unmodified main (06077ed); expanded coverage now includes missing/empty UUIDs.
  • 39 focused fetch tests pass, including 22 new cases covering both metadata settings, existing exact-match behavior, search errors and HTTP rate limiting.
  • TypeScript --noEmit, formatting for the three changed files, git diff --check, and the library/browser/CLI build pass.
  • Checked one public component-details response to confirm the success/code/result envelope. The malformed responses are injected regression cases, not a claim of a live API outage.
  • Full image/network test suite not run.

Prepared and tested with OpenAI Codex assistance. No fixed bounty or payment is claimed for this contribution.

@alexci04
alexci04 marked this pull request as ready for review September 10, 2026 21:56
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