Cherry-picking commits from main to release/8.0.0 for PR #32037#32093
Open
runway-github[bot] wants to merge 1 commit into
Open
Cherry-picking commits from main to release/8.0.0 for PR #32037#32093runway-github[bot] wants to merge 1 commit into
runway-github[bot] wants to merge 1 commit into
Conversation
…erride cp-8.0.0 (#32037) ## **Description** <!-- mms-check: type=text required=true --> The APY in the Money account was previously hardcoded in `__DEV__` blocks — a temporary workaround for the vault returning 0%. This replaces that with a proper remote-config-driven solution via a new `earnMoneyVaultApyControl` feature flag. Two knobs are exposed: - **`vaultApyFallback`** — shown only when the APY service returns `undefined` (e.g. third-party outage). Lets us set a sensible display value without overriding a live rate. - **`vaultApyOverride`** — always shown instead of the service value when set. Useful for scheduled maintenance or launch-window display control. Precedence: `vaultApyOverride` > live `serviceApy` > `vaultApyFallback` > `undefined`. ## **Changelog** <!-- mms-check: type=changelog required=true blocking=true --> CHANGELOG entry: added remotely configurable Money vault APY control ## **Related issues** <!-- mms-check: type=issue-link required=true --> - Fixes: [MUSD-1026](https://consensyssoftware.atlassian.net/browse/MUSD-1026) ## **Manual testing steps** <!-- mms-check: type=manual-testing required=true --> ```gherkin Feature: Remote APY control for Money account Scenario: APY fallback shown when service is unavailable Given earnMoneyVaultApyControl.vaultApyFallback = 0.04 in remote config And the vault APY service returns no data When user opens the Money account screen And remote feature flags fetch successfully Then the displayed APY is 4% Scenario: APY override always wins over live service value Given earnMoneyVaultApyControl.vaultApyOverride = 0.08 in remote config And the vault APY service returns 5% When user opens the Money account screen And remote feature flags fetch successfully Then the displayed APY is 8% Scenario: Live service APY shown when no override configured Given earnMoneyVaultApyControl has no vaultApyOverride And the vault APY service returns 5% When user opens the Money account screen Then the displayed APY is 5% ``` ## **Screenshots/Recordings** <!-- mms-check: type=screenshot required=true --> ### **Before** <!-- [screenshots/recordings] --> N/A — no UI layout changes; only the data source for the APY value changes. ### **After** <!-- [screenshots/recordings] --> N/A — no UI layout changes; only the data source for the APY value changes. ## **Pre-merge author checklist** <!-- mms-check: type=checklist required=true --> - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. #### Performance checks (if applicable) - [x] I've tested on Android - Ideally on a mid-range device; emulator is acceptable - [x] I've tested with a power user scenario - Use these [power-user SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93) to import wallets with many accounts and tokens - [x] I've instrumented key operations with Sentry traces for production performance metrics - See [`trace()`](/app/util/trace.ts) for usage and [`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274) for an example ## **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. <!-- Generated with the help of the pr-description AI skill --> [MUSD-1026]: https://consensyssoftware.atlassian.net/browse/MUSD-1026?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Displayed APY can diverge from the live vault service when override or fallback is set; behavior is intentional but affects user-facing yield messaging. > > **Overview** > Replaces the temporary **`__DEV__` hardcoded 4% APY** in `useMoneyAccountBalance` with remote feature flag **`earnMoneyVaultApyControl`**, exposing **`vaultApyFallback`** and **`vaultApyOverride`** via `selectMoneyVaultApyRemoteConfig`. > > **Effective APY** is now: override (when set) → live vault service → fallback (only after the APY query settles or errors, not while loading, to avoid flicker). Real **0%** from the service is preserved when no override is set. > > Adds **`parseNonNegativeFinite`** and reuses it for **`selectMoneyDepositMinBalance`** so negative remote/env values are rejected. Registers the new flag in the feature-flag registry with production defaults. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1a4d182. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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. |
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - PR targets a release or stable branch (release/* or stable) All E2E tests pre-selected. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
The APY in the Money account was previously hardcoded in
__DEV__blocks — a temporary workaround for the vault returning 0%. This
replaces that with a proper remote-config-driven solution via a new
earnMoneyVaultApyControlfeature flag.Two knobs are exposed:
vaultApyFallback— shown only when the APY service returnsundefined(e.g. third-party outage). Lets us set a sensible displayvalue without overriding a live rate.
vaultApyOverride— always shown instead of the service valuewhen set. Useful for scheduled maintenance or launch-window display
control.
Precedence:
vaultApyOverride> liveserviceApy>vaultApyFallbackChangelog
CHANGELOG entry: added remotely configurable Money vault APY control
Related issues
MUSD-1026
Manual testing steps
Screenshots/Recordings
Before
N/A — no UI layout changes; only the data source for the APY value
changes.
After
N/A — no UI layout changes; only the data source for the APY value
changes.
Pre-merge author checklist
Docs and MetaMask Mobile
Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Performance checks (if applicable)
SRPs
to import wallets with many accounts and tokens
performance metrics
trace()for usage andaddTokenfor an example
Pre-merge reviewer checklist
app, test code being changed).
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Note
Medium Risk
Displayed APY can diverge from the live vault service when override or
fallback is set; behavior is intentional but affects user-facing yield
messaging.
Overview
Replaces the temporary
__DEV__hardcoded 4% APY inuseMoneyAccountBalancewith remote feature flagearnMoneyVaultApyControl, exposingvaultApyFallbackandvaultApyOverrideviaselectMoneyVaultApyRemoteConfig.Effective APY is now: override (when set) → live vault service →
fallback (only after the APY query settles or errors, not while loading,
to avoid flicker). Real 0% from the service is preserved when no
override is set.
Adds
parseNonNegativeFiniteand reuses it forselectMoneyDepositMinBalanceso negative remote/env values arerejected. Registers the new flag in the feature-flag registry with
production defaults.
Reviewed by Cursor Bugbot for commit
1a4d182. Bugbot is set up for automated
code reviews on this repo. Configure
here.