Skip to content

refactor: simplify rampsUnifiedBuyV2 feature flag to single selector cp-7.71.0#27760

Merged
wachunei merged 1 commit into
mainfrom
chore/standardize-ramps-unified-buy-v2-selector
Mar 20, 2026
Merged

refactor: simplify rampsUnifiedBuyV2 feature flag to single selector cp-7.71.0#27760
wachunei merged 1 commit into
mainfrom
chore/standardize-ramps-unified-buy-v2-selector

Conversation

@wachunei

@wachunei wachunei commented Mar 20, 2026

Copy link
Copy Markdown
Member

Description

The rampsUnifiedBuyV2 feature flag previously used three chained selectors (selectRampsUnifiedBuyV2ConfigselectRampsUnifiedBuyV2ActiveFlag / 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.

@wachunei wachunei self-assigned this Mar 20, 2026
@wachunei wachunei added the team-money-movement issues related to Money Movement features label Mar 20, 2026
Replace the three chained selectors (Config, ActiveFlag,
MinimumVersionFlag) with a single `selectRampsUnifiedBuyV2Enabled`
selector that uses the shared `validatedVersionGatedFeatureFlag` utility,
aligning with the pattern used by homepage feature flags.

- Consolidate selectors in rampsUnifiedBuyV2.ts to one exported selector
- Simplify useRampsUnifiedV2Enabled hook to a single useSelector call
- Simplify isRampsUnifiedV2Enabled utility to delegate to the selector
- Update ramps-controller-init.ts to use validatedVersionGatedFeatureFlag
- Export RAMPS_UNIFIED_BUY_V2_FLAG_KEY from the selector file (single
  source of truth)
- Migrate flag shape from { active, minimumVersion } to
  { enabled, minimumVersion } matching VersionGatedFeatureFlag type
- Update all unit tests and E2E mocks/fixtures accordingly
@wachunei wachunei force-pushed the chore/standardize-ramps-unified-buy-v2-selector branch from 62a9893 to 3edd562 Compare March 20, 2026 19:29
@wachunei wachunei changed the title refactor: simplify rampsUnifiedBuyV2 feature flag to single selector refactor: simplify rampsUnifiedBuyV2 feature flag to single selector cp-7.71.0 Mar 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - draft PR

All E2E tests pre-selected.

View GitHub Actions results

@wachunei wachunei marked this pull request as ready for review March 20, 2026 19:33
@wachunei wachunei requested review from a team as code owners March 20, 2026 19:33
@github-actions

Copy link
Copy Markdown
Contributor

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

@sonarqubecloud

Copy link
Copy Markdown

@wachunei wachunei added this pull request to the merge queue Mar 20, 2026
Merged via the queue into main with commit 73198ff Mar 20, 2026
125 checks passed
@wachunei wachunei deleted the chore/standardize-ramps-unified-buy-v2-selector branch March 20, 2026 20:43
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 20, 2026
@metamaskbot metamaskbot added the release-7.72.0 Issue or pull request that will be included in release 7.72.0 label Mar 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.72.0 Issue or pull request that will be included in release 7.72.0 size-M team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants