chore(runway): cherry-pick refactor: simplify rampsUnifiedBuyV2 feature flag to single selector cp-7.71.0#27762
Merged
Conversation
…re flag to single selector cp-7.71.0 (#27760) ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> The `rampsUnifiedBuyV2` feature flag previously used three chained selectors (`selectRampsUnifiedBuyV2Config` → `selectRampsUnifiedBuyV2ActiveFlag` / `selectRampsUnifiedBuyV2MinimumVersionFlag`) and a custom 2-arg `hasMinimumRequiredVersion` utility. This was inconsistent with how other feature flags (e.g. homepage redesign) are handled in the codebase. This PR consolidates the three selectors into a single `selectRampsUnifiedBuyV2Enabled` selector that uses the shared `validatedVersionGatedFeatureFlag` utility from `app/util/remoteFeatureFlag`. The remote flag shape is updated from `{ active, minimumVersion }` to `{ enabled, minimumVersion }` to match the standard `VersionGatedFeatureFlag` type. **Key changes:** - **Selector file** (`rampsUnifiedBuyV2.ts`): Replaced 3 selectors + `RampsUnifiedBuyV2Config` interface with a single `selectRampsUnifiedBuyV2Enabled` selector - **Hook** (`useRampsUnifiedV2Enabled.ts`): Simplified from two `useSelector` calls + `hasMinimumRequiredVersion` to a single `useSelector` - **Utility** (`isRampsUnifiedV2Enabled.ts`): Simplified to delegate directly to the selector - **Controller init** (`ramps-controller-init.ts`): Replaced local interface + `hasMinimumRequiredVersion` with `validatedVersionGatedFeatureFlag`; imports shared flag key constant - **Flag key constant**: Exported `RAMPS_UNIFIED_BUY_V2_FLAG_KEY` from the selector file as single source of truth - **E2E mocks/fixtures**: Updated flag shape from `active` to `enabled` in `FixtureBuilder`, `feature-flags-mocks`, and `feature-flag-registry` ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** N/A — this is a pure refactor of internal selector structure. Behavior is unchanged. All unit tests have been updated and pass. ## **Screenshots/Recordings** ### **Before** N/A ### **After** https://github.com/user-attachments/assets/13ab83a0-f3b1-4862-95cc-ec02fc5b89b5 ## **Pre-merge author checklist** - [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. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Touches feature-flag gating that controls whether the ramps V2 flow and controller initialization run, and changes the expected remote flag shape from `active` to `enabled`. Main risk is misconfigured/older flag payloads causing the feature to be incorrectly disabled. > > **Overview** > Simplifies `rampsUnifiedBuyV2` enablement checks by replacing the chained config/active/min-version selectors and custom gating logic with a single `selectRampsUnifiedBuyV2Enabled` that delegates to `validatedVersionGatedFeatureFlag`. > > Updates the Ramp hook/utility and `ramps-controller-init` to consume this unified version-gated flag (keeping the build-flag override), and standardizes the remote flag payload from `{ active, minimumVersion }` to `{ enabled, minimumVersion }` across unit tests, E2E mocks/fixtures, and the feature-flag registry defaults. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 3edd562. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
wachunei
approved these changes
Mar 20, 2026
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 - skip-smart-e2e-selection label found All E2E tests pre-selected. |
Contributor
|
✅ E2E Fixture Validation — Schema is up to date |
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
rampsUnifiedBuyV2feature flag previously used three chainedselectors (
selectRampsUnifiedBuyV2Config→selectRampsUnifiedBuyV2ActiveFlag/selectRampsUnifiedBuyV2MinimumVersionFlag) and a custom 2-arghasMinimumRequiredVersionutility. This was inconsistent with howother feature flags (e.g. homepage redesign) are handled in the
codebase.
This PR consolidates the three selectors into a single
selectRampsUnifiedBuyV2Enabledselector that uses the sharedvalidatedVersionGatedFeatureFlagutility fromapp/util/remoteFeatureFlag. The remote flag shape is updated from{ active, minimumVersion }to{ enabled, minimumVersion }to match thestandard
VersionGatedFeatureFlagtype.Key changes:
rampsUnifiedBuyV2.ts): Replaced 3 selectors +RampsUnifiedBuyV2Configinterface with a singleselectRampsUnifiedBuyV2EnabledselectoruseRampsUnifiedV2Enabled.ts): Simplified from twouseSelectorcalls +hasMinimumRequiredVersionto a singleuseSelectorisRampsUnifiedV2Enabled.ts): Simplified to delegatedirectly to the selector
ramps-controller-init.ts): Replaced localinterface +
hasMinimumRequiredVersionwithvalidatedVersionGatedFeatureFlag; imports shared flag key constantRAMPS_UNIFIED_BUY_V2_FLAG_KEYfromthe selector file as single source of truth
activetoenabledin
FixtureBuilder,feature-flags-mocks, andfeature-flag-registryChangelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
N/A — this is a pure refactor of internal selector structure. Behavior
is unchanged. All unit tests have been updated and pass.
Screenshots/Recordings
Before
N/A
After
ff.mp4
Pre-merge author checklist
Docs and MetaMask Mobile
Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
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
Touches feature-flag gating that controls whether the ramps V2 flow
and controller initialization run, and changes the expected remote flag
shape from
activetoenabled. Main risk is misconfigured/older flagpayloads causing the feature to be incorrectly disabled.
Overview
Simplifies
rampsUnifiedBuyV2enablement checks by replacing thechained config/active/min-version selectors and custom gating logic with
a single
selectRampsUnifiedBuyV2Enabledthat delegates tovalidatedVersionGatedFeatureFlag.Updates the Ramp hook/utility and
ramps-controller-initto consumethis unified version-gated flag (keeping the build-flag override), and
standardizes the remote flag payload from
{ active, minimumVersion }to
{ enabled, minimumVersion }across unit tests, E2E mocks/fixtures,and the feature-flag registry defaults.
Written by Cursor
Bugbot for commit
3edd562. This will update automatically
on new commits. Configure
here.