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: remove PermissionLogController in favor of core implementation #23182

Merged
merged 20 commits into from
Mar 1, 2024

Conversation

cryptodev-2s
Copy link
Contributor

@cryptodev-2s cryptodev-2s commented Feb 26, 2024

Description

Following the successful migration of PermissionLogController to the core monorepo (MetaMask/core#1826), this commit removes the redundant PermissionLogController logic from the extension. All future developments and maintenance will be concentrated on the core implementation to streamline efforts and enhance functionality coherence across the platform.

Open in GitHub Codespaces

Related issues

  • Fixes: 23181

Changes

The transition of this controller from the extension repo to the core monorepo unfolded in three phases:

  1. The controller was integrated into Core, with more information available at Import permission log controller core#1871
  2. The logic of the controller was streamlined, with additional details at feat: simplify permission log controller core#3662
  3. The tests for the controller were overhauled, with further information at Refactor PermissionLogController tests core#3937

Manual testing steps

These instructions outline the process for conducting manual testing locally.

  1. Launch the extension from the latest development branch.
  2. Navigate to the test-dapp.
  3. Initiate the REQUEST_PERMISSIONS action from the Permissions Actions menu.
  4. Open the background.html inspect window.
  5. Execute the script chrome.storage.local.get(null, ({data}) => console.log(data.PermissionLogController)) in the console.
  6. Record the output from the previous step.
  7. Switch to the branch named feature/23181-remove-Permissionlogcontroller.
  8. Repeat steps 2 through 6 for this branch.
  9. Compare the outputs from step 6 for both the development and feature branches. Look for matching entries in permissionHistory and permissionActivityLog from the initial run in the second run's output. Note that the log history is limited to 100 entries.

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Feb 26, 2024
Copy link

socket-security bot commented Feb 26, 2024

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

@mcmire mcmire linked an issue Feb 26, 2024 that may be closed by this pull request
9 tasks
@cryptodev-2s
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated

@cryptodev-2s cryptodev-2s requested review from a team as code owners February 27, 2024 14:25
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safe to do this? Could we remove this file in a later PR so that we can first verify whether the core controller passes all existing extension-side tests, and if not, which tests break?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did manual testing I also explained how to test it on Manual testing steps, let me know if this is enough

Copy link
Contributor

Choose a reason for hiding this comment

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

I see that this test file was migrated to core as part of the first step: MetaMask/core#1871. Looks like my concerns weren't warranted. I'm good with moving forward on this.

@MajorLift
Copy link
Contributor

Could we put together a list of breaking changes caused by replacing the extension implementation with the core implementation? Extension users need to be able to quickly reference the API changes introduced by this PR. Here's an example I'm working on: #22928

Copy link

codecov bot commented Feb 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.65%. Comparing base (8d6f356) to head (5cd6baa).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #23182      +/-   ##
===========================================
+ Coverage    68.64%   68.65%   +0.01%     
===========================================
  Files         1099     1098       -1     
  Lines        43362    43185     -177     
  Branches     11575    11532      -43     
===========================================
- Hits         29764    29647     -117     
+ Misses       13598    13538      -60     

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

@cryptodev-2s
Copy link
Contributor Author

Could we put together a list of breaking changes caused by replacing the extension implementation with the core implementation? Extension users need to be able to quickly reference the API changes introduced by this PR. Here's an example I'm working on: #22928

I updated the PR Changes with all the work that has been done on this subject, let me know if that is okay regarding your remark ?

@metamaskbot
Copy link
Collaborator

Builds ready [1b10c72]
Page Load Metrics (1028 ± 410 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint892111363115
domContentLoaded106432199
load6723161028855410
domInteractive106431199
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.79 KiB (0.08%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [2253a0c]
Page Load Metrics (1075 ± 433 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint732281293919
domContentLoaded117529199
load6021501075902433
domInteractive117529199
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.8 KiB (0.08%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [406b162]
Page Load Metrics (1439 ± 441 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint602241224321
domContentLoaded96922147
load4725361439919441
domInteractive96922147
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.8 KiB (0.08%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@cryptodev-2s
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated

@metamaskbot
Copy link
Collaborator

Builds ready [95418a8]
Page Load Metrics (931 ± 402 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint832281223216
domContentLoaded116730157
load691992931838402
domInteractive116730157
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.67 KiB (0.07%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [95418a8]
Page Load Metrics (1201 ± 413 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint741831092914
domContentLoaded10522094
load6027081201860413
domInteractive10522094
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.67 KiB (0.07%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [f312b53]
Page Load Metrics (725 ± 434 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint671591092512
domContentLoaded106325168
load532809725904434
domInteractive106225168
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.67 KiB (0.07%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@MajorLift
Copy link
Contributor

@cryptodev-2s I think we should have an extension user-facing changelog here that leaves out implementation details and only describes the API changes between permission-log.js vs. the core PermissionLogController.

Looks like the Changes section in MetaMask/core#3662 provides some of this, but does this list cover the effects of all three PRs? If so, I'm good with leaving a link to that section.

@cryptodev-2s
Copy link
Contributor Author

@cryptodev-2s I think we should have an extension user-facing changelog here that leaves out implementation details and only describes the API changes between permission-log.js vs. the core PermissionLogController.

Looks like the Changes section in MetaMask/core#3662 provides some of this, but does this list cover the effects of all three PRs? If so, I'm good with leaving a link to that section.

yes exactly the PR MetaMask/core#3662. covers all the changes made on the controller that the extension team should be aware of.

@metamaskbot
Copy link
Collaborator

Builds ready [ad80c30]
Page Load Metrics (929 ± 506 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint752361213919
domContentLoaded108927189
load5930169291054506
domInteractive108927189
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.67 KiB (0.07%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [2255058]
Page Load Metrics (1033 ± 417 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint722601324522
domContentLoaded106230178
load5420031033868417
domInteractive106230178
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.67 KiB (0.07%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link
Contributor

@MajorLift MajorLift left a comment

Choose a reason for hiding this comment

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

Maybe we could highlight the #3662 Changes section more clearly in the PR description as containing the changelog for this, but otherwise LGTM!

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

I've run through the manual testing steps. Everything looks as it should.

@mcmire
Copy link
Contributor

mcmire commented Mar 1, 2024

I'm not sure what's going on with CI. I don't think it's related to these changes. I think it's being fixed by #23249.

@metamaskbot
Copy link
Collaborator

Builds ready [5cd6baa]
Page Load Metrics (1252 ± 375 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint881631192411
domContentLoaded967292110
load7722861252781375
domInteractive967292110
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.67 KiB (0.07%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@cryptodev-2s cryptodev-2s merged commit 61a79e0 into develop Mar 1, 2024
67 checks passed
@cryptodev-2s cryptodev-2s deleted the feature/23181-remove-Permissionlogcontroller branch March 1, 2024 13:48
@github-actions github-actions bot locked and limited conversation to collaborators Mar 1, 2024
@metamaskbot metamaskbot added the release-11.13.0 Issue or pull request that will be included in release 11.13.0 label Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template release-11.13.0 Issue or pull request that will be included in release 11.13.0 team-wallet-framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use PermissionLogController from core
4 participants