Skip to content

refactor(analytics): PR A2 split types from MetaMetrics#26988

Merged
NicolasMassart merged 10 commits into
mainfrom
refactor/26686_a2-platform_split-types
Mar 17, 2026
Merged

refactor(analytics): PR A2 split types from MetaMetrics#26988
NicolasMassart merged 10 commits into
mainfrom
refactor/26686_a2-platform_split-types

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Description

Part of the analytics cleanup workstream (#26686).

  • Splits types from MetaMetrics.types.ts into:
    • app/util/analytics/analyticsDataDeletion.types.ts (data deletion)
    • app/util/analytics/analytics.types.ts (event/transitional + domain types).
  • Keeps ISegmentClient and IMetaMetrics in the old file and re-exports all moved types from the new locations so consumers remain unchanged.
  • Updates imports only in staying, not code-owned files.

Changelog

CHANGELOG entry: null

Related issues

Fixes: #26811

Manual testing steps

N/A

Screenshots/Recordings

N/A

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

Low Risk
Primarily a type-only refactor that moves analytics-related TypeScript types and updates imports, with minimal runtime impact beyond a small exported type guard. Risk is limited to potential compile-time/import path regressions in analytics and transaction-metrics call sites.

Overview
Refactors analytics type ownership by moving legacy MetaMetrics event and JSON property types into app/util/analytics/analytics.types.ts, and extracting Segment data-deletion/GDPR types into the new app/util/analytics/analyticsDataDeletion.types.ts.

Updates affected modules (including useAnalytics, AnalyticsEventBuilder, and transaction-controller metrics builders) to import these types from the new util locations, and adds a focused unit test for the new isTrackingEvent type guard.

Written by Cursor Bugbot for commit 10086c1. This will update automatically on new commits. Configure here.

… analytics.types.ts and analyticsDataDeletion.types.ts
@NicolasMassart NicolasMassart added the team-mobile-platform Mobile Platform team label Mar 4, 2026
@NicolasMassart NicolasMassart self-assigned this Mar 4, 2026
@github-actions

github-actions Bot commented Mar 4, 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 Mar 4, 2026
@NicolasMassart NicolasMassart marked this pull request as ready for review March 4, 2026 14:12
@NicolasMassart NicolasMassart requested review from a team as code owners March 4, 2026 14:12
@NicolasMassart NicolasMassart enabled auto-merge March 4, 2026 16:30
@NicolasMassart NicolasMassart moved this to Needs dev review in PR review queue Mar 9, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.69%. Comparing base (0ea672c) to head (1570e28).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #26988   +/-   ##
=======================================
  Coverage   81.68%   81.69%           
=======================================
  Files        4652     4654    +2     
  Lines      121697   121764   +67     
  Branches    26740    26754   +14     
=======================================
+ Hits        99412    99476   +64     
+ Misses      15369    15368    -1     
- Partials     6916     6920    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cursor cursor Bot left a comment

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.

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.

Comment thread app/util/analytics/analytics.types.ts
@NicolasMassart NicolasMassart changed the title refactor(analytics): PR A2 split types from MetaMetrics.types.ts into analytics.types.ts and analyticsDataDeletion.types.ts refactor(analytics): PR A2 split types from MetaMetrics Mar 10, 2026
@NicolasMassart NicolasMassart added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Mar 10, 2026
@NicolasMassart

NicolasMassart commented Mar 10, 2026

Copy link
Copy Markdown
Contributor Author

addin skip sonar label as it fails on the duplication which is expected as I have to finish the migration to remove the old file and meanwhile we have twice the code. But that's temporary

@Cal-L Cal-L left a comment

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.

LGTM

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 83%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are concentrated in the TransactionController metrics layer and analytics utilities. Specifically:

  • Multiple files under app/core/Engine/controllers/transaction-controller/* (metrics, metrics_properties, utils, types) were modified.
  • app/core/Engine/utils/analytics.ts was updated.
  • Several analytics-related utility and type files were refactored under app/util/analytics/.

The diffs show primarily type import path changes and consolidation of analytics types (moving from core/Analytics to util/analytics). While the changes appear refactor-oriented (type source updates and analytics event typing), they affect the TransactionController metrics pipeline, which is tightly coupled to transaction and signature confirmation flows.

Given that TransactionController is central to:

  • Native token sends (ETH)
  • ERC-20 transfers and approvals
  • Contract interactions
  • Signature requests (personal_sign, EIP-712, SIWE)
  • Smart transactions and simulation flows

Running SmokeConfirmations ensures that all core transaction and signature confirmation flows still execute correctly end-to-end and that no regression was introduced through analytics-related refactoring.

No changes were made to account management, network management, identity sync, trade UI, ramps, card, perps, predictions, or multi-chain APIs directly. Therefore, broader tags are not required.

This is assessed as medium risk because it touches critical Engine controller code, but the actual changes appear limited to analytics typing and imports rather than transaction logic.

Performance Test Selection:
The changes are limited to analytics type imports, event typing, and metrics-related utilities. There are no modifications to UI components, rendering logic, state management performance, list rendering, startup logic, or network fetching behavior. Therefore, there is no expected impact on app responsiveness or performance characteristics.

View GitHub Actions results

@github-actions

Copy link
Copy Markdown
Contributor

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

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
25.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@NicolasMassart NicolasMassart added this pull request to the merge queue Mar 17, 2026
@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Mar 17, 2026
Merged via the queue into main with commit 4e1ff6b Mar 17, 2026
94 of 95 checks passed
@NicolasMassart NicolasMassart deleted the refactor/26686_a2-platform_split-types branch March 17, 2026 10:48
@github-project-automation github-project-automation Bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue Mar 17, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 17, 2026
@metamaskbot metamaskbot added the release-7.71.0 Issue or pull request that will be included in release 7.71.0 label Mar 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.71.0 Issue or pull request that will be included in release 7.71.0 size-M skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

PR A2: split and relocate types from MetaMetrics.types.ts into analytics.types.ts

5 participants