Skip to content

feat: split request_source to distinguish SDKv1 from MWP#28697

Open
adonesky1 wants to merge 1 commit intomainfrom
feat/split-request-source-sdkv1-mwp
Open

feat: split request_source to distinguish SDKv1 from MWP#28697
adonesky1 wants to merge 1 commit intomainfrom
feat/split-request-source-sdkv1-mwp

Conversation

@adonesky1
Copy link
Copy Markdown
Contributor

@adonesky1 adonesky1 commented Apr 10, 2026

Summary

Both SDKv1 (socket relay) and MWP/SDKv2 connections produced the same request_source value (MetaMask-SDK-Remote-Conn) on RPC pipeline events (Transaction Added, Signature Requested, etc.), making them indistinguishable in analytics.

Adds a transport field (socket_relay | mwp) to the analytics param passed to getRpcMethodMiddleware and branches getSource() on it:

  • SDKv1: MetaMask-SDK-Remote-Conn (unchanged — preserves data continuity)
  • MWP/V2: MetaMask-Connect (new)

Related

Test plan

  • Connect via SDKv1 → trigger a signature or transaction → verify request_source is MetaMask-SDK-Remote-Conn
  • Connect via MWP/V2 → trigger a signature or transaction → verify request_source is MetaMask-Connect
  • WalletConnect and in-app browser request_source values unchanged

Note

Medium Risk
Touches the central RPC middleware metadata path; while behavior changes are limited to analytics request_source labeling, any unexpected transport values could misclassify remote-connection events in downstream analytics.

Overview
Updates RPC analytics tagging to split remote-connection request_source by transport. SDKv1 (socket relay) continues emitting MetaMask-SDK-Remote-Conn, while MWP/SDKv2 now emits the new MetaMask-Connect constant via a newly passed analytics.transport field.

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

Previously both SDKv1 (socket relay) and MWP/SDKv2 connections produced
the same request_source value 'MetaMask-SDK-Remote-Conn' on RPC pipeline
events (Transaction Added, Signature Requested, etc.), making them
indistinguishable in analytics.

Adds a transport field ('socket_relay' | 'mwp') to the analytics param
passed to getRpcMethodMiddleware, and branches getSource() on it:
- SDKv1: 'MetaMask-SDK-Remote-Conn' (unchanged, preserves data continuity)
- MWP/V2: 'MetaMask-Connect' (new)

Relates to WAPI-1398.
@adonesky1 adonesky1 requested a review from a team as a code owner April 10, 2026 23:04
@github-actions
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.

@metamaskbot metamaskbot added the team-wallet-integrations Wallet Integrations team label Apr 10, 2026
@github-actions github-actions bot added size-S risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmations, SmokeNetworkExpansion, SmokeNetworkAbstractions, SmokeMultiChainAPI, SmokeWalletPlatform, FlaskBuildTests
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:

The PR introduces transport-type differentiation in the RPC middleware analytics tracking layer:

  1. AppConstants.ts: Adds a new MM_CONNECT request source constant for the MetaMask Wallet Protocol (MWP) transport.

  2. RPCMethodMiddleware.ts: The getSource() function now checks analytics.transport === 'mwp' to return MM_CONNECT vs SDK_REMOTE_CONN. This function is called in 9 places within the middleware for all RPC method calls (eth_sendTransaction, personal_sign, eth_signTypedData, wallet_switchEthereumChain, etc.).

  3. getDefaultBridgeParams.ts & setupBridge.ts: Legacy SDK (socket relay) connections now explicitly set transport: 'socket_relay' in analytics.

  4. rpc-bridge-adapter.ts (SDKConnectV2): The new MWP protocol path sets transport: 'mwp' in analytics, which triggers the new MM_CONNECT source in RPCMethodMiddleware.

Why these tags:

  • SmokeConfirmations: RPCMethodMiddleware handles all transaction and signature confirmations from dApps. The getSource() change affects request_source tracking for sendTransaction, personal_sign, eth_signTypedData, etc.
  • SmokeNetworkExpansion: Tests dApp connect/disconnect flows and multi-chain provider - directly uses the SDK connection paths modified here.
  • SmokeNetworkAbstractions: Tests chain permission system for dApps - uses RPCMethodMiddleware for wallet_switchEthereumChain and chain permission RPC calls.
  • SmokeMultiChainAPI: Tests CAIP-25 session API - dApp sessions go through the RPC middleware layer.
  • SmokeWalletPlatform: Tests EVM provider event handling for dApp communication (accountsChanged, chainChanged) which flows through RPCMethodMiddleware.
  • FlaskBuildTests: Snap Ethereum provider access (eth_chainId, eth_accounts, personal_sign, eth_signTypedData_v4, wallet_switchEthereumChain) all go through RPCMethodMiddleware.

The changes are primarily analytics/tracking changes and don't alter core RPC logic, but since RPCMethodMiddleware is a critical shared component for all dApp interactions, running dApp-related test suites is prudent to ensure no regressions.

Performance Test Selection:
The changes are limited to analytics tracking differentiation (transport type) in the RPC middleware and SDK connection setup. These are not UI rendering changes, don't affect data loading patterns, don't touch account/network list components, and don't impact app startup or initialization. No performance impact is expected from adding a transport field to analytics objects and updating a conditional in getSource().

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
17 value mismatches detected (expected — fixture represents an existing user).
View details

@wenfix wenfix added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Apr 13, 2026
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed risk-medium Moderate testing recommended · Possible bug introduction risk size-S team-wallet-integrations Wallet Integrations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants