Skip to content

Conversation

@sallem-consensys
Copy link
Contributor

@sallem-consensys sallem-consensys commented Oct 28, 2025

Description

While fetching feature flag value, flags that support minimum version will automatically validate if the version is supported

Changelog

CHANGELOG entry: null

Related issues

Fixes:
https://consensyssoftware.atlassian.net/browse/MCWP-177

Manual testing steps

Feature: automatcally check if minimum required version is supported for feature flag

  Scenario: user calls getFeatureFlag
    Given feature flag key

    When user calls getFeatureFlag
    Then the minimum version is automatically validated and a toast is thrown in non production environment if the version does not support the flag

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

Updates feature flag context to return raw values and auto-validate boolean-with-minimumVersion flags with a non-production toast on unsupported versions; adjusts UI type export and expands tests.

  • Feature Flag Context (app/contexts/FeatureFlagOverrideContext.tsx):
    • getFeatureFlag now returns the raw flag value (or undefined) instead of FeatureFlagInfo.
    • Adds minimum version validation for boolean with minimumVersion flags via isMinimumRequiredVersionSupported; shows a Toast (non-production) and returns false if unsupported.
    • Integrates ToastContext and ToastVariants; introduces validateMinimumVersion helper.
  • UI (app/components/Views/FeatureFlagOverride/FeatureFlagOverride.tsx):
    • Exports MinimumVersionFlagValue interface for shared typing.
  • Tests (app/contexts/FeatureFlagOverrideContext.test.tsx):
    • Mocks Toast context; adds comprehensive tests for new getFeatureFlag behavior and version validation logic across environments.
    • Updates existing tests to expect raw values and new flag metadata access paths.

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

@sallem-consensys sallem-consensys self-assigned this Oct 28, 2025
@sallem-consensys sallem-consensys requested review from a team as code owners October 28, 2025 14:00
@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.

@metamaskbot metamaskbot added the team-mobile-platform Mobile Platform team label Oct 28, 2025
@sallem-consensys sallem-consensys changed the base branch from main to feat/ffr-mwmr-175 October 28, 2025 14:00
@sallem-consensys sallem-consensys changed the base branch from feat/ffr-mwmr-175 to main October 28, 2025 14:01
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@sallem-consensys sallem-consensys marked this pull request as draft October 29, 2025 18:29
@github-actions github-actions bot added size-M and removed size-XL labels Oct 29, 2025
@sallem-consensys sallem-consensys force-pushed the feat/ffr-mcwp-177 branch 2 times, most recently from ee9fe41 to daa18fe Compare October 29, 2025 23:48
@sonarqubecloud
Copy link

@sallem-consensys sallem-consensys marked this pull request as ready for review October 30, 2025 16:17
return flagValue.enabled;
},
[toastRef],
);
Copy link

Choose a reason for hiding this comment

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

Bug: Version Validation Fails in Production

The validateMinimumVersion function incorrectly returns flagValue.enabled for unsupported minimum versions in production. The version support check is currently coupled with the NODE_ENV condition, preventing it from returning false in production when a version is unsupported. This is contrary to test expectations, where version validation should apply regardless of environment.

Fix in Cursor Fix in Web

@sallem-consensys sallem-consensys added this pull request to the merge queue Oct 30, 2025
Merged via the queue into main with commit f641edd Oct 30, 2025
85 checks passed
@sallem-consensys sallem-consensys deleted the feat/ffr-mcwp-177 branch October 30, 2025 19:07
@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 2025
@metamaskbot metamaskbot added the release-7.59.0 Issue or pull request that will be included in release 7.59.0 label Oct 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.59.0 Issue or pull request that will be included in release 7.59.0 size-M team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants