Skip to content

ci: Check bundle size increases per PR - #24737

Open
nicohrubec wants to merge 16 commits into
developfrom
feat/per-pr-bundle-size-check
Open

nicohrubec wants to merge 16 commits into
developfrom
feat/per-pr-bundle-size-check

Conversation

@nicohrubec

@nicohrubec nicohrubec commented Sep 25, 2026 •

Copy link
Copy Markdown
Member
  • Base-branch CI measures bundle sizes and saves them as baseline artifacts.
  • On each PR, Size Check first checks for Accept Bundlesize Increase. If present, it passes without measuring again.
  • Otherwise, it measures the PR bundles, compares them with the target branch's saved baseline, and updates the size-report table.
  • If any existing gzipped bundle grows by more than 500 bytes, the check fails and posts a separate notice explaining the label, unless that notice already exists.
  • Adding or removing the label waits for the current CI run to finish, then reruns the original Size Check and its dependent jobs.

Also removing the old absolute size limits and the weekly size limit update workflow, since these are no longer needed now.

Fixes #21813

Comment thread scripts/size-limit-rerun.test.ts Outdated
nicohrubec and others added 2 commits September 25, 2026 13:49
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
@nicohrubec
nicohrubec force-pushed the feat/per-pr-bundle-size-check branch from 93485e5 to cf9b39e Compare September 25, 2026 11:50
nicohrubec and others added 5 commits September 25, 2026 14:27
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread .github/workflows/size-check.yml

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread dev-packages/size-limit-gh-action/index.mjs
Comment thread dev-packages/size-limit-gh-action/index.mjs
@getsentry getsentry deleted a comment from github-actions Bot Sep 26, 2026
Co-Authored-By: GPT-6 <codex@openai.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8900460. Configure here.

Comment thread dev-packages/size-limit-gh-action/index.mjs
Comment thread .github/workflows/size-check.yml Outdated
@getsentry getsentry deleted a comment from github-actions Bot Sep 26, 2026
@getsentry getsentry deleted a comment from github-actions Bot Sep 26, 2026
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
@getsentry getsentry deleted a comment from github-actions Bot Sep 26, 2026
@getsentry getsentry deleted a comment from github-actions Bot Sep 26, 2026
@nicohrubec
nicohrubec marked this pull request as ready for review September 26, 2026 09:11
Comment thread dev-packages/size-limit-gh-action/utils/SizeLimitFormatter.mjs
Comment thread dev-packages/size-limit-gh-action/utils/SizeLimitFormatter.mjs
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: The baseline is behind the target branch. Re-run after the latest base build completes for up-to-date results.

Path Size % Change Change
@sentry/browser 29.36 kB - -
@sentry/browser - with treeshaking flags 27.65 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.54 kB +0.01% +1 B 🔺
@sentry/browser (incl. Tracing) 51.31 kB +0.01% +1 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 51.32 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.31 kB -0.01% -1 B 🔽
@sentry/browser (incl. Tracing, Replay) 90.89 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.99 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.59 kB +0.01% +1 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 108.57 kB - -
@sentry/browser (incl. Feedback) 46.88 kB - -
@sentry/browser (incl. sendFeedback) 34.43 kB - -
@sentry/browser (incl. FeedbackAsync) 39.54 kB - -
@sentry/browser (incl. Metrics) 30.38 kB - -
@sentry/browser (incl. Logs) 30.66 kB - -
@sentry/browser (incl. Metrics & Logs) 31.33 kB - -
@sentry/react 31.2 kB +0.01% +1 B 🔺
@sentry/react (incl. Tracing) 53.67 kB - -
@sentry/vue 36.9 kB - -
@sentry/vue (incl. Tracing) 53.88 kB - -
@sentry/svelte 29.39 kB - -
CDN Bundle 31.18 kB - -
CDN Bundle (incl. Tracing) 51.95 kB - -
CDN Bundle (incl. Logs, Metrics) 33.43 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.89 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.16 kB +0.01% +1 B 🔺
CDN Bundle (incl. Tracing, Replay) 89.52 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.5 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.7 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.67 kB - -
CDN Bundle - uncompressed 92.05 kB - -
CDN Bundle (incl. Tracing) - uncompressed 154.44 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 98.62 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 160.39 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 228.19 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 274.17 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 280.1 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.87 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.8 kB - -
@sentry/nextjs (client) 55.91 kB +0.01% +1 B 🔺
@sentry/sveltekit (client) 51.74 kB - -
@sentry/core/server 39.99 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 144.32 kB +0.01% +11 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.01 kB - -
@sentry/node - without tracing 92.96 kB +0.02% +10 B 🔺
@sentry/node - without channel injection 122.66 kB +0.02% +13 B 🔺
@sentry/aws-serverless 101.26 kB +0.01% +8 B 🔺
@sentry/cloudflare (withSentry) - minified 206.69 kB - -
@sentry/cloudflare (withSentry) 514.13 kB - -

View base workflow run

@github-actions

Copy link
Copy Markdown
Contributor

👋 @Lms24, @chargome, @andreiborza — Please review this PR when you get a chance!

Comment thread dev-packages/size-limit-gh-action/index.mjs

@Lms24 Lms24 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for making this change! I was thinking a bit about if we should explicitly always compare against the base commit where we branched off. But this has a few drawbacks as well:

  • the absolute numbers don't reflect the current state on develop, especially when a PR gets older, until the PR is rebased to latest develop
  • we can't guarantee that we have a base commit size artifact, especially not if we work with stacks. So we need a fallback logic to build that base commit and run size check and upload those results. A lot of work.

So I think we can leave it at comparing against the latest base branch, but this can skew if there are other changes pushed to develop around the same time of opening the PR or pushing new commits onto the PR branch. We should be able to detect this and also include it in the comment.

Something like

## size-limit report 📦

Compared: 8f3c2a1 (your PR merged into develop @ 41be9d0)
Against:  41be9d0 (develop) · base run #18234
✅ Baseline matches: this diff contains only this PR's changes.

| Path | Size | % Change | Change |
| ...  | ...  | ...      | ...    |

## size-limit report 📦

Compared: 8f3c2a1 (your PR merged into develop @ 41be9d0)
Against:  9d07e55 (develop) · base run #18229
⚠️ Baseline mismatch: 2 develop commits are not in the baseline
   (compare 9d07e55...41be9d0), so their size changes are counted here.
   re-run once develop's build for 41be9d0 finishes.

| Path | Size | % Change | Change |
| ...  | ...  | ...      | ...    |

For stacks, I think comparing all the PRs in the stack against the baseline is fine. no need to have a per-stack-PR diff.

WDYT?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add per-PR bundle size checks

2 participants