refactor(analytics): PR A1 move SegmentPersistor, PrivacyPlugin, constants, whenEngineReady, snapKeyring to app/util/analytics#26891
Conversation
…tants, whenEngineReady, snapKeyring to app/util/analytics
|
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. |
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.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Because changes touch core key management (SnapKeyring), identity/OAuth, and Engine-integrated analytics, the overall risk is HIGH with potential cross-domain impact. Selected tags ensure coverage of:
No Trade/Perps/Predictions/Card/Ramps specific logic was modified, so those tags are excluded to minimize unnecessary execution. Performance Test Selection: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26891 +/- ##
==========================================
+ Coverage 81.68% 81.70% +0.01%
==========================================
Files 4652 4654 +2
Lines 121697 121764 +67
Branches 26740 26754 +14
==========================================
+ Hits 99412 99487 +75
+ Misses 15369 15359 -10
- Partials 6916 6918 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
✅ E2E Fixture Validation — Schema is up to date |
gantunesr
left a comment
There was a problem hiding this comment.
Approved for Accounts CO,
- app/component-library/components-temp/MultichainAccounts/MultichainAccountSelectorList/MultichainAccountSelectorList.test.tsx
- app/core/SnapKeyring/SnapKeyring.test.ts
- app/core/SnapKeyring/SnapKeyring.ts



Description
Part of the analytics cleanup workstream (#26686).
app/core/Analytics/intoapp/util/analytics/MetaMetricsprefix:MetaMetricsPrivacySegmentPlugin→privacySegmentPluginMetaMetrics.constants→constantsMETAMETRICS_ANONYMOUS_ID→ANALYTICS_ANONYMOUS_IDwhenEngineReady.test.tsFiles scheduled for deletion in later PRs (e.g.
MetaMetrics.ts) are intentionally left untouched.Changelog
CHANGELOG entry: null
Related issues
Fixes: #26810
Manual testing steps
N/A
Screenshots/Recordings
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Moderate risk because it rewires import paths and constants across analytics, Engine readiness polling, and Segment setup used at runtime; mistakes could break analytics initialization or cause lingering timers, though behavior is intended to be unchanged and is now covered by new tests.
Overview
Refactors analytics infrastructure by moving
whenEngineReady, Segment persistence (segmentPersistor), the privacy Segment plugin, and the anonymous-id constant out ofcore/Analyticsintoutil/analytics, including renamingMETAMETRICS_ANONYMOUS_IDtoANALYTICS_ANONYMOUS_ID.Updates runtime imports (e.g.,
analytics.ts,platform-adapter.ts,OAuthService.ts,SnapKeyring.ts) and a broad set of Jest tests/global test setup to mock the new module paths, and adds a dedicatedwhenEngineReadyunit test to validate retry/backoff behavior.Written by Cursor Bugbot for commit 2737a6e. This will update automatically on new commits. Configure here.