Skip to content

Conversation

@asalsys
Copy link
Contributor

@asalsys asalsys commented Nov 6, 2025

Description

Use metamask enviornment variable instead of node_env to view feature override dashboard

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user navigates to Feature Flag Override Dashboard in settings
    Given the metamask eviornment is not production

    When user navigates to settings
    Then they will see and navigate to the Feature Flag Override Dashboard

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

Switches visibility gating from NODE_ENV to METAMASK_ENVIRONMENT for Feature Flag Override screens and adds tests; also memoizes feature flag context helpers.

  • Navigation & Settings
    • Replace process.env.NODE_ENV !== 'production' with process.env.METAMASK_ENVIRONMENT !== 'production' to conditionally show Routes.FEATURE_FLAG_OVERRIDE in MainNavigator and the Feature Flag Override drawer in Views/Settings.
  • Tests
    • Update MainNavigator.test.tsx and Views/Settings/index.test.tsx to use METAMASK_ENVIRONMENT, including setup/teardown of env var and assertions that Feature Flag Override is present in non-production.
  • Feature Flag Context
    • Memoize featureFlagsList, getFeatureFlag, and the provided context value via useMemo/useCallback.
    • Use process.env.METAMASK_ENVIRONMENT in minimum version validation.

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

@asalsys asalsys requested a review from a team November 6, 2025 20:50
@asalsys asalsys self-assigned this Nov 6, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

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 Nov 6, 2025
tommasini
tommasini previously approved these changes Nov 6, 2025
@asalsys asalsys marked this pull request as ready for review November 6, 2025 22:19
@asalsys asalsys enabled auto-merge November 6, 2025 22:20
/>
)}
{process.env.NODE_ENV !== 'production' && (
{process.env.METAMASK_ENVIRONMENT !== 'production' && (
Copy link

Choose a reason for hiding this comment

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

Bug: Defaulting environment check reveals feature flag override dashboard

When METAMASK_ENVIRONMENT is undefined, the condition evaluates to true because undefined !== 'production', incorrectly showing the Feature Flag Override dashboard. This differs from the original NODE_ENV behavior which typically has a default value. The safer approach would be to explicitly check for non-production values or provide a default.

Fix in Cursor Fix in Web

}}
/>
{process.env.NODE_ENV !== 'production' && (
{process.env.METAMASK_ENVIRONMENT !== 'production' && (
Copy link

Choose a reason for hiding this comment

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

Bug: Non-Production Burn-In Flag Activation Bug

When METAMASK_ENVIRONMENT is undefined, the condition evaluates to true because undefined !== 'production', incorrectly registering the Feature Flag Override screen. This differs from the original NODE_ENV behavior which typically has a default value. The safer approach would be to explicitly check for non-production values or provide a default.

Fix in Cursor Fix in Web

@asalsys asalsys force-pushed the fix/use-METAMASK_ENVIRONMENT branch from e4418ee to 3aa2b34 Compare November 7, 2025 10:54
@github-actions github-actions bot added size-S and removed size-XS labels Nov 7, 2025
@asalsys asalsys requested a review from tommasini November 8, 2025 14:04
@asalsys asalsys force-pushed the fix/use-METAMASK_ENVIRONMENT branch from 47d2410 to ac01b7c Compare November 10, 2025 13:51
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.88%. Comparing base (dddee92) to head (ac01b7c).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #22282      +/-   ##
==========================================
+ Coverage   77.86%   77.88%   +0.02%     
==========================================
  Files        3826     3823       -3     
  Lines       98105    97831     -274     
  Branches    19236    19211      -25     
==========================================
- Hits        76389    76200     -189     
+ Misses      16480    16397      -83     
+ Partials     5236     5234       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud
Copy link

@asalsys asalsys added this pull request to the merge queue Nov 10, 2025
Merged via the queue into main with commit 1f4fbdf Nov 10, 2025
84 checks passed
@asalsys asalsys deleted the fix/use-METAMASK_ENVIRONMENT branch November 10, 2025 17:12
@github-actions github-actions bot locked and limited conversation to collaborators Nov 10, 2025
@metamaskbot metamaskbot added the release-7.60.0 Issue or pull request that will be included in release 7.60.0 label Nov 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants