feat: sync V2 ramps orders with Backup & Sync - #33148
georgeweiler wants to merge 12 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. |
b129eca to
e8da86c
Compare
🧪 Flaky unit test detectionRun history flaky detectionHistorical failure rate is a hint, not proof — review each suggestion in context. See the flaky-test-detection skill for the full pattern reference and manual audit workflow. Failures / runs sampled per window:
AI-detected flaky patterns
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring alerts on:
|
|
@SocketSecurity ignore npm/@metamask-previews/ramps-controller@20.0.0-preview-8c482076b Reviewed the preview package's order-sync feature: network access is expected because |
4355153 to
cc82603
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cc82603. Configure here.
0609d30 to
d83c18d
Compare
Wire RampsController order syncing into mobile: messenger delegation, Backup & Sync sub-toggle, identity-effect pull on unlock, and fixtures for isRampsSyncingEnabled. Depends on MetaMask/core#9474. Co-authored-by: Cursor <cursoragent@cursor.com>
Align selectIsRampsSyncingEnabled with UserStorageController default state so the Backup & Sync toggle and background sync gates stay consistent for upgraded profiles that omit isRampsSyncingEnabled. Co-authored-by: Cursor <cursoragent@cursor.com>
Treat placeholder tx hashes as missing so Activity falls back to the order id for row identity, and normalize string createdAt for sorting. Co-authored-by: Cursor <cursoragent@cursor.com>
…enger Order syncing resolves the entropy source before reading remote storage, so the action has to be delegated alongside the other User Storage actions. Co-authored-by: Cursor <cursoragent@cursor.com>
Switching between the DEV and PRD Profile Sync backends left incompatible persisted auth in place, so ramps order sync could never mint a fresh session. Clear it during AuthenticationController init instead. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop the unused listEntropySources delegation and keep canonical provider codes for order polling / deeplink redirects. Co-authored-by: Cursor <cursoragent@cursor.com>
Pass host trace and an order-sync error callback into RampsController so sync failures surface in analytics, and cover the Buy & sell orders toggle in the Backup & Sync view test and Appium page object. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Require the chain ID expected by ramps-controller v20 and mock the new ramps order storage read used during E2E startup. Co-authored-by: Cursor <cursoragent@cursor.com>
SmokeMoney buy flows push synced orders via PUT after completion; cover collection and entry writes like other Backup & Sync features. Co-authored-by: Cursor <cursoragent@cursor.com>
Order syncing is not in published ramps-controller yet, so point ramps-controller and profile-sync-controller at the core#9474 preview. Revert to published ranges once that work is released. Co-authored-by: Cursor <cursoragent@cursor.com>
…ypes Init passes partial persisted state, and UserProfile now carries canonicalProfileId, so widen the sanitizer signature and update the fixture. Co-authored-by: Cursor <cursoragent@cursor.com>
d83c18d to
6794410
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|
|
| Platform | Device | Reason | Recording |
|---|---|---|---|
| Android | Google Pixel 8 Pro (v14.0) | Quality gates exceeded | 📹 Watch |
🔬 App profiling check · Current run 32032827450 · Baseline (last run on main (scenario also failing)) run 30897750395 @ 67486d2
⚠️ No green baseline onmain— comparing against the latest usable profiling.
Summary:
ℹ️ API calls unavailable:
Network logs API error: Bad Request
Full metric table (+10% variance rules)
Disclaimer — allowed variance: a +10% margin over the baseline is permitted.
- If
Current <= Baseline + 10%, treated as acceptable noise.- If
Current > Baseline + 10%, Current and variance % are highlighted with⚠️ .
| Metric | Baseline | Current | Δ |
|---|---|---|---|
| CPU avg | 5.95% | 7.66% | +1.71 (+28.7%) |
| CPU max | 19.17% | 20.98% | +1.81 (+9.4%) |
| Memory avg | 586.2 MB | 699.74 MB | +113.54 (+19.4%) |
| Memory max | 722.61 MB | 827.15 MB | +104.54 (+14.5%) |
| Slow frames | 2.51% | 15.54% | +13.03 (+519.1%) |
| Frozen frames | 0% | 0% | 0 (0%) |
| ANRs | 0 | 0 | 0 (0%) |
| Issues | 2 | 2 | 0 (0%) |
| Critical issues | 1 | 1 | 0 (0%) |
| App size | 328.67 MB | 329.74 MB | +1.07 (+0.3%) |
@mm-perps-engineering-team
Perps open position and close it
| Platform | Device | Reason | Recording |
|---|---|---|---|
| Android | Google Pixel 8 Pro (v14.0) | no_performance_metrics | 📹 Watch |
🔬 App profiling check · Current run 32032827450 · Baseline (last run on main (scenario also failing)) run 30897750395 @ 67486d2
⚠️ No green baseline onmain— comparing against the latest usable profiling.
Summary:
ℹ️ API calls unavailable:
Network logs API error: Bad Request
Full metric table (+10% variance rules)
Disclaimer — allowed variance: a +10% margin over the baseline is permitted.
- If
Current <= Baseline + 10%, treated as acceptable noise.- If
Current > Baseline + 10%, Current and variance % are highlighted with⚠️ .
| Metric | Baseline | Current | Δ |
|---|---|---|---|
| CPU avg | 10.44% | 8.01% | -2.43 (-23.3%) |
| CPU max | 18.83% | 25.89% | +7.06 (+37.5%) |
| Memory avg | 555.64 MB | 836.35 MB | +280.71 (+50.5%) |
| Memory max | 609.03 MB | 1035.83 MB | +426.8 (+70.1%) |
| Slow frames | 5.16% | 9.89% | +4.73 (+91.7%) |
| Frozen frames | 0% | 0% | 0 (0%) |
| ANRs | 0 | 0 | 0 (0%) |
| Issues | 2 | 2 | 0 (0%) |
| Critical issues | 1 | 2 | +1 (+100%) |
| App size | 328.67 MB | 329.74 MB | +1.07 (+0.3%) |
✅ Passed Tests (20)
| Test | Platform | Device | Duration | Team | Recording |
|---|---|---|---|---|---|
| Asset View, SRP 1 + SRP 2 + SRP 3 | Android | Google Pixel 8 Pro (v14.0) | 3.17s | @assets-dev-team | 📹 Watch |
| Aggregated Balance Loading Time, SRP 1 + SRP 2 + SRP 3 | Android | Google Pixel 8 Pro (v14.0) | 8.46s | @assets-dev-team | 📹 Watch |
| Swap flow - ETH to LINK, SRP 1 + SRP 2 + SRP 3 | Android | Google Pixel 8 Pro (v14.0) | 1.12s | @swap-bridge-dev-team | 📹 Watch |
| Cross-chain swap flow - ETH to SOL - 50+ accounts, SRP 1 + SRP 2 + SRP 3 | Android | Google Pixel 8 Pro (v14.0) | 5.38s | @swap-bridge-dev-team | 📹 Watch |
| Import SRP with +50 accounts, SRP 1, SRP 2, SRP 3 | Android | Google Pixel 8 Pro (v14.0) | 4.00s | @Accounts-team | 📹 Watch |
| Cold Start: Measure ColdStart To Login Screen | Android | Google Pixel 8 Pro (v14.0) | 4.04s | @metamask-mobile-platform | 📹 Watch |
| Measure Warm Start: Login To Wallet Screen | Android | Google Pixel 8 Pro (v14.0) | 1.63s | @metamask-mobile-platform | 📹 Watch |
| Measure Warm Start: Warm Start to Login Screen | Android | Google Pixel 8 Pro (v14.0) | 0.20s | @metamask-mobile-platform | 📹 Watch |
| Perps add funds | Android | Google Pixel 8 Pro (v14.0) | 7.79s | @mm-perps-engineering-team | 📹 Watch |
| Predict Available Balance - Complete Flow Performance | Android | Google Pixel 8 Pro (v14.0) | 0.87s | @team-predict | 📹 Watch |
| Predict Market Details - Complete Flow Performance | Android | Google Pixel 8 Pro (v14.0) | 2.93s | @team-predict | 📹 Watch |
| Predict Deposit - Complete Flow Performance | Android | Google Pixel 8 Pro (v14.0) | 10.26s | @team-predict | 📹 Watch |
| Measure Cold Start To Onboarding Screen | Android | Google Pixel 8 Pro (v14.0) | 3.22s | @metamask-mobile-platform | 📹 Watch |
| Onboarding Import SRP with +50 accounts, SRP 3 | Android | Google Pixel 8 Pro (v14.0) | 4.64s | @metamask-onboarding-team | 📹 Watch |
| Money Home after fresh wallet creation with empty balance | Android | Google Pixel 8 Pro (v14.0) | 2.82s | @mm-earn-team | 📹 Watch |
| Money Home after importing SRP with funded balance | Android | Google Pixel 8 Pro (v14.0) | 4.09s | @mm-earn-team | 📹 Watch |
| Account creation after fresh install | Android | Google Pixel 8 Pro (v14.0) | 2.49s | @metamask-onboarding-team | 📹 Watch |
| Seedless Onboarding: Apple Login New User | Android | Google Pixel 8 Pro (v14.0) | 5.07s | @metamask-onboarding-team | 📹 Watch |
| Seedless Onboarding: Google Login New User | Android | Google Pixel 8 Pro (v14.0) | 4.58s | @metamask-onboarding-team | 📹 Watch |
| Seedless Onboarding: Telegram Login New User | Android | Google Pixel 8 Pro (v14.0) | 5.23s | @metamask-onboarding-team | 📹 Watch |
Branch: feat/ramps-order-syncing · Build: E2E · Commit: efd524d · View full run




Description
Syncs V2 buy/sell order history through Backup & Sync so orders created on Mobile can appear on other Mobile devices, Extension, and Portfolio for the same SRP/Profile Sync profile. It adds the Buy & sell orders setting, runs order sync after unlock when all identity and privacy gates are enabled, and keeps Activity rows distinct when providers reuse placeholder transaction hashes.
Missing ramps-sync toggle values on upgraded wallets default to enabled, matching new installs.
Companion PRs:
Implementation notes:
RampsController.syncOrdersWithUserStorage()fromuseIdentityEffectsafter unlock.txHashis missing orDUMMY_TX_ID, and normalizescreatedAtfor Activity sorting.Changelog
CHANGELOG entry: Added Backup & Sync support for buy and sell order history
Related issues
Refs: MetaMask/core#9474
Manual testing steps
Automated coverage includes order-sync gating, controller messenger wiring, Activity adapter fallback IDs, settings UI, and controller initialization.
Screenshots/Recordings
N/A — the change adds another row using the existing Backup & Sync settings-toggle component and does not introduce a new layout or interaction pattern.
Pre-merge author checklist
Performance checks (if applicable)
The performance items were assessed as not applicable to this profile-sync integration; CI performance checks remain non-blocking.
Pre-merge reviewer checklist
Note
Medium Risk
Touches Backup & Sync / User Storage for financial order history and expands RampsController messenger permissions, with preview controller package pins until Core publishes.
Overview
Enables Backup & Sync for V2 buy/sell order history so Mobile orders can appear on other signed-in clients sharing the same profile.
Adds a Buy & sell orders toggle in Backup & Sync settings, a
useRampsOrderSyncinghook that callsRampsController.syncOrdersWithUserStorage()when identity/privacy gates pass, and wires that intouseIdentityEffects. MissingisRampsSyncingEnabledvalues default to enabled on upgrade.Delegates User Storage and auth messenger actions to
RampsController, tracks order-sync error situations, and requires a non-emptychainIdwhen registering precreated orders. Also treats placeholder hashes likeDUMMY_TX_IDas invalid Activity keys and normalizescreatedAttimestamps so synced orders stay distinct and sortable.Pins preview
@metamask/ramps-controller/@metamask/profile-sync-controllerbuilds until the companion Core release lands.Reviewed by Cursor Bugbot for commit 0609d30. Bugbot is set up for automated code reviews on this repo. Configure here.