chore: integrate authenticated user storage package#29114
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. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This comment was marked as resolved.
This comment was marked as resolved.
|
@SocketSecurity ignore npm/@metamask/authenticated-user-storage@1.0.0. |
|
@SocketSecurity ignore npm/@metamask/authenticated-user-storage@1.0.0 |
There was a problem hiding this comment.
Pull request overview
Integrates @metamask/authenticated-user-storage into the Engine and refactors Social Leaderboard notification preferences to persist remotely via the new service.
Changes:
- Adds
AuthenticatedUserStorageServicemessenger + init wiring (Engine types, constants, factories, tests). - Refactors
useNotificationPreferencesto a remote GET/PUT flow with optimistic UI overlay and serialized writes. - Updates Notification Preferences UI to show a preferences-loading skeleton and adjusts tests/strings accordingly.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Locks @metamask/authenticated-user-storage@^1.0.0 and dependencies. |
| package.json | Adds @metamask/authenticated-user-storage dependency. |
| locales/languages/en.json | Capitalizes notification preferences title string. |
| babel.config.tests.js | Excludes new init files from env var inlining in tests. |
| app/core/Engine/types.ts | Registers new service types/actions/events in Engine typing. |
| app/core/Engine/messengers/index.ts | Adds messenger factory entry for the new service. |
| app/core/Engine/messengers/authenticated-user-storage-service-messenger.ts | Creates restricted messenger delegating bearer token access. |
| app/core/Engine/messengers/authenticated-user-storage-service-messenger.test.ts | Basic messenger creation test. |
| app/core/Engine/controllers/authenticated-user-storage-service-init.ts | Initializes the service (environment pinned to prod). |
| app/core/Engine/controllers/authenticated-user-storage-service-init.test.ts | Tests init and environment selection. |
| app/core/Engine/constants.ts | Marks service as stateless/non-controller. |
| app/core/Engine/Engine.ts | Wires service initialization and exposure on Engine.context. |
| app/components/Views/SocialLeaderboard/NotificationPreferencesView/hooks/useNotificationPreferences.ts | Replaces local state with remote read/merge/write persistence + optimistic overlay. |
| app/components/Views/SocialLeaderboard/NotificationPreferencesView/hooks/useNotificationPreferences.test.ts | Adds/updates tests for new remote persistence behavior. |
| app/components/Views/SocialLeaderboard/NotificationPreferencesView/hooks/index.ts | Updates exported types to SocialAIPreference. |
| app/components/Views/SocialLeaderboard/NotificationPreferencesView/components/Skeletons.tsx | Adds PreferencesSkeleton for preference-loading state. |
| app/components/Views/SocialLeaderboard/NotificationPreferencesView/NotificationPreferencesView.tsx | Consumes new hook API, shows skeleton, caches currency formatter. |
| app/components/Views/SocialLeaderboard/NotificationPreferencesView/NotificationPreferencesView.testIds.ts | Adds test id for preferences-loading skeleton. |
| app/components/Views/SocialLeaderboard/NotificationPreferencesView/NotificationPreferencesView.test.tsx | Updates tests for new hook + skeleton behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AI PR Analysis🚫 Merge safe: false | 🟠 Risk: high
AI analysis did not complete. Manual review recommended. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: AnalysisEngine Changes (Critical Files)The PR adds a new
Risk Assessment: These are purely additive changes. No existing controllers are modified, no initialization order changes, no breaking messenger changes. The new service is Phase 6 (feature-level), not Phase 2 (critical). However, since Engine.ts is modified, there's a risk that the new package ( Feature Changes (SocialLeaderboard)
The SocialLeaderboard/NotificationPreferences feature is part of the Trending tab, which is covered by package.jsonNew Tag Selection Rationale
No performance tests needed - the changes are additive service registration and a UI loading skeleton, not performance-critical paths. Performance Test Selection: |
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.
Reviewed by Cursor Bugbot for commit a17c632. Configure here.
|
|
✅ E2E Fixture Validation — Schema is up to date |




Description
Wires
AuthenticatedUserStorageServiceinto the Engine (messenger, init, types, constants) and refactorsuseNotificationPreferencesto persist SocialAI preferences remotely.Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-04-22.at.13.20.17.mov
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Medium risk because it adds a new Engine service/messenger and changes notification-preferences persistence to remote read/merge/write with optimistic UI updates, which could impact user settings if the integration is incorrect.
Overview
Adds remote persistence for Social Leaderboard notification preferences.
useNotificationPreferencesis refactored from local state to an account-scopeduseQueryread plus serialized read/merge/write PUTs viaEngine.controllerMessengertoAuthenticatedUserStorageService, using a muted-trader opt-out list (mutedTraderProfileIds) and optimistic overlays with rollback/error handling and cache priming.Wires
AuthenticatedUserStorageServiceinto the app runtime. Engine now initializes the service (hardcodedprodenvironment), adds a dedicated messenger delegatingAuthenticationController:getBearerToken, and updates Engine types/constants plusDATA_SERVICES; package dependency is added.Improves Notification Preferences UI stability and tests. The view shows a new
PreferencesSkeletonwhile remote prefs load (avoids toggle flash), caches currencyIntl.NumberFormatinstances, updates selector IDs/localized title casing, and rewrites/extends tests to cover loading, muted traders, and hook-driven interactions.Reviewed by Cursor Bugbot for commit a17c632. Bugbot is set up for automated code reviews on this repo. Configure here.