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

fix: Fix bundle size diffs #29862

Merged
merged 1 commit into from
Jan 24, 2025
Merged

fix: Fix bundle size diffs #29862

merged 1 commit into from
Jan 24, 2025

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Jan 22, 2025

Description

Fix bundle size diffs that are included in metamaskbot comments.

The diffs were incorrect because the "merge base" commit was wrong. The merge base commit is the commit we're comparing the branch against. We were calculating this using git merge-base origin/main HEAD, which locally does give the correct answer. But in GitHub Actions, HEAD was not set to the tip of the branch. Instead it was a new commit generated during the checkout step, representing the target branch merged into the current branch.

This resulted in the "merge base" always being the tip of main (at the time of this workflow run). This in turn resulted in the "bundle diff" including changes that were already made on main

Open in GitHub Codespaces

Related issues

Fixes #29858.

Manual testing steps

I created a second draft PR to add diagnostic logs for testing this: #29859

You can see an example of these logs here: https://github.com/MetaMask/metamask-extension/actions/runs/12917863547/job/36025202434?pr=29859

Note that the HEAD resolves to a totally different commit than the real head of the branch (which is accessible as pull_request.head.sha), resulting in a different merge base.

Screenshots/Recordings

N/A

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.

Fix bundle size diffs that are included in `metamaskbot` comments and
tracked historically in https://github.com/MetaMask/extension_bundlesize_stats

The diffs were incorrect because the "merge base" commit was wrong. The
merge base commit is the commit we're comparing the branch against. We
were calculating this using `git merge-base origin/main HEAD`, which
locally does give the correct answer. But in GitHub Actions, HEAD was
not set to the tip of the branch. Instead it was a new comment
generated during the checkout step, representing the target branch
merged into the current branch.

This resulted in the "merge base" always being the tip of `main` (at
the time of this workflow run). This in turn resulted in the "bundle
diff" including changes that were already made on `main`

Fixes #29858.
@Gudahtt Gudahtt force-pushed the fix-bundle-comparisons branch from f6933c7 to 76abec7 Compare January 22, 2025 23:08
@Gudahtt Gudahtt marked this pull request as ready for review January 22, 2025 23:08
@@ -22,9 +22,10 @@ jobs:
- name: Get merge base commit hash
id: get-merge-base
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
Copy link
Member Author

@Gudahtt Gudahtt Jan 22, 2025

Choose a reason for hiding this comment

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

Switched from ref to sha so that this is less dependent upon the branch having been fetched in the checkout step.

Currently it is fetched, as the checkout action will fetch all branches when you specify a fetch-depth of 0. But I wanted this to be resilient to that changing in the future.

@metamaskbot
Copy link
Collaborator

Builds ready [76abec7]
Page Load Metrics (1776 ± 147 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint47220941569391188
domContentLoaded147827201758310149
load148627261776307147
domInteractive25223504321
backgroundConnect55113105
firstReactRender1586452612
getState45114157
initialActions00000
loadScripts107121631317266128
setupStore55812157
uiStartup164231902034372178
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@Gudahtt Gudahtt added this pull request to the merge queue Jan 24, 2025
Merged via the queue into main with commit 2290ce0 Jan 24, 2025
80 checks passed
@Gudahtt Gudahtt deleted the fix-bundle-comparisons branch January 24, 2025 18:59
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2025
@metamaskbot metamaskbot added the release-12.12.0 Issue or pull request that will be included in release 12.12.0 label Jan 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.12.0 Issue or pull request that will be included in release 12.12.0 team-extension-platform team-wallet-framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Bundle size diffs appear to be incorrect
4 participants