Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(27256): implement remote feature flag feature #28684

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

DDDDDanica
Copy link
Contributor

@DDDDDanica DDDDDanica commented Nov 25, 2024

Description

Open in GitHub Codespaces

Related issues

Fixes: #27256

Manual testing steps

  1. Load the extension
  2. Option 1: input chrome.storage.local.get(console.log) in dev tools console, and you'll find in data => RemoteFeatureFlagController => contains 2 dataset, cacheTimestamp and remoteFeatureFlags with value
  3. Option 2: go to settings => advanced, and click download stage logs button, you'll find remoteFeatureFlags with cached value in your state.
  4. Option 3: Settings => about page, if you open console in dev tools, there's a log after Feature flag fetched successfully, which will be removed after we implement 1st feature flag in production

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.

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.

Copy link

sentry-io bot commented Nov 25, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: app/scripts/background.js

Function Unhandled Issue
setupController Error: Custom network client not found with ID '8f31c082-5580-4881-b948-616db1204095' ...
Event Count: 230 Affected Users: 0
initialize TypeError: e is not iterable /scripts/app-init.js
Event Count: 147 Affected Users: 0
setupController Error: NetworkController state is invalid: selectedNetworkClientId '54875d44-238f-416a-8033-765a3a2307... ...
Event Count: 71 Affected Users: 0

Did you find this useful? React with a 👍 or 👎

@DDDDDanica DDDDDanica force-pushed the feature/27256-remote-feature-flag branch 13 times, most recently from 3942cd2 to 9bddc8d Compare November 27, 2024 23:55
@@ -60,7 +61,7 @@ const mapStateToProps = (state, ownProps) => {
const {
metamask: { currencyRates },
} = state;

const remoteFeatureFlags = getRemoteFeatureFlags(state);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will be removed after 1st feature flag is implemented in production

@@ -53,6 +57,13 @@ export default class InfoTab extends PureComponent {
componentDidMount() {
const { t } = this.context;
handleSettingsRefs(t, t('about'), this.settingsRefs);
if (this.props.remoteFeatureFlags.length > 0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will be removed after 1st feature flag is implemented in production

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of (this.props.remoteFeatureFlags.length > 0, can we use an actual feature flag. So that this becomes something like

if (this.props.remoteFeatureFlags[TEST_FLAG] > 0) {
    console.log(

So we can fully demonstrate how teams would use the feature flag system?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, added 5204e9c

@@ -885,12 +884,16 @@ export function setupController(
senderUrl?.origin === `chrome-extension://${browser.runtime.id}`;
}

controller.remoteFeatureFlagController.getRemoteFeatureFlags();
Copy link
Contributor

Choose a reason for hiding this comment

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

we will need error handling here now

Copy link
Contributor

Choose a reason for hiding this comment

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

and should we remove the controller.remoteFeatureFlagController.getRemoteFeatureFlags() call on 887, because we have one on 896?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this line is removed, it was for testing purpose 🙏🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error handling within initializeRemoteFeatureFlags can be found 5204e9c

@DDDDDanica DDDDDanica force-pushed the feature/27256-remote-feature-flag branch from 0e78bb0 to e1c605a Compare November 28, 2024 17:43
app/scripts/background.js Outdated Show resolved Hide resolved
@DDDDDanica DDDDDanica force-pushed the feature/27256-remote-feature-flag branch 2 times, most recently from d6d0a91 to a2b12b6 Compare November 28, 2024 19:56
Copy link

socket-security bot commented Nov 28, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

@DDDDDanica DDDDDanica self-assigned this Nov 28, 2024
@DDDDDanica DDDDDanica force-pushed the feature/27256-remote-feature-flag branch from a2b12b6 to 79cdc1c Compare November 28, 2024 21:31
@DDDDDanica DDDDDanica marked this pull request as ready for review November 28, 2024 21:33
@DDDDDanica DDDDDanica requested review from a team as code owners November 28, 2024 21:33
@DDDDDanica DDDDDanica force-pushed the feature/27256-remote-feature-flag branch from 3483879 to fe30412 Compare November 29, 2024 23:38
@DDDDDanica
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policy update failed. You can review the logs or retry the policy update here

@DDDDDanica DDDDDanica force-pushed the feature/27256-remote-feature-flag branch from fe30412 to 8a0160f Compare November 30, 2024 00:05
@DDDDDanica
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policy update failed. You can review the logs or retry the policy update here

@DDDDDanica DDDDDanica force-pushed the feature/27256-remote-feature-flag branch from 8a0160f to b2940dd Compare November 30, 2024 00:50
@DDDDDanica
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policy update failed. You can review the logs or retry the policy update here

@DDDDDanica DDDDDanica force-pushed the feature/27256-remote-feature-flag branch from b2940dd to 5a8a088 Compare November 30, 2024 01:08
Copy link

socket-security bot commented Nov 30, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/remote-feature-flag-controller@1.0.0 None 0 115 kB metamaskbot

View full report↗︎

@DDDDDanica DDDDDanica force-pushed the feature/27256-remote-feature-flag branch from 948446f to a3f90aa Compare November 30, 2024 02:09
@DDDDDanica
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

@DDDDDanica DDDDDanica force-pushed the feature/27256-remote-feature-flag branch from d30565a to a26c834 Compare November 30, 2024 03:01
@DDDDDanica
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs more work from the author
Development

Successfully merging this pull request may close these issues.

Implement feature flags in extension
4 participants