chore: do not allow failures on size limit check#1760
chore: do not allow failures on size limit check#1760daniel-graham-amplitude wants to merge 37 commits into
Conversation
This reverts commit faf2a6a.
There was a problem hiding this comment.
Pull request overview
This PR adds a blocking size-limit check to the Nx pull request CI workflow so selected distributable bundles are built and validated against configured size budgets.
Changes:
- Adds Size Limit dependencies and a root
.size-limit.jsconfiguration. - Adds a new
check-size-limitsjob to.github/workflows/ci-nx.yml. - Adds an Nx build script and configures Nx build outputs for cache restoration.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/ci-nx.yml |
Adds the size-limit CI job with pnpm, Node 24, Nx cache restore/save, and size-limit action execution. |
.size-limit.js |
Defines bundle size budgets for analytics-browser, session-replay-browser, and unified gzip artifacts. |
nx.json |
Declares lib build outputs for Nx caching. |
package.json |
Adds build:nx and Size Limit dev dependencies. |
pnpm-lock.yaml |
Locks new Size Limit dependencies and related dependency resolution changes. |
Comments suppressed due to low confidence (1)
.github/workflows/ci-nx.yml:83
- This action uses
github_tokento publish/update the PR size-limit result, but the job does not requestpull-requests: writepermission. The existing PR-commenting workflow declares that permission explicitly (.github/workflows/e2e-session-replay.yml:25-27); without it this job can fail in repositories with read-only default token permissions.
- uses: daniel-statsig/size-limit-action@710d41ebc34634c011e8a91fe165d6ff49536a74 # v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
package_manager: pnpm
build_script: build:nx
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Missing
pnpm installstep before build command- Added an explicit
pnpm install --frozen-lockfilestep before the main-branch workflow runspnpm build:nx.
- Added an explicit
Or push these changes by commenting:
@cursor push 7f21b958f0
Preview (7f21b958f0)
diff --git a/.github/workflows/main-branch-push.yml b/.github/workflows/main-branch-push.yml
--- a/.github/workflows/main-branch-push.yml
+++ b/.github/workflows/main-branch-push.yml
@@ -25,6 +25,9 @@
node-version: 24
cache: 'pnpm'
+ - name: Install project dependencies
+ run: pnpm install --frozen-lockfile
+
- name: Restore Nx cache
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
with:You can send follow-ups to the cloud agent here.
size-limit report 📦
|
… SDK-12-size-limit-gating-part-2
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Duplicate size-limit step missing required configuration parameters
- Removed the duplicate unconfigured size-limit action and kept the single configured check as a required CI step.
Or push these changes by commenting:
@cursor push ec9e179441
Preview (ec9e179441)
diff --git a/.github/workflows/ci-nx.yml b/.github/workflows/ci-nx.yml
--- a/.github/workflows/ci-nx.yml
+++ b/.github/workflows/ci-nx.yml
@@ -78,10 +78,6 @@
# - uses: amplitude/actions/size-limit-action@1de003d03c7860f70bf5511f2ed3e2953cf4506f # v1
- uses: daniel-statsig/size-limit-action@710d41ebc34634c011e8a91fe165d6ff49536a74 # v1
-
- - uses: daniel-statsig/size-limit-action@710d41ebc34634c011e8a91fe165d6ff49536a74 # v1
- # TODO: TEMPORARILY ALLOW FAILURE UNTIL size-limit is added to 'main' branch
- continue-on-error: true
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
package_manager: pnpmYou can send follow-ups to the cloud agent here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Cache restore-keys identical to key, providing no fallback
- Updated both Nx cache restore-keys to use the OS-only prefix so GitHub Actions can fall back across hash changes.
Or push these changes by commenting:
@cursor push 94aff078f7
Preview (94aff078f7)
diff --git a/.github/workflows/ci-nx.yml b/.github/workflows/ci-nx.yml
--- a/.github/workflows/ci-nx.yml
+++ b/.github/workflows/ci-nx.yml
@@ -74,7 +74,7 @@
path: .nx/cache
key: nx-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }}
restore-keys: |
- nx-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }}
+ nx-${{ runner.os }}-
- uses: daniel-statsig/size-limit-action@710d41ebc34634c011e8a91fe165d6ff49536a74 # v1
with:
diff --git a/.github/workflows/main-branch-push.yml b/.github/workflows/main-branch-push.yml
--- a/.github/workflows/main-branch-push.yml
+++ b/.github/workflows/main-branch-push.yml
@@ -34,7 +34,7 @@
path: .nx/cache
key: nx-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }}
restore-keys: |
- nx-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }}
+ nx-${{ runner.os }}-
- name: Build all packages
run: pnpm build:nxYou can send follow-ups to the cloud agent here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Redundant restore-keys identical to key provides no fallback
- Changed the Nx cache restore key to the shorter OS-scoped prefix so GitHub Actions can fall back to prior cache entries when hashes change.
Or push these changes by commenting:
@cursor push 90381952e7
Preview (90381952e7)
diff --git a/.github/workflows/main-branch-push.yml b/.github/workflows/main-branch-push.yml
--- a/.github/workflows/main-branch-push.yml
+++ b/.github/workflows/main-branch-push.yml
@@ -34,7 +34,7 @@
path: .nx/cache
key: nx-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }}
restore-keys: |
- nx-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }}
+ nx-${{ runner.os }}-
- name: Build all packages
run: pnpm build:nxYou can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit fd0ebd0. Configure here.
| path: .nx/cache | ||
| key: nx-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }} | ||
| restore-keys: | | ||
| nx-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }} |
There was a problem hiding this comment.
Redundant restore-keys identical to key provides no fallback
Low Severity
The restore-keys value is identical to key, which makes it completely redundant. GitHub Actions cache uses prefix matching for restore-keys as a fallback when no exact key match exists. Since the value is the same full string (including the hash), it will never match anything that the key didn't already match. The intended pattern is likely a shorter prefix like nx-${{ runner.os }}- to allow partial cache hits when pnpm-lock.yaml or nx.json changes, which matters because this job's explicit purpose is to warm the cache for PR builds.
Reviewed by Cursor Bugbot for commit fd0ebd0. Configure here.



Summary
mainwe can actually compare the bundle size in branch to the bundle size in mainChecklist
Note
Low Risk
Low risk: changes are limited to GitHub Actions workflow behavior, but they may cause previously passing PRs to fail if bundle size regressions exist or if the new cache job is misconfigured.
Overview
Tightens CI enforcement for bundle size checks. The
check-size-limitsjob inci-nx.ymlno longer allows the size-limit action to fail, and it now setsNX_BASE/NX_HEADenv vars for Nx comparisons.Adds a main-branch post-merge cache warmup workflow. New
main-branch-push.ymlruns on pushes tomainto build viapnpm build:nxand save the.nx/cache, improving subsequent PR build/size-limit performance.Reviewed by Cursor Bugbot for commit fd0ebd0. Bugbot is set up for automated code reviews on this repo. Configure here.