test: Cover isServiceFailure override and Infura failure classification#9169
Merged
cryptodev-2s merged 2 commits intoJun 17, 2026
Conversation
Cover the new `isServiceFailure` override option in `createServicePolicy` (custom predicate is honored, called with the raw error, and the default still applies when omitted) and the Infura specific classification in `RpcService` (400 and 429 do not break the circuit, other errors like 401 and 500 do, and non Infura endpoints are unaffected). Also fix a stale comment in both predicates that referred to a "code" property where the check is actually on `httpStatus`.
Merged
4 tasks
FrederikBolding
approved these changes
Jun 17, 2026
02d5510
into
fb/treat-more-errors-as-service-failures
375 checks passed
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.
Follow up to #9123 to add the missing test coverage and fix a stale comment. Targets that PR's branch so it merges in before #9123 goes to main.
What this adds
packages/controller-utils(create-service-policy.test.ts):isServiceFailureopens the circuit when the predicate treats the error as a failure, and never opens it when it does not.httpStatus >= 500, not on< 500).packages/network-controller(rpc-service.test.ts):