Skip to content

ci(devops): add a bundle size budget with pnpm size - #63

Merged
salahmyn merged 3 commits into
feature/quality-gates-twig-parity-auditfrom
feature/SAL-3524-add-bundle-size-budget
Oct 27, 2026
Merged

salahmyn merged 3 commits into
feature/quality-gates-twig-parity-auditfrom
feature/SAL-3524-add-bundle-size-budget

Conversation

@salahmyn

@salahmyn salahmyn commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

What

Adds pnpm size: runs the production build, then scripts/check-bundle.mjs measures every JS/CSS file in dist/client/assets (gzip level 9 and brotli), groups by chunk name without the content hash, and compares with the committed size-budget.json.

  • Budget = size on the base branch + 5% margin, for total JS, total CSS and every chunk of 4 kB gzip or more. Chunks without their own budget fail above 8 kB, so a new large chunk is caught.
  • Prints a table (current, budget, difference) and writes dist/size-report.json for CI to upload later.
  • pnpm size:update rebuilds and rewrites the budget when growth is intended.
  • No application code changed. ESLint gets Node globals for scripts/*.mjs.

Verification

  • pnpm size on the base branch: exit 0 (total JS 415.3 kB gzip vs budget 436.1 kB).
  • With import * as ts from 'typescript' added to app/router.tsx (reverted afterwards): exit 1.
TOTAL js   gzip   1357.6 kB   436.1 kB   +921.5 kB   OVER
hydrate.js gzip    981.1 kB    40.9 kB   +940.2 kB   OVER
Bundle budget exceeded in 4 measurement(s).
  • typecheck, lint (0 errors), format:check, check:manifest: exit 0.
  • test:coverage: 4 failures in ProductDetails.test.tsx (localStorage.clear undefined) also fail on the unmodified base branch when run on Node 26 locally; the repo pins Node 22 in CI.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues remain.

Summary

Adds pnpm size to build the theme and check compressed JS and CSS sizes against committed limits.

  • Bundle checks compare each build with saved size limits.

Reviews (3) · Last reviewed commit: "ci(devops): merge the base branch and ad..." · Reviewed by Greptile

Sizes the client build (gzip and brotli per chunk, total JS and CSS) against size-budget.json and writes dist/size-report.json.

Made-with: agent
Co-authored-by: mc-agents[bot] <298817976+mc-agents[bot]@users.noreply.github.com>
@sallainternalbot
sallainternalbot Bot marked this pull request as draft October 26, 2026 20:39
@salahmyn

Copy link
Copy Markdown
Member Author

@greptileai please review this pull request.

Comment thread scripts/check-bundle.mjs Resolved
Comment thread scripts/check-bundle.mjs Resolved
@salahmyn

Copy link
Copy Markdown
Member Author

This branch conflicts with the base branch feature/quality-gates-twig-parity-audit, which has moved (CI, knip, F4 and F7 are merged), so CI and the review have not run on it. Please rebase on the base branch, resolve the conflicts (likely package.json and pnpm-lock.yaml), run build, typecheck, lint, format:check, test:coverage, check:manifest and knip, push, and wait for the Greptile review and the Quality gates check to pass.

@salahmyn

Copy link
Copy Markdown
Member Author

@greptileai review

Comment thread scripts/check-bundle.mjs Resolved
@salahmyn
salahmyn marked this pull request as ready for review October 27, 2026 10:56
…k (SAL-3524)

Resolve the package.json conflict, drop every embedded hash from chunk names, reject builds with no JS assets, and add tests for the checker.

Made-with: agent
Co-authored-by: mc-agents[bot] <298817976+mc-agents[bot]@users.noreply.github.com>
greptile-apps[bot]
greptile-apps Bot previously approved these changes Oct 27, 2026
…3524)

`sort | head` under bash pipefail makes sort exit 2 when head closes the pipe early. awk reads all input, so sort finishes cleanly.

Made-with: agent
Co-authored-by: mc-agents[bot] <298817976+mc-agents[bot]@users.noreply.github.com>
@greptile-apps
greptile-apps Bot dismissed their stale review October 27, 2026 11:14

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@greptile-apps

greptile-apps Bot commented Oct 27, 2026

Copy link
Copy Markdown

Automatic reviews are disabled for this repository.

@salahmyn
salahmyn merged commit 5f3e29e into feature/quality-gates-twig-parity-audit Oct 27, 2026
7 checks passed
@salahmyn
salahmyn deleted the feature/SAL-3524-add-bundle-size-budget branch October 27, 2026 13:36
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.

1 participant