Skip to content

chore: do not allow failures on size limit check#1760

Open
daniel-graham-amplitude wants to merge 37 commits into
mainfrom
SDK-12-size-limit-gating-part-2
Open

chore: do not allow failures on size limit check#1760
daniel-graham-amplitude wants to merge 37 commits into
mainfrom
SDK-12-size-limit-gating-part-2

Conversation

@daniel-graham-amplitude
Copy link
Copy Markdown
Collaborator

@daniel-graham-amplitude daniel-graham-amplitude commented May 15, 2026

Summary

  • remove the allow failure on bundle size check, now that bundle sizes are in main we can actually compare the bundle size in branch to the bundle size in main
  • add a post-merge to main job that caches the build so that builds are quick (this is important with bundle sizes because it needs to build on both the PR and the main branch, and having to re-do the whole thing is very time consuming)

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

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-limits job in ci-nx.yml no longer allows the size-limit action to fail, and it now sets NX_BASE/NX_HEAD env vars for Nx comparisons.

Adds a main-branch post-merge cache warmup workflow. New main-branch-push.yml runs on pushes to main to build via pnpm build:nx and 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.

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 15, 2026

SDK-12

@daniel-graham-amplitude daniel-graham-amplitude changed the base branch from main to SDK-12-size-limit-gating May 15, 2026 21:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.js configuration.
  • Adds a new check-size-limits job 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_token to publish/update the PR size-limit result, but the job does not request pull-requests: write permission. 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.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

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.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Missing pnpm install step before build command
    • Added an explicit pnpm install --frozen-lockfile step before the main-branch workflow runs pnpm build:nx.

Create PR

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.

Comment thread .github/workflows/main-branch-push.yml
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

size-limit report 📦

Path Size
packages/analytics-browser/lib/scripts/amplitude-min.js.gz 58.31 KB (0%)
packages/session-replay-browser/lib/scripts/session-replay-browser-min.js.gz 131.96 KB (0%)
packages/unified/lib/scripts/amplitude-min.umd.js.gz 208.93 KB (0%)

Base automatically changed from SDK-12-size-limit-gating to main May 20, 2026 16:28
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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.

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.

Create PR

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: pnpm

You can send follow-ups to the cloud agent here.

Comment thread .github/workflows/ci-nx.yml
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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.

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.

Create PR

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:nx

You can send follow-ups to the cloud agent here.

Comment thread .github/workflows/ci-nx.yml Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 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.

Create PR

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:nx

You 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') }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fd0ebd0. Configure here.

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.

3 participants