refactor: simplify rampsUnifiedBuyV2 feature flag to single selector cp-7.71.0#27760
Merged
Merged
Conversation
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
62a9893 to
3edd562
Compare
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - draft PR All E2E tests pre-selected. |
amitabh94
approved these changes
Mar 20, 2026
georgeweiler
approved these changes
Mar 20, 2026
Contributor
|
✅ E2E Fixture Validation — Schema is up to date |
|
cortisiko
approved these changes
Mar 20, 2026
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 chained selectors (selectRampsUnifiedBuyV2Config→selectRampsUnifiedBuyV2ActiveFlag/selectRampsUnifiedBuyV2MinimumVersionFlag) and a custom 2-arghasMinimumRequiredVersionutility. 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
selectRampsUnifiedBuyV2Enabledselector that uses the sharedvalidatedVersionGatedFeatureFlagutility fromapp/util/remoteFeatureFlag. The remote flag shape is updated from{ active, minimumVersion }to{ enabled, minimumVersion }to match the standardVersionGatedFeatureFlagtype.Key changes:
rampsUnifiedBuyV2.ts): Replaced 3 selectors +RampsUnifiedBuyV2Configinterface with a singleselectRampsUnifiedBuyV2EnabledselectoruseRampsUnifiedV2Enabled.ts): Simplified from twouseSelectorcalls +hasMinimumRequiredVersionto a singleuseSelectorisRampsUnifiedV2Enabled.ts): Simplified to delegate directly to the selectorramps-controller-init.ts): Replaced local interface +hasMinimumRequiredVersionwithvalidatedVersionGatedFeatureFlag; imports shared flag key constantRAMPS_UNIFIED_BUY_V2_FLAG_KEYfrom the selector file as single source of truthactivetoenabledinFixtureBuilder,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
Pre-merge reviewer checklist
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 flag payloads causing the feature to be incorrectly disabled.Overview
Simplifies
rampsUnifiedBuyV2enablement checks by replacing the chained config/active/min-version selectors and custom gating logic with a singleselectRampsUnifiedBuyV2Enabledthat delegates tovalidatedVersionGatedFeatureFlag.Updates the Ramp hook/utility and
ramps-controller-initto 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.