Skip to content

ci: Check bundle size increases per PR - #24737

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

nicohrubec wants to merge 15 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
nicohrubec force-pushed the feat/per-pr-bundle-size-check branch from 93485e5 to cf9b39e Compare September 25, 2026 11:50

@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

@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
@getsentry getsentry deleted a comment from github-actions Bot Sep 26, 2026
@getsentry getsentry deleted a comment from github-actions Bot Sep 26, 2026
@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

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 Outdated

@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?

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

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

3 similar comments
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

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

nicohrubec and others added 14 commits October 19, 2026 11:51
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>
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>
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 6932272 to ce77293 Compare October 19, 2026 09:56
Co-Authored-By: GPT-6 <codex@openai.com>
@getsentry getsentry deleted a comment from github-actions Bot Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 7fa396e (PR test merge using develop at 312818c)

Against: 312818c (develop) · base run #62509

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 29.88 kB - -
@sentry/browser - with treeshaking flags 28.02 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.92 kB - -
@sentry/browser (incl. Tracing) 52.07 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.07 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.02 kB - -
@sentry/browser (incl. Tracing, Replay) 91.82 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.68 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 96.55 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 109.49 kB - -
@sentry/browser (incl. Feedback) 47.4 kB - -
@sentry/browser (incl. sendFeedback) 34.94 kB - -
@sentry/browser (incl. FeedbackAsync) 40.05 kB - -
@sentry/browser (incl. Metrics) 30.9 kB - -
@sentry/browser (incl. Logs) 31.18 kB - -
@sentry/browser (incl. Metrics & Logs) 31.81 kB - -
@sentry/react 31.7 kB - -
@sentry/react (incl. Tracing) 54.39 kB - -
@sentry/vue 38.04 kB - -
@sentry/vue (incl. Tracing) 55.01 kB - -
@sentry/svelte 29.9 kB - -
@sentry/remix (Remix 3 client bundle) 57.08 kB - -
CDN Bundle 31.64 kB - -
CDN Bundle (incl. Tracing) 52.58 kB - -
CDN Bundle (incl. Logs, Metrics) 33.84 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.52 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.77 kB - -
CDN Bundle (incl. Tracing, Replay) 90.25 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.18 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.4 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.34 kB - -
CDN Bundle - uncompressed 93.18 kB - -
CDN Bundle (incl. Tracing) - uncompressed 156.03 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.72 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 161.99 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.76 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 276.2 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 282.14 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.9 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.84 kB - -
@sentry/nextjs (client) 56.8 kB - -
@sentry/sveltekit (client) 52.45 kB - -
@sentry/core/server 41.12 kB - -
@sentry/core/browser 13.81 kB - -
@sentry/node 155.04 kB +0.01% +10 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 84.06 kB -0.01% -2 B 🔽
@sentry/node - without tracing 96.7 kB +0.01% +3 B 🔺
@sentry/node - without channel injection 133.07 kB +0.01% +5 B 🔺
@sentry/aws-serverless 104.89 kB +0.01% +4 B 🔺
@sentry/cloudflare (withSentry) - minified 210.78 kB - -
@sentry/cloudflare (withSentry) 522.89 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 228.46 kB - -

View base workflow run

@nicohrubec

Copy link
Copy Markdown
Member Author

@Lms24 good idea! finally got around to updating this today. report now shows what we compare against as suggested, should hopefully help to prevent some confusion

@nicohrubec
nicohrubec requested a review from Lms24 October 19, 2026 12:32

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