chore(analytics): delete legacy analytics symbols (useMetrics, MetaMetrics, MetricsEventBuilder) and remove saveDataRecording chain#31256
Conversation
|
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. |
…Recording/dataRecorded chain
…nterface is updated Co-authored-by: Cursor <cursoragent@cursor.com>
…entBuilder from actionButtonTracking test Co-authored-by: Cursor <cursoragent@cursor.com>
…k to match test assertion Co-authored-by: Cursor <cursoragent@cursor.com>
… removes it from UseAnalyticsHook) Co-authored-by: Cursor <cursoragent@cursor.com>
…ved from UseAnalyticsHook in PR8) Co-authored-by: Cursor <cursoragent@cursor.com>
0e7a7ed to
63e1689
Compare
…tionButtonTracking test The AnalyticsTrackingEvent type still includes saveDataRecording, so the mock needs to return it to match the assertion added in the previous fix commit. Co-authored-by: Cursor <cursoragent@cursor.com>
…ypes to fix SonarCloud duplication MetaMetrics.types.ts was re-declaring the same 36-line block of data deletion types already defined in analyticsDataDeletion.types.ts, triggering a 3.4% new_duplicated_lines_density (threshold: 3%). Replace with re-exports. Co-authored-by: Cursor <cursoragent@cursor.com>
Updated the DeleteMetaMetricsData component to reset the state indicating whether data has been tracked since the last deletion. This change ensures that the UI accurately reflects the current state immediately after a deletion request is initiated, improving user experience and clarity in the security settings section.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
⚡ Performance Test Results
✅ All tests passed · 19 tests · 1 device 📱 Devices tested (1)Android: Google Pixel 8 Pro (v14.0) ✅ Passed Tests (19)
Branch: |
Description
The final deletion step of the analytics migration. Removes all legacy analytics symbols that are no longer referenced (PRs #31249–#31255 remove the last consumers).
Deleted files:
app/components/hooks/useMetrics/(hook + HOC + types)app/core/Analytics/MetaMetrics.ts+ testapp/core/Analytics/MetricsEventBuilder.ts+ testapp/core/Analytics/MetaMetricsTestUtils.ts+ testapp/components/hooks/useAnalytics/withAnalyticsAwareness.tsx+ types + test (superseded by the hook directly)Modified:
MetaMetrics.types.ts— converted to a re-export barrel (data-deletion types stay local)app/core/Analytics/index.ts— removesMetaMetricsclass exportuseAnalytics.ts/useAnalytics.types.ts— removesaddTraitsToUserfieldRemoves the
saveDataRecording/dataRecordedchain (F.1):The chain (
SAVE_DATA_RECORDING_FLAG→AppStateEventListener→useAnalyticsDataDeletion→DeleteMetaMetricsData) was redundant. The "Delete MetaMetrics Data" button is disabled while the deletion is in-flight using component state (isDataDeleteStarted), which is already sufficient. Removing this chain eliminates unnecessary AsyncStorage reads on every app-state change.Also updates: CODEOWNERS,
analyticsMock.ts(removes staleaddTraitsToUser/isDataRecorded),testSetup.js, and related test mock cleanup.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
Performance checks (if applicable)
Pre-merge reviewer checklist
Made with Cursor
Note
Medium Risk
Large deletion/refactor across analytics, privacy settings, and app-state tracking; delete-metrics UX now relies on local state and metrics opt-in rather than persisted “data recorded” flags.
Overview
Completes the analytics migration by removing legacy entry points (
useMetrics,withMetricsAwareness,withAnalyticsAwareness,MetaMetrics,MetricsEventBuilder,MetaMetricsTestUtils) and slimminguseAnalyticsto delegate directly toanalytics/AnalyticsEventBuilder(dropsaddTraitsToUser,isDataRecorded, and thetrackEvent(..., saveDataRecording)side effects).Deletes the
saveDataRecording/ANALYTICS_DATA_RECORDEDpipeline: no moreupdateDataRecordingFlagon track, nohasCollectedDataSinceDeletionRequestfrom Segment status checks, andDeleteMetaMetricsDataresets local “data tracked since deletion” on successful task creation instead of syncing from storage on mount.MetaMetrics.types.tsbecomes a re-export barrel towardutil/analytics; CODEOWNERS and global test mocks are updated accordingly.Reviewed by Cursor Bugbot for commit 1dea68e. Bugbot is set up for automated code reviews on this repo. Configure here.