Skip to content

ci: Check bundle size increases per PR - #24737

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

nicohrubec wants to merge 14 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
`Size limit exceeded for ${name} - ${this.formatBytes(current.size)} > ${this.formatBytes(current.sizeLimit)}`,
);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The removal of explicit number coercion for result.size may cause bytes.format() to fail if the size field from the JSON output is a string.
Severity: MEDIUM

Suggested Fix

Restore the explicit number coercion to ensure the size property is always a number before being used, especially by external library functions like bytes.format(). Change size: result.size back to size: +result.size.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: dev-packages/size-limit-gh-action/utils/SizeLimitFormatter.mjs#L80

Potential issue: The explicit number coercion for the `size` field, previously done
using `+result.size`, has been removed. While JavaScript's automatic type coercion
handles arithmetic operations like subtraction correctly even with string numbers, the
`size` value is also passed to the `bytes.format()` method from the `bytes-iec` library.
This library likely expects a numeric input and may return `null` or incorrect output if
`size-limit`'s JSON output provides the `size` value as a string. This removal of
defensive type coercion introduces a risk of silent failures or incorrect formatting in
the size report.

Did we get this right? 👍 / 👎 to inform future reviews.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add per-PR bundle size checks

1 participant