feat(perps): add deferEligibilityCheck option to PerpsController#27483
Conversation
Port from Core PR #8197. Adds a constructor option to prevent the eager geolocation fetch during wallet onboarding (privacy compliance) and a startEligibilityMonitoring() method to resume checks post-onboarding.
|
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 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
There was a problem hiding this comment.
It seems like we are including a few changes that are outside of the scope of the deferEligibilityCheck feature
Can we create a separate PR that scopes the diff to only that change? The breadcrumb and sentry fixes seem out of scope to me, and should likely be introduced as a separate PR.
Those were necessary to unblock the sync and were included to force the sync but yes otherwise they need to be separate. Fixing it now since we dont need have urgency anymore. |
…igibilityCheck Moved breadcrumb abstraction, external dependency removal, and linting fixes to a separate PR (fix/perps-core-sync-improvements).
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: SmokePerps must be selected to validate add funds, balance updates, and trading account behavior. Per the tag requirements, SmokePerps also requires SmokeWalletPlatform (Perps section is embedded in Trending and affects wallet activity/history) and SmokeConfirmations (Add Funds deposits are on-chain transactions that go through the confirmation UI). No evidence of changes to other controllers (Accounts, Network, Identity, MultiChain, Snaps, etc.), so broader tags are not required. Given this is a controller change in a financial feature with on-chain effects, risk is high within the Perps domain. Performance Test Selection: |
|
|
✅ E2E Fixture Validation — Schema is up to date |




Description
Adds
deferEligibilityCheckconstructor option toPerpsControllerthat prevents the eager geolocation fetch during wallet onboarding (privacy compliance). Also addsstartEligibilityMonitoring()method to resume checks post-onboarding.Follow-up fixes included in this PR:
@sentry/react-native(PerpsController, TradingService) andAppConstants(MYXClientService) were breaking core sync. RoutedaddBreadcrumbthroughPerpsTracerinfrastructure injection, replacedAppConstants.ZERO_ADDRESSwith existing perps constant.--ext .tsno longer works with core's flat eslint config; replaced with glob patterns.@metamask/geolocation-controllermissing from core tsconfig/package.json — added as devDependency and project reference so perps-controller builds in core.Changelog
CHANGELOG entry: null
Related issues
Fixes: Core PR #8197
Manual testing steps
Screenshots/Recordings
N/A — internal controller changes, no UI impact.
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches eligibility/geo-blocking flow by optionally skipping geolocation and adding a new entry point to re-enable checks, which could affect region-gating if misused. Default behavior is unchanged when the new option is not set, and coverage is added via unit tests.
Overview
Adds an optional
deferEligibilityCheckconstructor flag toPerpsControllerthat prevents the initial geolocation-based eligibility check from running until explicitly resumed.Introduces
startEligibilityMonitoring()(also exposed via messenger action types) to clear the deferral, read current remote feature flags, and immediately trigger an eligibility refresh, with error logging if feature-flag state lookup fails.Extends
PerpsControllertests to cover the deferred/ resumed behavior and error logging, plus a small typing cleanup in preload cache key assertions.Written by Cursor Bugbot for commit cf17d6b. This will update automatically on new commits. Configure here.