Skip to content

fix(predict): make fee exemption logic feature-flag-driven in PredictMarketDetails cp-7.69.0#27090

Merged
matallui merged 3 commits into
mainfrom
predict/fix-fee-exemption-logic
Mar 5, 2026
Merged

fix(predict): make fee exemption logic feature-flag-driven in PredictMarketDetails cp-7.69.0#27090
matallui merged 3 commits into
mainfrom
predict/fix-fee-exemption-logic

Conversation

@matallui

@matallui matallui commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Description

The fee exemption logic in PredictMarketDetails was hardcoded to check for a 'Middle East' tag label, while PredictController and PolymarketProvider already used a feature-flag-driven approach via feeCollection.waiveList. This PR aligns the UI layer with the existing pattern:

  • parsePolymarketEvents: Switch tag mapping from t.label to t.slug so parsed market tags match the slug-based waiveList entries used by waiveFees()
  • selectPredictFeeCollectionFlag: New selector that reads the predictFeeCollection remote feature flag, falling back to DEFAULT_FEE_COLLECTION_FLAG
  • PredictMarketDetails: Replace hardcoded tags?.includes('Middle East') with tags?.some(slug => waiveList.includes(slug)) driven by the selector
  • Added defensive optional chaining on tags access for safety

Changelog

CHANGELOG entry: null

Related issues

Fixes: PRED-736

Manual testing steps

Feature: Fee exemption display on market details

  Scenario: user views a market with a tag in the waiveList
    Given the remote feature flag predictFeeCollection has waiveList containing 'middle-east'
    And a market has the tag slug 'middle-east'

    When user navigates to the market details screen
    Then the fee exemption message is displayed

  Scenario: user views a market without waived tags
    Given the remote feature flag predictFeeCollection has waiveList containing 'middle-east'
    And a market only has tag slugs 'sports' and 'politics'

    When user navigates to the market details screen
    Then the fee exemption message is not displayed

  Scenario: user views a market when waiveList is empty
    Given the remote feature flag predictFeeCollection has an empty waiveList
    And a market has any tags

    When user navigates to the market details screen
    Then the fee exemption message is not displayed

Screenshots/Recordings

Before

N/A — logic change only, no visual diff

After

N/A — logic change only, no visual diff

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
Changes Predict market tags from human-readable labels to slugs and uses remote predictFeeCollection.waiveList to control fee-exemption UI, which could affect any UI/analytics expecting label-form tags. Logic is straightforward and covered by updated/additional selector and view tests.

Overview
Aligns fee-exemption behavior in PredictMarketDetails with the fee-collection feature flag by replacing the hardcoded 'Middle East' tag check with a waiveList (slug) match from the new selectPredictFeeCollectionFlag selector (defaulting to DEFAULT_FEE_COLLECTION_FLAG).

Updates Polymarket parsing to store market tags as tag slugs (t.slug) instead of labels, and adjusts tests to validate the new slug-based exemption behavior plus selector fallbacks when the remote flag is missing/null/undefined.

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

…ails

Replace hardcoded 'Middle East' tag check with feature-flag-driven
waiveList matching via selectPredictFeeCollectionFlag selector, aligning
PredictMarketDetails with the existing pattern in PredictController and
PolymarketProvider.

- Switch parsePolymarketEvents tag mapping from label to slug to match
  waiveFees() slug-based matching
- Add selectPredictFeeCollectionFlag selector reading from remote config
- Use waiveList from fee collection config for fee exemption in UI
- Add defensive optional chaining on tags access
- Add selector tests for selectPredictFeeCollectionFlag
- Update PredictMarketDetails tests to use slug-based tags and provide
  RemoteFeatureFlagController state with waiveList config
@github-actions

github-actions Bot commented Mar 5, 2026

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.

@metamaskbot metamaskbot added the team-predict Predict team label Mar 5, 2026
@matallui matallui changed the title fix: make fee exemption logic feature-flag-driven in PredictMarketDetails fix(predict): make fee exemption logic feature-flag-driven in PredictMarketDetails cp-7.69.0 Mar 5, 2026
@github-actions github-actions Bot added the size-M label Mar 5, 2026
@matallui matallui marked this pull request as ready for review March 5, 2026 20:35
@matallui matallui requested a review from a team as a code owner March 5, 2026 20:35

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: @PerformancePredict
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are focused on the Predict/Predictions feature (Polymarket integration):

  1. polymarket/utils.ts: Changed tag mapping from t.label to t.slug and added optional chaining for waiveList?.includes() to prevent null reference errors.

  2. selectors/featureFlags/index.ts: Added new selectPredictFeeCollectionFlag selector for remote feature flag configuration of fee collection settings.

  3. PredictMarketDetails.tsx: Replaced hardcoded "Middle East" fee exemption check with dynamic logic using the new selector and waiveList from remote feature flags.

  4. Test files: Comprehensive test updates for the new selector and updated market details tests to use slug-based tags.

The changes are well-contained within the Predict module with comprehensive unit tests. SmokePredictions is the primary tag for Polymarket prediction market testing. Per the tag descriptions, SmokeWalletPlatform is needed because "Predictions is also a section inside the Trending tab" and SmokeConfirmations is needed because "opening/closing positions are on-chain transactions".

Performance Test Selection:
The changes modify PredictMarketDetails.tsx which is a core view component for prediction markets. The @PerformancePredict tag covers prediction market list loading, market details, deposit flows, and balance display - all of which could be affected by the new selector usage and fee exemption logic changes. While the changes are primarily logic-based rather than rendering-focused, adding a new useSelector hook and changing the fee exemption calculation could have minor performance implications worth validating.

View GitHub Actions results

@caieu caieu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

⚠️ E2E Fixture Validation — Structural changes detected

Category Count
New keys 68
Missing keys 11
Type mismatches 0
Value mismatches 7 (informational)

The committed fixture schema is out of date. To update, comment:

@metamaskbot update-mobile-fixture

View full details | Download diff report

@sonarqubecloud

sonarqubecloud Bot commented Mar 5, 2026

Copy link
Copy Markdown

@matallui matallui added this pull request to the merge queue Mar 5, 2026
Merged via the queue into main with commit 098426e Mar 5, 2026
99 checks passed
@matallui matallui deleted the predict/fix-fee-exemption-logic branch March 5, 2026 23:36
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 5, 2026
@metamaskbot metamaskbot added the release-7.70.0 Issue or pull request that will be included in release 7.70.0 label Mar 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.70.0 Issue or pull request that will be included in release 7.70.0 size-M team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants