Skip to content

chore(perps): use feature flag for referral code#25282

Merged
aganglada merged 7 commits intomainfrom
perps/rm-rewards-referral
Jan 29, 2026
Merged

chore(perps): use feature flag for referral code#25282
aganglada merged 7 commits intomainfrom
perps/rm-rewards-referral

Conversation

@geositta
Copy link
Contributor

@geositta geositta commented Jan 27, 2026

Description

Changelog

CHANGELOG entry: Gate rewards referral code in Perps PnL hero card behind rewardsReferralCodeEnabled feature flag

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

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

Low Risk
Low risk: behavior change is limited to hiding/showing the referral code in the Perps PnL hero card and share copy based on a remote flag, with tests covering enabled/disabled cases.

Overview
Referral code display in the Perps PnL hero card is now feature-flagged off by default. PerpsHeroCardView derives an effectiveReferralCode that is only set when selectPerpsRewardsReferralCodeEnabledFlag is true, and uses it to control referral tag rendering, layout styling, and the share message/link.

Adds selectPerpsRewardsReferralCodeEnabledFlag to Perps feature-flag selectors, supporting both boolean and version-gated flag shapes, and expands unit tests to cover flag enabled/disabled and referral-code-present/absent scenarios.

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

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

@geositta geositta added the team-perps Perps team label Jan 27, 2026
@geositta geositta force-pushed the perps/rm-rewards-referral branch from 2778585 to 3917970 Compare January 28, 2026 00:07
@geositta geositta marked this pull request as ready for review January 28, 2026 00:08
@geositta geositta requested review from a team as code owners January 28, 2026 00:08
@geositta geositta changed the title chore(perps): use feature flag for referral chore(perps): use feature flag for referral code Jan 28, 2026
Copy link
Contributor

@aganglada aganglada left a comment

Choose a reason for hiding this comment

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

@geositta we are serving Enabled by default, is this ok? I think we need to disable right now, correct?
Also please lets meet the >= 80% threshold on coverage

Screenshot 2026-01-28 at 10 28 39

@aganglada aganglada self-requested a review January 28, 2026 17:59
@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeRewards
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes add a new feature flag selector selectPerpsRewardsReferralCodeEnabledFlag to gate the display of referral codes in the PerpsHeroCardView component. This is a targeted change to the Perps (perpetuals trading) feature that:

  1. Adds a new selector in app/components/UI/Perps/selectors/featureFlags/index.ts that reads the rewardsReferralCodeEnabled remote feature flag
  2. Modifies PerpsHeroCardView.tsx to use this flag to conditionally show/hide referral codes
  3. Updates unit tests to properly test the feature flag gating behavior

The changes are well-scoped to the Perps feature with proper unit test coverage. The referral code functionality is part of the rewards system, so both SmokePerps and SmokeRewards tags are appropriate. The risk is low because:

  • Changes are isolated to a specific view component
  • Feature flag adds a gate but doesn't change core functionality
  • Comprehensive unit tests are included
  • No changes to navigation, shared components, or critical paths

Performance Test Selection:
The changes involve adding a simple Redux selector and a conditional check in a component. This has negligible performance impact - no changes to list rendering, data loading patterns, animations, or critical user flows. The selector is a simple read from state with minimal computation. No performance tests are needed.

View GitHub Actions results

@sonarqubecloud
Copy link

@gambinish gambinish removed the request for review from a team January 29, 2026 03:15
Copy link
Member

@gambinish gambinish left a comment

Choose a reason for hiding this comment

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

Tested this by toggling the new flag disabled in the main-dev environment and confirmed that the referral code doesn't render:

Image

@aganglada aganglada enabled auto-merge January 29, 2026 09:40
@aganglada aganglada added this pull request to the merge queue Jan 29, 2026
Merged via the queue into main with commit 9236943 Jan 29, 2026
84 checks passed
@aganglada aganglada deleted the perps/rm-rewards-referral branch January 29, 2026 09:58
@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2026
@metamaskbot metamaskbot added release-7.65.0 Issue or pull request that will be included in release 7.65.0 release-7.64.0 Issue or pull request that will be included in release 7.64.0 labels Jan 29, 2026
@metamaskbot metamaskbot removed the release-7.65.0 Issue or pull request that will be included in release 7.65.0 label Feb 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.64.0 Issue or pull request that will be included in release 7.64.0 size-M team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants