fix: Fix MV2 build sourcemap upload (#26467)#26582
Merged
Gudahtt merged 2 commits intoVersion-v12.0.6from Aug 21, 2024
Merged
Conversation
56f7c54 to
6383129
Compare
Gudahtt
commented
Aug 21, 2024
shared/modules/mv3.utils.js
Outdated
Member
Author
There was a problem hiding this comment.
There were a few changes made here in #26059 that I included in this cherry-pick as well, as my changes depended on them. Specifically:
- This constant is now exported
- The fallback on
process.env.ENABLE_MV3was added
I did this rather than cherry-picking the entirety of #26059 because that PR impacted a much wider scope, would have been more complex and riskier to back port in its entirety. cc @HowardBraham
Member
Author
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## Version-v12.0.6 #26582 +/- ##
===================================================
- Coverage 65.75% 65.74% -0.00%
===================================================
Files 1372 1372
Lines 54766 54772 +6
Branches 14260 14268 +8
===================================================
+ Hits 36006 36008 +2
- Misses 18760 18764 +4 ☔ View full report in Codecov by Sentry. |
Collaborator
Builds ready [ff88054]
Page Load Metrics (144 ± 179 ms)
|
desi
approved these changes
Aug 21, 2024
ff88054 to
cba1527
Compare
Member
Author
|
Rebased to resolve a conflict in the imports |
**Description** The sourcemaps for MV2 builds (used for Firefox) were not being uploaded to Sentry at all. This resulted in invalid stack traces for Firefox error reports. The Sentry initiatization has been updated to use a `dist` option, letting us differentiate between different types of build for the same version. This is now used to signify which builds are mv2 and which are mv3. Both distributions are uploaded separately as part of the release process (for Flask and main builds; we don't have MV2 builds for MMI or beta). [](https://codespaces.new/MetaMask/metamask-extension/pull/26467?quickstart=1) **Related issues** Fixes #26466 **Manual testing steps** Unfortunately I don't know of an easy way to test the CircleCI changes. Those will just have to be read carefully. We can test the application changes and the Sentry script changes though. The two outcomes we want to test are: * The source code and sourcemaps are uploaded correctly for both MV2 and MV3 builds * Application bundles for MV2 and MV3 builds are reporting errors properly tagged as being from an MV2 or MV3 build, and are mapped correctly in Sentry. Here are the steps I used to test this: * Setup a personal Sentry account with a `metamask` project * Create a Custom Integration in Sentry (Settings -> Custom Integrations) * Steps: * Navigate to "Settings -> Custom Integrations" on the Sentry dashboard for your personal Sentry account * Click the purple "Create New Integration" button on the top-right of the page * Select "Internal integration" * Provide any name, and grant it "Admin" access to "Releases" * Alternatively an Auth Token might work as well, but some of the commands used by our script to check for pre-existing releases seem to not work with the `org:ci` scope, which is the only scope available for Sentry auth tokens. * Checkout this branch * Bump the patch version in `package.json` (just in case you need to re-test, this is an easy way to separate old errors/builds from new ones) * Before creating builds, make sure that `SENTRY_DSN_DEV` is set to the DSN of your personal Sentry account's `metamask` project * Run `yarn dist:mv2` to create an MV2 build * Move it to the `dist-mv2` directory (`mv dist dist-mv2`) * Run `yarn dist` to create an MV3 build * Before uploading sourcemaps, make sure that `SENTRY_AUTH_TOKEN` is set to the Auth Token generated from the custom integration earlier. * Run `yarn sentry:publish --org [your organization]` to upload the MV3 build * Run `yarn sentry:publish --org [your organization] --dist mv2` to upload the MV2 build At this point, you should be able to see the releases on the Sentry dashboard along with the artifacts. Look in "Settings -> Projects -> Source Maps" for these. They are labeled by release number and dist. Now, load each build in your browser (one at a time, never both enabled at once) and follow these steps: * Proceed through onboarding, opting in to MetaMetrics * Navigate to the test-dapp and connect to it * Click the "INVALID TRANSACTION TYPE (NOT SUPPORTED)" button in the "Malformed Transactions" section of the test dapp, then reject the confirmation after it shows up. This should trigger an error in Sentry. * Look for the error in Sentry and ensure that the frame that shows `transactionController.updateSecurityAlertResponse(` is mapped to source code correctly (it should resolve to `app/scripts/lib/ppom/ppom-util.ts`). Also check that the `dist` is correct in the "Tags" section of the Sentry issue page. <details> <summary> Here are screenshots of what that looked like for me: </summary>   </details> **Screenshots/Recordings** N/A **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. **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.
…its loaded in Node.js
cba1527 to
362e669
Compare
Collaborator
Builds ready [362e669]
Page Load Metrics (47 ± 3 ms)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a cherry-pick of #26467 for v12.0.6. Original description:
Description
The sourcemaps for MV2 builds (used for Firefox) were not being uploaded to Sentry at all. This resulted in invalid stack traces for Firefox error reports.
The Sentry initiatization has been updated to use a
distoption, letting us differentiate between different types of build for the same version. This is now used to signify which builds are mv2 and which are mv3. Both distributions are uploaded separately as part of the release process (for Flask and main builds; we don't have MV2 builds for MMI or beta).Related issues
Fixes #26466
Manual testing steps
Unfortunately I don't know of an easy way to test the CircleCI changes. Those will just have to be read carefully.
We can test the application changes and the Sentry script changes though. The two outcomes we want to test are:
Here are the steps I used to test this:
metamaskprojectorg:ciscope, which is the only scope available for Sentry auth tokens.package.json(just in case you need to re-test, this is an easy way to separate old errors/builds from new ones)SENTRY_DSN_DEVis set to the DSN of your personal Sentry account'smetamaskprojectyarn dist:mv2to create an MV2 builddist-mv2directory (mv dist dist-mv2)yarn distto create an MV3 buildSENTRY_AUTH_TOKENis set to the Auth Token generated from the custom integration earlier.yarn sentry:publish --org [your organization]to upload the MV3 buildyarn sentry:publish --org [your organization] --dist mv2to upload the MV2 buildAt this point, you should be able to see the releases on the Sentry dashboard along with the artifacts. Look in "Settings -> Projects -> Source Maps" for these. They are labeled by release number and dist.
Now, load each build in your browser (one at a time, never both enabled at once) and follow these steps:
transactionController.updateSecurityAlertResponse(is mapped to source code correctly (it should resolve toapp/scripts/lib/ppom/ppom-util.ts). Also check that thedistis correct in the "Tags" section of the Sentry issue page.Here are screenshots of what that looked like for me:
Screenshots/Recordings
N/A
Pre-merge author checklist
Standards.
Pre-merge reviewer checklist