Skip to content

chore(runway): cherry-pick refactor: simplify rampsUnifiedBuyV2 feature flag to single selector cp-7.71.0#27762

Merged
chloeYue merged 2 commits into
release/7.71.0from
runway-cherry-pick-7.71.0-1774039885
Mar 23, 2026
Merged

chore(runway): cherry-pick refactor: simplify rampsUnifiedBuyV2 feature flag to single selector cp-7.71.0#27762
chloeYue merged 2 commits into
release/7.71.0from
runway-cherry-pick-7.71.0-1774039885

Conversation

@runway-github
Copy link
Copy Markdown
Contributor

@runway-github runway-github Bot commented Mar 20, 2026

Description

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

ff.mp4

Pre-merge author checklist

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.

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.

Written by Cursor
Bugbot
for commit
3edd562. This will update automatically
on new commits. Configure
here.

[73198ff](https://github.com/MetaMask/metamask-mobile/commit/73198ff6128dcb3f8d2b15c476042864a3a3cdb9)

…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 -->
@runway-github runway-github Bot requested review from a team as code owners March 20, 2026 20:51
@metamaskbot metamaskbot added the team-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label Mar 20, 2026
@github-actions github-actions Bot added size-M risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 20, 2026
Copy link
Copy Markdown
Contributor

@chloeYue chloeYue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions
Copy link
Copy Markdown
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.

@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 23, 2026
@chloeYue chloeYue added the skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run label Mar 23, 2026
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - skip-smart-e2e-selection label found

All E2E tests pre-selected.

View GitHub Actions results

@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
15 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud
Copy link
Copy Markdown

@chloeYue chloeYue merged commit 4246be9 into release/7.71.0 Mar 23, 2026
170 of 172 checks passed
@chloeYue chloeYue deleted the runway-cherry-pick-7.71.0-1774039885 branch March 23, 2026 12:04
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

risk-high Extensive testing required · High bug introduction risk size-M skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants