Skip to content

chore(analytics): remove saveDataRecording field/method from AnalyticsEventBuilder and sweep all mocks#31257

Draft
NicolasMassart wants to merge 3 commits into
analytics/pr8-deletionfrom
analytics/pr9-safedata-removal
Draft

chore(analytics): remove saveDataRecording field/method from AnalyticsEventBuilder and sweep all mocks#31257
NicolasMassart wants to merge 3 commits into
analytics/pr8-deletionfrom
analytics/pr9-safedata-removal

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

Removes the saveDataRecording field from AnalyticsTrackingEvent/ITrackingEvent and the setSaveDataRecording method from AnalyticsEventBuilderInterface. This field was introduced to mirror the legacy MetricsEventBuilder API but was never actually used at runtime — the data-recording chain has been removed in #31256.

⚠️ Merge order: This PR targets analytics/pr8-deletion and must be merged after #31256. Once #31256 lands on main, this PR will be retargeted to main.

Changes:

  • AnalyticsEventBuilder.ts — removes saveDataRecording from AnalyticsTrackingEvent interface and setSaveDataRecording from the builder
  • analytics.types.ts — removes saveDataRecording from ITrackingEvent; updates isTrackingEvent guard to use name-based check
  • Controller inits (token-detection, smart-transactions, defi-positions, account-tree, analytics.ts) — adds as unknown cast where the messenger call expects the @metamask/analytics-controller package type (which still carries saveDataRecording until the package drops it)
  • Tokens/util/removeEvmToken.ts + goToAddEvmToken.ts — removes the optional saveDataRecording?: boolean prop-type
  • All test mocks — removes saveDataRecording: <value> and setSaveDataRecording: jest.fn() across 20+ test files

Note: actionButtonTracking.test.ts has one pre-existing failing test on main that is unrelated to this change (tracked by #31019).

Changelog

CHANGELOG entry: null

Related issues

Refs: #26686

Manual testing steps

N/A — analytics-only refactor, no behaviour change.

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards.
  • I've completed the PR template to the best of my ability
  • I've included tests if applicable
  • I've documented my code using JSDoc format if applicable
  • I've applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Performance checks (if applicable)

  • I've tested on Android
  • I've tested with a power user scenario
  • I've instrumented key operations with Sentry traces for production performance metrics

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.

Made with Cursor

@NicolasMassart NicolasMassart self-assigned this Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 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.

@mm-token-exchange-service mm-token-exchange-service Bot added the team-mobile-platform Mobile Platform team label Jun 9, 2026
@github-actions github-actions Bot added the size-M label Jun 9, 2026
@NicolasMassart

Copy link
Copy Markdown
Contributor Author

CI status note

This PR removes saveDataRecording from AnalyticsTrackingEvent and setSaveDataRecording from AnalyticsEventBuilderInterface. CI will fail until:

Merge order: PR1–PR7 → PR8 → PR9

@NicolasMassart NicolasMassart force-pushed the analytics/pr9-safedata-removal branch from b8ca8c9 to c9c4e5d Compare June 9, 2026 09:42
@NicolasMassart NicolasMassart changed the base branch from main to analytics/pr8-deletion June 9, 2026 09:42
@github-actions github-actions Bot added size-XL and removed size-M labels Jun 9, 2026
@mm-token-exchange-service mm-token-exchange-service Bot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Jun 9, 2026
@NicolasMassart NicolasMassart force-pushed the analytics/pr9-safedata-removal branch from 393ada2 to ca50258 Compare June 9, 2026 10:48
@github-actions github-actions Bot added size-M and removed size-XL labels Jun 9, 2026
@NicolasMassart NicolasMassart force-pushed the analytics/pr9-safedata-removal branch from ca50258 to 1f760c3 Compare June 9, 2026 10:52
@mm-token-exchange-service mm-token-exchange-service Bot removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Jun 9, 2026
@NicolasMassart NicolasMassart force-pushed the analytics/pr9-safedata-removal branch 2 times, most recently from 9d21134 to 0a651aa Compare June 9, 2026 14:28
@NicolasMassart NicolasMassart force-pushed the analytics/pr8-deletion branch from 0e7a7ed to 63e1689 Compare June 9, 2026 14:32
NicolasMassart and others added 3 commits June 9, 2026 16:42
…st event in queue.ts

Co-authored-by: Cursor <cursoragent@cursor.com>
…ger calls in metrics.ts

Co-authored-by: Cursor <cursoragent@cursor.com>
@NicolasMassart NicolasMassart force-pushed the analytics/pr9-safedata-removal branch from 0a651aa to 047f3a8 Compare June 9, 2026 14:43
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeSwap, SmokeStake, SmokeWalletPlatform, SmokeMoney, SmokePerps, SmokeMultiChainAPI, SmokePredictions, SmokeSeedlessOnboarding, SmokeBrowser, SmokeSnaps
  • Selected Performance tags: @PerformanceAccountList, @PerformanceOnboarding, @PerformanceLogin, @PerformanceSwaps, @PerformanceLaunch, @PerformanceAssetLoading, @PerformancePredict, @PerformancePreps
  • Risk Level: high
  • AI Confidence: 100%
click to see 🤖 AI reasoning details

E2E Test Selection:
Hard rule (global-infrastructure-change): Global infrastructure changed: app/components/hooks/useAnalytics/useAnalytics.test.tsx. Running all tests.

Performance Test Selection:
Hard rule (global-infrastructure-change): Global infrastructure changed: app/components/hooks/useAnalytics/useAnalytics.test.tsx. Running all tests.

View GitHub Actions results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-M team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant