fix(ramps-controller): expose circuit breaker error key#8596
Draft
saustrie-consensys wants to merge 3 commits intomainfrom
Draft
fix(ramps-controller): expose circuit breaker error key#8596saustrie-consensys wants to merge 3 commits intomainfrom
saustrie-consensys wants to merge 3 commits intomainfrom
Conversation
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.
Explanation
When repeated upstream failures trip the service-policy circuit breaker,
RampsControllercan receive the internal Cockatiel messageExecution prevented because the circuit breaker is open.The first version of this fix replaced that message with hardcoded user copy inside
core, but that puts localization responsibility in the wrong layer.This PR instead keeps
coreout of copy ownership by:RAMPS_ERROR_CODES.CIRCUIT_BREAKER_OPENerrorKeymetadata to classified request/resource failureserrorKeyso clients can localize themThis covers the shared
executeRequestpath used by ramp quote/resource calls and the native Transak quote path, adds regression coverage for request-state, resource-state, selector, and rethrow behavior, and updates the@metamask/ramps-controllerchangelog.References
Testing
yarn workspace @metamask/ramps-controller testyarn workspace @metamask/ramps-controller messenger-action-types:checkyarn eslint packages/ramps-controller/src/RampsController.ts packages/ramps-controller/src/RampsController.test.ts packages/ramps-controller/src/RequestCache.ts packages/ramps-controller/src/selectors.ts packages/ramps-controller/src/selectors.test.ts packages/ramps-controller/src/index.ts packages/ramps-controller/src/rampsErrorCodes.tsyarn tsc --noEmit -p packages/ramps-controller/tsconfig.json(still fails in this checkout due existing referenced-build / monorepo type issues, includingTS6305build-artifact errors and unchanged pre-existingTransakService.tstype errors)Checklist