fix(ramp): localize circuit breaker fallback errors#29507
fix(ramp): localize circuit breaker fallback errors#29507saustrie-consensys wants to merge 27 commits into
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
Follow-up note after tightening the companion core PR. No additional mobile code change was needed here because the mobile layer is already using the right boundary: That separation is intentional:
With the latest core follow-up now normalizing |
1eb7801 to
eaf2edb
Compare
|
Dependency note after checking the release path: This PR is the correct mobile-side handling change, but it does not complete the rollout by itself because mobile still resolves The companion core fix from Why that matters:
|
Ships @metamask/ramps-controller@13.3.0 (released in MetaMask/core#8698) so this branch can consume the stable `CIRCUIT_BREAKER_OPEN` error key the rest of the diff localizes against. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pins the project's direct messenger dep (and resolution override) to ^1.2.0 so the messenger@^1.2.0 lockfile entry pulled in by @metamask/ramps-controller@13.3.0 is rooted at the project. Without this the previous commit's lockfile is unstable under yarn install --immutable on CI: the messenger@^1.2.0 entry gets flagged as orphan and the install fails with YN0028. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…AM-3475-circuit-breaker-open-error # Conflicts: # yarn.lock
Collapses the duplicate `@metamask/ramps-controller` entries (13.2.0 pulled in by transaction-pay-controller@21.0.0 via ^13.2.0 + 13.3.0 from the direct dep) into a single 13.3.0 resolution, since 13.3.0 satisfies both ranges. Fixes the `Dedupe` CI check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…AM-3475-circuit-breaker-open-error # Conflicts: # yarn.lock
…AM-3475-circuit-breaker-open-error # Conflicts: # package.json
…AM-3475-circuit-breaker-open-error
Co-authored-by: Cursor <cursoragent@cursor.com>
44d4a7b
This reverts commit 95908b5.
|
@metamaskbot update-mobile-fixture |
|
🔄 Fixture update started. Running workflow from branch |
|
❌ E2E fixture update failed.\n\nCommon causes:\n- CI workflow is still running — wait for 'Build iOS Apps' to complete\n- CI workflow was skipped — ensure your PR has iOS-impacting changes or use |
|
@copilot resolve conflicts |
…-open-error Co-authored-by: amitabh94 <12572750+amitabh94@users.noreply.github.com>
Head branch was pushed to by a user without write access
Conflicts resolved in 2d67f0f. The only conflict was in |
Co-authored-by: Cursor <cursoragent@cursor.com>
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|



Description
This PR is the mobile companion to MetaMask/core#8596.
When the ramps controller classifies a temporary provider/compliance failure as
CIRCUIT_BREAKER_OPEN, mobile still had one important leak in Unified Buy V2: the quote path could collapse the enriched controller/query error back down to a raw string, which meant the Buy amount screen could still showExecution prevented because the circuit breaker is open.Mobile was already translating keyed ramp resource errors in several places, but the V2 quote flow was still dropping
errorKeymetadata and treating the resulting message as user-facing copy.Preserve the original quote error object in
useRampsQuotes, route quote-driven UI states back throughparseUserFacingError, and mapCIRCUIT_BREAKER_OPENto a dedicated high-level fallback:This service is temporarily unavailable. Please try again in about 30 minutes.That wording is intentional. The core service-policy cooldown defaults to 30 minutes, but the current ramps error contract does not expose a live remaining-duration value, so mobile should avoid promising an exact countdown once the breaker is already partway through its cooldown.
This stays a draft because it depends on the companion core change from MetaMask/core#8596 being available in the mobile-consumed
@metamask/ramps-controllerbuild.Changelog
CHANGELOG entry: Fixed a bug where Unified Buy could show an internal circuit breaker error instead of localized retry copy.
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-3475
Companion core change: MetaMask/core#8596
Manual testing steps
Screenshots/Recordings
Before (
main)before-buy-broken-circuit-main.mp4
After (this PR + core PR branch)
after-buy-broken-circuit-pr-branches-rerecord.mp4
Validation
./node_modules/.bin/jest --runTestsByPath app/components/UI/Ramp/hooks/useRampsQuotes.test.ts app/components/UI/Ramp/utils/parseUserFacingError.test.ts app/components/UI/Ramp/hooks/useRampsProviders.test.ts app/components/UI/Ramp/hooks/useRampsCountries.test.ts app/components/UI/Ramp/hooks/useRampsTokens.test.ts app/components/UI/Ramp/hooks/useRampsPaymentMethods.test.ts --runInBandyarn eslint app/components/UI/Ramp/hooks/useRampsQuotes.ts app/components/UI/Ramp/hooks/useRampsQuotes.test.ts app/components/UI/Ramp/Views/Modals/ProviderSelectionModal/ProviderSelectionModal.tsx app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsx app/components/UI/Ramp/utils/parseUserFacingError.ts app/components/UI/Ramp/utils/parseUserFacingError.test.ts app/components/UI/Ramp/hooks/useRampsProviders.test.ts app/components/UI/Ramp/hooks/useRampsCountries.test.ts app/components/UI/Ramp/hooks/useRampsTokens.test.ts app/components/UI/Ramp/hooks/useRampsPaymentMethods.test.tsyarn lint:tscPre-merge author checklist
Performance checks (if applicable)
Pre-merge reviewer checklist
Note
Low Risk
Low risk: changes are limited to error-message parsing/localization and test infrastructure, with minimal impact on core ramp flows beyond how errors are displayed and tracked.
Overview
Unified Buy V2 now preserves quote-fetch error objects (instead of collapsing to strings) so
errorKeymetadata survives throughuseRampsQuotesintoBuildQuote, enabling circuit-breaker errors to display a localized fallback message and be tracked consistently.parseUserFacingErroris extended to detectCIRCUIT_BREAKER_OPENand return a new localized string (fiat_on_ramp.circuit_breaker_open), and ramp hooks/screens that surface catalog/quote errors (useRampsProviders,useRampsTokens,useRampsCountries,useRampsPaymentMethods,ProviderSelectionModal) now run errors through this parser.Adds/updates tests to cover circuit-breaker localization and banner clearing on recovery, bumps
@metamask/ramps-controller/@metamask/messenger, and makes websocket server tests more reliable by using ephemeral ports and awaitinglistening/error events.Reviewed by Cursor Bugbot for commit bcfc471. Bugbot is set up for automated code reviews on this repo. Configure here.