fix: distinguish EasyEDA HTTP 403 rate limiting from component lookup failure - #412
Merged
seveibar merged 1 commit intoJul 23, 2026
Merged
Conversation
… failure EasyEDA's component API rate-limits by IP and answers HTTP 403 once tripped. fetchEasyEDAComponent treated any non-success response as a lookup failure, so throttled batches surfaced as 'Failed to search for the component', sending users hunting for a nonexistent part-number problem. Now a 403 on either the search or the component-details request throws a rate-limit-specific error (with the ~2 minute cooldown hint), and other non-success statuses include the HTTP status code. 'Component not found' remains unchanged and distinct. Fixes tscircuit#409 (error-text distinction; retry/serialisation/proxying left as follow-ups)
seveibar
approved these changes
Jul 23, 2026
|
Thank you for your contribution! 🎉 PR Rating: ⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #409 — the error-text distinction (suggestion 3 of the issue).
Problem
EasyEDA's component API rate-limits by IP and answers HTTP 403 once tripped (not 429, no
Retry-After).fetchEasyEDAComponenttreated any non-success response as a lookup failure, so a throttled batch surfaced as:which points the user at the part number. The part is fine; the request was throttled — as measured in #409, every LCSC id 403s identically mid-cooldown and recovers after ~2 minutes.
Change (minimal, one concern)
Component not found(successful response, empty result list) is unchanged — it stays distinct from rate limiting, which is the core complaint in EasyEDA rate-limits with HTTP 403; surfaced as "Failed to search for the component" #409.Retry/backoff, serialising the parts-engine batch, and CDN proxying (suggestions 1, 2, 4) are deliberately left as follow-ups — they're behaviour/architecture decisions, and per review feedback on other PRs I'm keeping one change per PR.
Tests (red→green)
tests/fetch-tests/rate-limit-403.test.ts— uses the existing injectablefetchoption, so no network (unlike the live-API fetch tests, these can't themselves be rate-limited):/rate limit/ierror (was: generic lookup failure) — red before, green after/rate limit/ierror — red before, green afterComponent not found(guards the distinction)HTTP 500— red before, green afterbun teston the new file: 4 pass.tsc --noEmitclean.biome checkclean.Note: #393 (May) adds part numbers to these messages but doesn't distinguish status codes; this PR is orthogonal and touches only the status-code branches.