Skip to content

feat(rewards): open referral invites from deep links - #47665

Merged
davidmurdoch merged 4 commits into
mainfrom
david/money-referral-deeplinks
Nov 12, 2026
Merged

davidmurdoch merged 4 commits into
mainfrom
david/money-referral-deeplinks

Conversation

@davidmurdoch

@davidmurdoch davidmurdoch commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Open the existing referral invite sheet over the intended destination when an internal deep link includes a single valid ref. This also handles deferred links after onboarding, while preserving the sheet's existing eligibility checks and interaction events.

Carry the code in a temporary document query parameter, then move it into UI state before any routed screen mounts. Continue links remain ordinary anchors, so opening a new tab and copying the URL still work. Signed route parameters and security interstitial decisions keep their existing behavior.

Share referral-code validation with the invite input and include referral_code as a regular property on Deep Link Used.

Validation after updating main:

  • 161 tests passed across 11 focused suites.
  • CI follow-up: both RootLayout tests and all four dedicated ReferralInvite tests pass after isolating the invite in the layout fixture. The two layout failures were reproduced before the fix.
  • Changed-file lint, full TypeScript checking, JSON fixture formatting, and circular dependency checks passed.
  • Resolved the root-layout merge conflict and updated the state-log fixture for pendingReferralCode.
  • Existing visual captures are below. Live-service and install/onboarding verification remain pending.

Changelog

CHANGELOG entry: Added referral invitations to deep links, including links restored after onboarding.

Related issues

Related: #47622

Manual testing steps

  1. Enable Basic Functionality and the Money rewards feature flag. Using an eligible test wallet and a valid test referral code, open https://link.metamask.io/money?ref=CODE. Complete any interstitial or unlock step. Verify the intended screen appears with the invite prefilled and the temporary document-level ref disappears from the URL.
  2. From an interstitial, open Continue in a new tab and copy/paste its URL into another tab. Verify both preserve the invite code and destination.
  3. Decline or dismiss the invite and verify the destination remains usable. Repeat and accept a valid offer. Check Rewards Money Referral Offer Interacted events across both screens and Deep Link Used with a regular referral_code property.
  4. Repeat with an already-joined or ineligible wallet and verify the existing eligibility checks skip the invite. Verify malformed or duplicate ref values do not open it.
  5. Follow a referral deep link through install and onboarding. Verify the invite appears over the intended destination after onboarding, unlock, and any interstitial. Verify it does not appear on those prerequisite screens.

Screenshots/Recordings

Captured using yarn mm and an isolated test wallet. This PR's captures use 013e6a0; the explicitly labeled after-comparison uses 7fe9521 from #47682. Referral responses, eligibility/region state, and offer copy are mocked; cashback rates and dates are illustrative. These captures demonstrate the home and Money destination UI flows, not live backend registration or install/onboarding. The standalone Money-page referral recording uses a returning-user state with the Money introduction already dismissed. The comparison below instead shows a first Money visit with both dialogs opening together.

Recordings

First-visit sheet-priority comparison

Known limitation in this PR. When the Money introduction and referral invite open together, their ordering can depend on mount timing and dismissal events can reach both dialogs. The fix is separate in the stacked #47682; the after-recording is comparison evidence, not behavior included in this PR.

Before: this PR, #47665 (013e6a0). On a first Money visit, both dialogs mount. In this recording, the Money introduction covers the referral invite, and pressing Escape dismisses both dialogs instead of just the top one.

05-sheet-priority-before-47665.webm

After: companion #47682 (7fe9521). In the same first-visit scenario, the referral stays above the Money introduction and keeps code-input focus. Escape closes only the referral; the Money introduction remains open until separately dismissed.

06-sheet-priority-after-47682.webm

Referral flows in this PR

Money-page referral flow (returning user). Follow /money?ref=DEMO2026 through the security interstitial, review the prefilled invite over Money, accept it, and close the confirmation to remain on the Money page.

04-money-page-referral.webm

Accept an invite. Continue past the security interstitial, review the prefilled referral code, accept the invite, and close the cashback confirmation to return to the destination.

01-accept-referral.webm

Validation and rate-limit feedback. Enter a rejected code, correct it, encounter a mocked rate-limit response, and choose Not now to return to the destination.

02-validation-and-rate-limit.webm

Dismiss an invite. Close the invite without accepting it; the destination remains available.

03-dismiss-referral.webm

Screenshots

Open and accept an invite

Security interstitial. The unsigned referral link still shows the third-party warning before Continue.

Security interstitial with the third-party warning and Continue link

Prefilled invite. The referral code is carried to the home destination and prefilled in the invite sheet.

Referral invite sheet over the home destination with DEMO2026 prefilled

Acceptance confirmation. A successful mocked registration opens the cashback-activated confirmation with sample offer dates.

Cashback activation confirmation after accepting the test referral invite

Destination after acceptance. Closing the confirmation leaves the home screen usable without the invite.

Home destination after closing the referral acceptance confirmation
Code validation and rate limiting

Rejected referral code. An invalid-code response shows inline feedback and disables Accept invite.

Referral invite with invalid-code feedback and Accept invite disabled

Corrected referral code. Replacing the rejected code with a valid one clears the error and enables Accept invite again.

Corrected referral code with the error cleared and Accept invite enabled

Rate-limited acceptance. A mocked HTTP 429 response shows retry feedback and temporarily disables acceptance.

Referral invite showing rate-limit feedback with acceptance temporarily disabled
Decline or dismiss without blocking the destination

Decline with Not now. Declining closes the invite and returns to the existing destination.

Home destination after declining the referral invite with Not now

Before dismissal. The invite remains dismissible through its close button.

Open referral invite before dismissal with its close button available

After dismissal. Closing the invite leaves the home screen unobstructed and usable.

Unobstructed home destination after dismissing the referral invite
Conditions that skip the invite

Already joined. A mocked profile with the REFEREE role skips the invite and keeps the destination visible.

Home destination without an invite for an already-joined test profile

Restricted region. A mocked excluded-country state skips the invite rather than blocking the destination.

Home destination without an invite for a restricted-region test profile

Malformed referral parameter. A link containing ref=bad! reaches the destination without opening an invite.

Home destination without an invite after a link containing a malformed referral code

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Changes deep-link routing, startup URL handling, and onboarding completion navigation; security interstitial rules are preserved but referral metadata now flows through those paths.

Overview
Adds end-to-end support for Money referral codes on internal deep links via a validated ref query param.

Deep links normalize and attach ref with withReferralCode on direct extension destinations (router and interstitial Continue links) while keeping existing interstitial/security behavior. Deep Link Used analytics gain referral_code; malformed or duplicate ref values are dropped.

UI startup reads the temporary document ?ref=, stores it as pendingReferralCode in Redux (consumeReferralCode on boot), and ReferralInvite in root layout opens the existing AcceptInviteSheet over the destination when rewards are enabled. Deferred links after onboarding set the same pending code. Referral input normalization moves to shared money-referral-code helpers.

Reviewed by Cursor Bugbot for commit 9c5f618. Bugbot is set up for automated code reviews on this repo. Configure here.

@davidmurdoch davidmurdoch added the team-extension-platform Extension Platform team label Nov 5, 2026
@davidmurdoch davidmurdoch self-assigned this Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the size-M label Nov 5, 2026
@metamask-ci

metamask-ci Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

✨ Files requiring CODEOWNER review ✨

🕵️ @MetaMask/extension-privacy-reviewers (1 files, +1 -0)
  • 📁 test/
    • 📁 e2e/
      • 📁 tests/
        • 📁 settings/
          • 📄 state-logs.json +1 -0

🧪 @MetaMask/qa (1 files, +1 -0)
  • 📁 test/
    • 📁 e2e/
      • 📁 tests/
        • 📁 settings/
          • 📄 state-logs.json +1 -0

🔐 @MetaMask/web3auth (2 files, +16 -4)
  • 📁 ui/
    • 📁 pages/
      • 📁 onboarding-flow/
        • 📁 hooks/
          • 📄 useOnboardingCompletion.test.ts +7 -3
          • 📄 useOnboardingCompletion.ts +9 -1

@metamask-ci

metamask-ci Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor
Builds ready [013e6a0]
⚡ Performance Benchmarks (Total: 🟢 8 pass · 🟡 3 warn · 🔴 2 fail)

Baseline (latest main): f693520 | Date: 11/3/2026 | Pipeline: 42091723847 | Baseline logs

Metricschrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 load_new_account(p95) [CI log]🔴 load_new_account(p95) [CI log]

Regressions (🔴 2 failures)

Interaction Benchmarks · Samples: 5 🔴 2
Benchmarkchrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 [CI log]
🔴 load_new_account
🔴 [CI log]
🔴 load_new_account
confirmTx
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]
bridgeUserActions
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↑ loadNewAccount/load_new_account: +180%
  • ↑ loadNewAccount/total: +180%
  • ↓ loadNewAccount/inp: -10%
  • ↓ loadNewAccount/fcp: -31%
  • ↑ loadNewAccount/lcp: +580%
  • ↑ loadNewAccount/cls: +294%
  • ↓ confirmTx/tbt: -13%
  • ↓ confirmTx/inp: -52%
  • ↓ confirmTx/fcp: -31%
  • ↑ confirmTx/lcp: +592%
  • ↑ bridgeUserActions/bridge_load_page: +22%
  • ↓ bridgeUserActions/bridge_load_asset_picker: -11%
  • ↓ bridgeUserActions/longTaskTotalDuration: -26%
  • ↓ bridgeUserActions/longTaskMaxDuration: -32%
  • ↓ bridgeUserActions/tbt: -51%
  • ↓ bridgeUserActions/inp: -26%
  • ↓ bridgeUserActions/fcp: -34%
  • ↑ bridgeUserActions/lcp: +556%
  • ↑ bridgeUserActions/cls: +636%
  • ↑ loadNewAccount/load_new_account: +182%
  • ↑ loadNewAccount/total: +182%
  • ↑ loadNewAccount/fcp: +12%
  • ↑ loadNewAccount/lcp: +1288%
  • ↓ confirmTx/longTaskCount: -100%
  • ↓ confirmTx/longTaskTotalDuration: -100%
  • ↓ confirmTx/longTaskMaxDuration: -100%
  • ↓ confirmTx/tbt: -100%
  • ↓ confirmTx/inp: -13%
  • ↓ confirmTx/fcp: -38%
  • ↑ confirmTx/lcp: +1293%
  • ↑ bridgeUserActions/bridge_load_page: +255%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +145%
  • ↓ bridgeUserActions/longTaskCount: -100%
  • ↓ bridgeUserActions/longTaskTotalDuration: -100%
  • ↓ bridgeUserActions/longTaskMaxDuration: -100%
  • ↓ bridgeUserActions/tbt: -100%
  • ↑ bridgeUserActions/total: +38%
  • ↑ bridgeUserActions/inp: +54%
  • ↑ bridgeUserActions/fcp: +14%
  • ↑ bridgeUserActions/lcp: +1244%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 1.9s
  • 🟡 bridgeUserActions/FCP: p75 2.0s
Startup Benchmarks · Samples: 100
Benchmarkchrome-webpackfirefox-webpack
startupStandardHome
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
🟡 loadScripts

📈 Results compared to the previous 5 runs on main

  • ↑ startupStandardHome/uiStartup: +84%
  • ↑ startupStandardHome/load: +118%
  • ↑ startupStandardHome/domContentLoaded: +119%
  • ↑ startupStandardHome/domInteractive: +23%
  • ↓ startupStandardHome/firstPaint: -53%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -29%
  • ↑ startupStandardHome/loadScripts: +117%
  • ↑ startupStandardHome/setupStore: +134%
  • ↑ startupStandardHome/longTaskCount: +43%
  • ↑ startupStandardHome/longTaskTotalDuration: +116%
  • ↑ startupStandardHome/longTaskMaxDuration: +129%
  • ↑ startupStandardHome/tbt: +139%
  • ↓ startupStandardHome/inp: -11%
  • ↓ startupStandardHome/fcp: -50%
  • ↑ startupStandardHome/lcp: +126%
  • ↓ startupStandardHome/cls: -72%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -50%
  • ↑ startupStandardHome/fcp: +20%
User Journey Benchmarks · Samples: 5 · mock API
Benchmarkchrome-webpackfirefox-webpack
onboardingImportWallet
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
🟡 total
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↑ onboardingImportWallet/srpButtonToSrpForm: +10%
  • ↑ onboardingImportWallet/confirmSrpToPwForm: +20%
  • ↑ onboardingImportWallet/pwFormToMetricsScreen: +30%
  • ↑ onboardingImportWallet/metricsToWalletReadyScreen: +20%
  • ↓ onboardingImportWallet/doneButtonToHomeScreen: -91%
  • ↓ onboardingImportWallet/openAccountMenuToAccountListLoaded: -74%
  • ↓ onboardingImportWallet/longTaskCount: -100%
  • ↓ onboardingImportWallet/longTaskTotalDuration: -100%
  • ↓ onboardingImportWallet/longTaskMaxDuration: -100%
  • ↓ onboardingImportWallet/tbt: -100%
  • ↓ onboardingImportWallet/total: -85%
  • ↓ onboardingNewWallet/srpButtonToPwForm: -16%
  • ↓ onboardingNewWallet/agreeButtonToOnboardingSuccess: -17%
  • ↓ onboardingNewWallet/doneButtonToAssetList: -77%
  • ↓ onboardingNewWallet/longTaskCount: -62%
  • ↓ onboardingNewWallet/longTaskTotalDuration: -71%
  • ↓ onboardingNewWallet/longTaskMaxDuration: -31%
  • ↓ onboardingNewWallet/tbt: -100%
  • ↓ onboardingNewWallet/total: -74%
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-webpack
dappPageLoad
[Sentry log · main/release]
🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↓ dappPageLoad/pageLoadTime: -49%
  • ↓ dappPageLoad/firstPaint: -33%
  • ↓ dappPageLoad/firstContentfulPaint: -33%
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
Status Bundle Total Diff Change
🚨 background 15.26 MiB +7.47 KiB +0.05%
🚨 ui 19.42 MiB +28.19 KiB +0.14%
✅ common 0 Bytes 0 Bytes 0.00%
✅ other 4.44 MiB +444 Bytes +0.01%
✅ content scripts 3.23 MiB +888 Bytes +0.03%
🚨 unzipped 79.76 MiB +38.31 KiB +0.05%
🚨 zip 23.86 MiB +30.06 KiB +0.12%

@metamask-ci

metamask-ci Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor
Builds ready [adaad9c]
⚡ Performance Benchmarks (Total: 🟢 5 pass · 🟡 5 warn · 🔴 3 fail)

Baseline (latest main): f693520 | Date: 11/3/2026 | Pipeline: 43079996418 | Baseline logs

Metricschrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 load_new_account(p95) [CI log]🔴 load_new_account(p95) [CI log]
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]

Regressions (🔴 3 failures)

Interaction Benchmarks · Samples: 5 🔴 2
Benchmarkchrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 [CI log]
🔴 load_new_account
🔴 [CI log]
🔴 load_new_account
confirmTx
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]
bridgeUserActions
[Sentry log · main/release]
🟡 [CI log]🟡 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↑ loadNewAccount/load_new_account: +183%
  • ↑ loadNewAccount/total: +183%
  • ↓ loadNewAccount/inp: -10%
  • ↑ loadNewAccount/lcp: +974%
  • ↑ loadNewAccount/cls: +583%
  • ↑ confirmTx/longTaskCount: +100%
  • ↑ confirmTx/longTaskTotalDuration: +84%
  • ↑ confirmTx/longTaskMaxDuration: +52%
  • ↑ confirmTx/tbt: +81%
  • ↓ confirmTx/inp: -21%
  • ↑ confirmTx/lcp: +968%
  • ↑ bridgeUserActions/bridge_load_page: +70%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +57%
  • ↑ bridgeUserActions/tbt: +30%
  • ↑ bridgeUserActions/total: +14%
  • ↑ bridgeUserActions/lcp: +945%
  • ↑ bridgeUserActions/cls: +387%
  • ↑ loadNewAccount/load_new_account: +182%
  • ↑ loadNewAccount/total: +182%
  • ↓ loadNewAccount/inp: -25%
  • ↑ loadNewAccount/fcp: +16%
  • ↑ loadNewAccount/lcp: +1257%
  • ↓ confirmTx/longTaskCount: -100%
  • ↓ confirmTx/longTaskTotalDuration: -100%
  • ↓ confirmTx/longTaskMaxDuration: -100%
  • ↓ confirmTx/tbt: -100%
  • ↓ confirmTx/inp: -21%
  • ↓ confirmTx/fcp: -35%
  • ↑ confirmTx/lcp: +1304%
  • ↑ bridgeUserActions/bridge_load_page: +335%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +144%
  • ↑ bridgeUserActions/bridge_search_token: +14%
  • ↓ bridgeUserActions/longTaskCount: -100%
  • ↓ bridgeUserActions/longTaskTotalDuration: -100%
  • ↓ bridgeUserActions/longTaskMaxDuration: -100%
  • ↓ bridgeUserActions/tbt: -100%
  • ↑ bridgeUserActions/total: +88%
  • ↑ bridgeUserActions/inp: +62%
  • ↑ bridgeUserActions/fcp: +24%
  • ↑ bridgeUserActions/lcp: +1301%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 1.9s
  • 🟡 confirmTx/FCP: p75 1.8s
  • 🟡 bridgeUserActions/FCP: p75 1.8s
  • 🟡 loadNewAccount/FCP: p75 2.0s
  • 🟡 bridgeUserActions/FCP: p75 2.1s
Startup Benchmarks · Samples: 100
Benchmarkchrome-webpackfirefox-webpack
startupStandardHome
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
🟡 loadScripts

📈 Results compared to the previous 5 runs on main

  • ↑ startupStandardHome/uiStartup: +79%
  • ↑ startupStandardHome/load: +111%
  • ↑ startupStandardHome/domContentLoaded: +112%
  • ↑ startupStandardHome/domInteractive: +29%
  • ↓ startupStandardHome/firstPaint: -53%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -29%
  • ↑ startupStandardHome/loadScripts: +110%
  • ↑ startupStandardHome/setupStore: +121%
  • ↑ startupStandardHome/longTaskCount: +43%
  • ↑ startupStandardHome/longTaskTotalDuration: +110%
  • ↑ startupStandardHome/longTaskMaxDuration: +121%
  • ↑ startupStandardHome/tbt: +133%
  • ↓ startupStandardHome/fcp: -49%
  • ↑ startupStandardHome/lcp: +129%
  • ↓ startupStandardHome/cls: -72%
  • ↑ startupStandardHome/domInteractive: +13%
  • ↑ startupStandardHome/backgroundConnect: +14%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -50%
  • ↑ startupStandardHome/fcp: +16%
  • ↑ startupStandardHome/lcp: +10%
User Journey Benchmarks · Samples: 5 · mock API 🔴 1
Benchmarkchrome-webpackfirefox-webpack
onboardingImportWallet
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
🟡 total
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]
🔴 total

📈 Results compared to the previous 5 runs on main

  • ↑ onboardingImportWallet/srpButtonToSrpForm: +14%
  • ↑ onboardingImportWallet/confirmSrpToPwForm: +26%
  • ↑ onboardingImportWallet/pwFormToMetricsScreen: +34%
  • ↑ onboardingImportWallet/metricsToWalletReadyScreen: +10%
  • ↓ onboardingImportWallet/doneButtonToHomeScreen: -92%
  • ↓ onboardingImportWallet/openAccountMenuToAccountListLoaded: -73%
  • ↓ onboardingImportWallet/longTaskCount: -82%
  • ↓ onboardingImportWallet/longTaskTotalDuration: -94%
  • ↓ onboardingImportWallet/longTaskMaxDuration: -89%
  • ↓ onboardingImportWallet/tbt: -99%
  • ↓ onboardingImportWallet/total: -85%
  • ↑ onboardingNewWallet/createPwToRecoveryScreen: +30%
  • ↑ onboardingNewWallet/skipBackupToMetricsScreen: +17%
  • ↓ onboardingNewWallet/doneButtonToAssetList: -77%
  • ↓ onboardingNewWallet/longTaskCount: -62%
  • ↓ onboardingNewWallet/longTaskTotalDuration: -74%
  • ↓ onboardingNewWallet/longTaskMaxDuration: -38%
  • ↓ onboardingNewWallet/tbt: -100%
  • ↓ onboardingNewWallet/total: -73%
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-webpack
dappPageLoad
[Sentry log · main/release]
🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↓ dappPageLoad/pageLoadTime: -60%
  • ↓ dappPageLoad/domContentLoaded: -19%
  • ↓ dappPageLoad/firstPaint: -42%
  • ↓ dappPageLoad/firstContentfulPaint: -42%
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
Status Bundle Total Diff Change
🚨 background 15.22 MiB +1.33 KiB +0.01%
🚨 ui 19.52 MiB +27.31 KiB +0.14%
✅ common 0 Bytes 0 Bytes 0.00%
✅ other 4.46 MiB +102 Bytes 0.00%
✅ content scripts 3.22 MiB +204 Bytes +0.01%
🚨 unzipped 79.96 MiB +28.95 KiB +0.04%
🚨 zip 24.02 MiB +7.99 KiB +0.03%

@metamask-ci

metamask-ci Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor
Builds ready [8dfc210]
⚡ Performance Benchmarks (Total: 🟢 4 pass · 🟡 6 warn · 🔴 3 fail)

Baseline (latest main): f693520 | Date: 11/3/2026 | Pipeline: 43107061093 | Baseline logs

Metricschrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 load_new_account(p95) [CI log]🔴 load_new_account(p95) [CI log]
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]

Regressions (🔴 3 failures)

Interaction Benchmarks · Samples: 5 🔴 2
Benchmarkchrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 [CI log]
🔴 load_new_account
🔴 [CI log]
🔴 load_new_account
confirmTx
[Sentry log · main/release]
🟡 [CI log]🟡 [CI log]
bridgeUserActions
[Sentry log · main/release]
🟡 [CI log]🟡 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↑ loadNewAccount/load_new_account: +184%
  • ↑ loadNewAccount/total: +184%
  • ↓ loadNewAccount/inp: -10%
  • ↑ loadNewAccount/lcp: +968%
  • ↑ loadNewAccount/cls: +297%
  • ↑ confirmTx/longTaskCount: +67%
  • ↑ confirmTx/longTaskTotalDuration: +77%
  • ↑ confirmTx/longTaskMaxDuration: +60%
  • ↑ confirmTx/tbt: +88%
  • ↓ confirmTx/inp: -13%
  • ↑ confirmTx/lcp: +982%
  • ↑ bridgeUserActions/bridge_load_page: +90%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +72%
  • ↑ bridgeUserActions/tbt: +45%
  • ↑ bridgeUserActions/inp: +10%
  • ↑ bridgeUserActions/lcp: +986%
  • ↑ bridgeUserActions/cls: +387%
  • ↑ loadNewAccount/load_new_account: +182%
  • ↑ loadNewAccount/total: +182%
  • ↓ loadNewAccount/inp: -25%
  • ↑ loadNewAccount/fcp: +25%
  • ↑ loadNewAccount/lcp: +1307%
  • ↓ confirmTx/longTaskCount: -100%
  • ↓ confirmTx/longTaskTotalDuration: -100%
  • ↓ confirmTx/longTaskMaxDuration: -100%
  • ↓ confirmTx/tbt: -100%
  • ↓ confirmTx/inp: -13%
  • ↑ confirmTx/fcp: +23%
  • ↑ confirmTx/lcp: +1332%
  • ↑ bridgeUserActions/bridge_load_page: +164%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +123%
  • ↓ bridgeUserActions/longTaskCount: -100%
  • ↓ bridgeUserActions/longTaskTotalDuration: -100%
  • ↓ bridgeUserActions/longTaskMaxDuration: -100%
  • ↓ bridgeUserActions/tbt: -100%
  • ↑ bridgeUserActions/total: +28%
  • ↑ bridgeUserActions/inp: +69%
  • ↑ bridgeUserActions/fcp: +23%
  • ↑ bridgeUserActions/lcp: +1408%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 1.9s
  • 🟡 confirmTx/FCP: p75 1.9s
  • 🟡 bridgeUserActions/FCP: p75 1.9s
  • 🟡 loadNewAccount/FCP: p75 2.2s
  • 🟡 confirmTx/FCP: p75 2.1s
  • 🟡 bridgeUserActions/FCP: p75 2.1s
  • 🟡 bridgeUserActions/LCP: p75 2.6s
Startup Benchmarks · Samples: 100
Benchmarkchrome-webpackfirefox-webpack
startupStandardHome
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
🟡 loadScripts

📈 Results compared to the previous 5 runs on main

  • ↑ startupStandardHome/uiStartup: +93%
  • ↑ startupStandardHome/load: +129%
  • ↑ startupStandardHome/domContentLoaded: +130%
  • ↑ startupStandardHome/domInteractive: +25%
  • ↓ startupStandardHome/firstPaint: -53%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -29%
  • ↑ startupStandardHome/loadScripts: +128%
  • ↑ startupStandardHome/setupStore: +134%
  • ↑ startupStandardHome/longTaskCount: +79%
  • ↑ startupStandardHome/longTaskTotalDuration: +128%
  • ↑ startupStandardHome/longTaskMaxDuration: +141%
  • ↑ startupStandardHome/tbt: +153%
  • ↓ startupStandardHome/fcp: -50%
  • ↑ startupStandardHome/lcp: +124%
  • ↓ startupStandardHome/cls: -72%
  • ↑ startupStandardHome/domInteractive: +26%
  • ↑ startupStandardHome/backgroundConnect: +12%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -50%
  • ↑ startupStandardHome/fcp: +23%
  • ↑ startupStandardHome/lcp: +12%
User Journey Benchmarks · Samples: 5 · mock API 🔴 1
Benchmarkchrome-webpackfirefox-webpack
onboardingImportWallet
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
🟡 total
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]
🔴 total

📈 Results compared to the previous 5 runs on main

  • ↑ onboardingImportWallet/srpButtonToSrpForm: +15%
  • ↑ onboardingImportWallet/confirmSrpToPwForm: +29%
  • ↑ onboardingImportWallet/pwFormToMetricsScreen: +38%
  • ↑ onboardingImportWallet/metricsToWalletReadyScreen: +21%
  • ↓ onboardingImportWallet/doneButtonToHomeScreen: -91%
  • ↓ onboardingImportWallet/openAccountMenuToAccountListLoaded: -74%
  • ↓ onboardingImportWallet/longTaskCount: -100%
  • ↓ onboardingImportWallet/longTaskTotalDuration: -100%
  • ↓ onboardingImportWallet/longTaskMaxDuration: -100%
  • ↓ onboardingImportWallet/tbt: -100%
  • ↓ onboardingImportWallet/total: -85%
  • ↑ onboardingNewWallet/srpButtonToPwForm: +15%
  • ↑ onboardingNewWallet/createPwToRecoveryScreen: +42%
  • ↑ onboardingNewWallet/skipBackupToMetricsScreen: +12%
  • ↑ onboardingNewWallet/agreeButtonToOnboardingSuccess: +15%
  • ↓ onboardingNewWallet/doneButtonToAssetList: -72%
  • ↓ onboardingNewWallet/longTaskCount: -23%
  • ↓ onboardingNewWallet/longTaskTotalDuration: -100%
  • ↓ onboardingNewWallet/longTaskMaxDuration: -100%
  • ↓ onboardingNewWallet/tbt: -100%
  • ↓ onboardingNewWallet/total: -67%
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-webpack
dappPageLoad
[Sentry log · main/release]
🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↓ dappPageLoad/pageLoadTime: -49%
  • ↓ dappPageLoad/firstPaint: -33%
  • ↓ dappPageLoad/firstContentfulPaint: -33%
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
Status Bundle Total Diff Change
✅ background 15.22 MiB -1.02 KiB -0.01%
🚨 ui 19.53 MiB +31.18 KiB +0.16%
✅ common 0 Bytes 0 Bytes 0.00%
✅ other 4.46 MiB +265 Bytes +0.01%
✅ content scripts 3.22 MiB +530 Bytes +0.02%
🚨 unzipped 79.96 MiB +29.84 KiB +0.04%
🚨 zip 24.02 MiB +8.77 KiB +0.04%

@davidmurdoch
davidmurdoch marked this pull request as ready for review November 11, 2026 22:47
@davidmurdoch
davidmurdoch requested review from a team as code owners November 11, 2026 22:47
sophieqgu
sophieqgu previously approved these changes Nov 11, 2026
LabinatorSolutions pushed a commit to LabinatorSolutions/metamask-extension that referenced this pull request Nov 12, 2026
## **Description**

Closing a referral invite while Accept is pending can submit
registration after the sheet unmounts or record dismissal before a
successful acceptance. Repeated Accept calls can also start duplicate
registrations.

Keep one Accept attempt active through validation, registration, and the
read-back. Disable editing and decline while it runs, ignore dismissal,
and prevent late work from submitting after validation or updating the
UI and analytics after unmount.

Validation: 51 tests passed across five related suites; changed-file
lint and circular dependency checks passed. The full project typecheck
reports errors in unchanged MCP, Discover, and perps files; none were
reported for the four changed files. Manual testing is pending.

## **Changelog**

CHANGELOG entry: Fixed referral invitations allowing dismissal or
duplicate submission while acceptance was pending.

## **Related issues**

Related: MetaMask#47622, MetaMask#47665. This fix is independent of referral deep-link
routing.

## **Manual testing steps**

1. Use a development build containing this fix and the referral entry
flow from MetaMask#47665. Enable Basic Functionality and Money rewards, then
open an invite with an eligible profile and a valid test code.
2. Throttle validation and registration requests. Press Accept, then try
editing the code, accepting again, declining, and closing the sheet.
Verify the sheet stays open, editing/Accept/Decline are disabled, and
only one registration is submitted.
3. Let registration finish. Verify the activation screen opens and the
offer records acceptance without an intervening dismissal. Repeat with
an API refusal and verify retry and dismissal become available
afterward.
4. Lock the wallet while validation or registration is pending. Let the
request settle and unlock. Verify validation does not start registration
after the invite unmounts and late callbacks do not reopen the
activation screen or emit offer interactions from the old sheet.

## **Screenshots/Recordings**

Not captured locally.

<!--
### **Before**

### **After**
-->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches referral registration and MetaMetrics interaction timing;
behavior is constrained by new guards and tests but still affects
rewards onboarding UX.
> 
> **Overview**
> Fixes a race where users could dismiss the money referral invite or
tap **Accept** again while validation, registration, or referral-me
read-back was still running—leading to duplicate registrations,
dismissal recorded before success, or analytics/UI updates after the
sheet unmounted.
> 
> `useAcceptMoneyReferralCode` now treats **`isAccepting` as true for
the whole flow** (not just registration), blocks overlapping `accept`
calls via `acceptingRef`, and **bails out of register, read-back,
`onAccepted`, and state updates** when the hook unmounts mid-flight.
`AcceptInviteSheet` **disables close, decline, code input, and dismiss
handlers** while accepting and **skips acceptance tracking** if the
component unmounted before the promise settles.
> 
> Hook and sheet tests add coverage for pending validation/registration,
post-unmount completion, and duplicate Accept.
**`useTokenInsightsData.test.ts`** only adjusts Redux selector
mocking/assertion ordering (no product change).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
ce0a9b9. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@sonarqubecloud

Copy link
Copy Markdown

oliverboehm-xgr pushed a commit to oliverboehm-xgr/metamask-extension that referenced this pull request Nov 12, 2026
## **Description**

Opening an internal deep link before wallet onboarding is complete loses
the intended destination and finishes on Home. Retain the internal route
in the existing UI state before redirecting to onboarding, then resume
and clear it when setup finishes.

The latest saved direct destination in the current UI session takes
precedence over the install-time deferred destination. Preserve its
query and fragment, and keep it in that UI when the side panel is
enabled. No cross-tab synchronization is added. The social-import unlock
path also retains its saved direct destination.

Keep install attribution and the deferred `DeepLinkUsed` event,
including attribution and campaign parameters, even when a later direct
link supplies the action. Without a saved direct destination, deferred
navigation and its required interstitial remain the fallback. A saved
direct destination also supersedes a pending deferred interstitial; the
requester identified themselves as the Extension Security team and
approved this behavior in the implementation conversation.

Validly signed direct links also skip the interstitial while local
onboarding state is explicitly incomplete, matching the existing
behavior for signed deferred links. Unsigned or invalidly signed links
and links received after onboarding retain the existing policy. The
requester identified themselves as a member of Extension Security and
explicitly approved this pre-onboarding exception in the implementation
conversation, clarifying that it applies only to valid signatures in
both flows.

Validation: 94 tests passed across five onboarding, routing, and unlock
suites; full TypeScript checking, changed-file lint, and circular
dependency checks passed. Both social-import completion-failure
regression cases failed before the retry fix and passed afterward;
automatic completion retry is also covered. Earlier signed-link
onboarding regressions remain covered. Manual testing is pending.

## **Changelog**

CHANGELOG entry: Fixed direct deep-link destinations being lost during
onboarding and removed the extra pre-onboarding warning for validly
signed links.

## **Related issues**

Fixes MetaMask#47667

Jira:
[MWPE-805](https://consensyssoftware.atlassian.net/browse/MWPE-805)

Related: MetaMask#47665. This fix does not depend on referral functionality.

## **Manual testing steps**

1. In a fresh extension profile, leave onboarding incomplete and open
`https://link.metamask.io/privacy`. Continue through the existing
security warning, then finish wallet setup. Verify Privacy & Security
opens at the MetaMetrics section instead of Home.
2. Start with an install-time deferred link containing attribution and
campaign parameters. Before finishing onboarding, open a different
direct destination in the same UI. Complete setup and verify the later
destination opens. With metrics enabled, verify install attribution and
the deferred `DeepLinkUsed` event retain the original link's attribution
and campaign parameters.
3. Repeat with a deferred link that would require an interstitial.
Verify the later direct destination supersedes that deferred action, and
the direct link's own security warning still appears when required.
4. Repeat with the side-panel experience enabled. Verify the later
destination opens in the UI that received it. Ordinary onboarding
without a direct destination keeps its usual side-panel behavior.
5. Repeat through social import, including unlock/rehydration, and
verify the saved direct destination is retained. For a supported link
with product parameters, verify its query and scroll fragment survive
setup.
6. Open another direct destination in the same UI before completion and
verify the last one is used. Completing onboarding in a separate UI does
not inherit that destination. If completion fails, retry and verify the
destination remains available.
7. Repeat the install-attribution deferred-link flow without a later
direct destination. Verify its destination and any required security
warning remain the fallback.

8. With the interstitial opt-out disabled, open a validly signed direct
link before onboarding is complete. Verify setup opens without a
security warning and resumes the destination afterward. Repeat after
onboarding and verify the normal warning appears. Repeat with unsigned
and invalidly signed links before onboarding and verify the existing
warning behavior remains.

## **Screenshots/Recordings**

Not captured locally.

<!--
### **Before**

### **After**
-->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.


[MWPE-805]:
https://consensyssoftware.atlassian.net/browse/MWPE-805?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes onboarding navigation, deep-link interstitial policy, and
security-boundary logic for signed links before onboarding completes;
mistakes could mis-route users or weaken warnings.
> 
> **Overview**
> Fixes **direct deep links being dropped** when the wallet is still
onboarding by introducing session-scoped **`onboardingRedirect`** UI
state. `RequireAuthenticated` saves the full internal path (query/hash)
before sending users to onboarding; completion paths in
**`useOnboardingCompletion`**, **`onboarding-flow`**, and
unlock/social-import flows **resume that route** and clear it, with the
saved direct destination **beating** install-time deferred deep links
while still emitting deferred **DeepLinkUsed** attribution.
> 
> The deep-link **security policy** now consults
**`completedOnboarding`**: **valid signed** intercepted links skip the
interstitial only while onboarding is explicitly incomplete;
unsigned/invalid links and post-onboarding behavior stay unchanged. The
router lazily reads controller state once per intercept for this check.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
c153a3b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

@seaona seaona left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e2e file LGTM

@davidmurdoch
davidmurdoch enabled stacked auto-merge November 12, 2026 16:13
@davidmurdoch
davidmurdoch disabled stacked auto-merge November 12, 2026 18:03
@davidmurdoch
davidmurdoch removed this pull request from stack #47853 November 12, 2026 18:03
@davidmurdoch
davidmurdoch removed this pull request from stack #47894 November 12, 2026 18:04
@davidmurdoch
davidmurdoch enabled stacked auto-merge November 12, 2026 18:04
@davidmurdoch
davidmurdoch disabled stacked auto-merge November 12, 2026 18:10
@davidmurdoch
davidmurdoch enabled stacked auto-merge November 12, 2026 18:10
stacked auto-merge was automatically disabled November 12, 2026 18:45

Replaced by a newer auto-merge request

@davidmurdoch
davidmurdoch enabled stacked auto-merge November 12, 2026 18:45
stacked auto-merge was automatically disabled November 12, 2026 18:45

Auto-merge was disabled for another pull request in the stack

@davidmurdoch
davidmurdoch enabled stacked auto-merge November 12, 2026 18:45

@Gudahtt Gudahtt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State log changes LGTM!

@davidmurdoch
davidmurdoch added this pull request to the merge queue Nov 12, 2026
* @returns The normalized code, or null when absent or invalid.
*/
export function getReferralCode(params: URLSearchParams): string | null {
const values = params.getAll('ref');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a referral code appended to a link MetaMask signed with a sig_params list that leaves out ref would still verify, and the invite would open prefilled with that code. If I'm reading the policy right, there'd be no interstitial when the user skips it or hasn't finished onboarding, and otherwise it reads "Redirecting to MetaMask".

Would it make sense to have getReferralCode skip ref when the link's sig_params doesn't list it? Something like:

Suggested change
const values = params.getAll('ref');
const signedParams = params.get('sig_params');
const values =
signedParams === null || signedParams.split(',').includes('ref')
? params.getAll('ref')
: [];

Merged via the queue into main with commit 6870129 Nov 12, 2026
140 checks passed
@davidmurdoch
davidmurdoch deleted the david/money-referral-deeplinks branch November 12, 2026 19:29
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 12, 2026
@metamaskbot metamaskbot added the release-13.58.0 Issue or pull request that will be included in release 13.58.0 label Nov 16, 2026

This branch was previously deployed

1 inactive deployment
pr-comment — 9c5f6182 Deployed Nov 12, 2026 by baptiste-marchand via Publish prerelease / Publish prerelease #174250
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.58.0 Issue or pull request that will be included in release 13.58.0 size-M team-extension-platform Extension Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants