feat(ci): bundle-size budget gate (warn-only until baseline enforced)#608
Conversation
Tier D. Protects the repo's perf/bundle-hygiene work from silent regression (a heavy dep, or an accidental client-side import of a big module). - scripts/check-bundle-budget.mjs: measures .next client chunk sizes (raw + gzip), compares total gzip to a committed baseline with a tolerance; `--update` records the baseline; skips cleanly when no build output exists. Pure measure/compare logic is exported and unit-tested. - bundle-budget.json: ships enforce:false, totalGzipBytes:null — WARN-ONLY, so it never blocks a PR until an operator captures a baseline (`--update` after a known-good build) and flips enforce:true. - ci.yml: warn-only "Bundle budget" step after Build (can't fail a run yet). Verified: 6/6 vitest, no-build smoke, check:github-actions, eslint, tsc (own files clean), prettier — all green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds a warn-only client JavaScript bundle budget checker that measures Next.js chunk sizes, compares them with a configurable baseline, exposes an npm command, runs in CI, and includes unit and scope-classifier tests. ChangesBundle budget enforcement
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CI
participant NpmScript
participant BundleBudgetChecker
participant BuildOutput
participant BudgetConfig
CI->>NpmScript: run check:bundle-budget
NpmScript->>BundleBudgetChecker: invoke CLI
BundleBudgetChecker->>BuildOutput: measure JavaScript chunk sizes
BundleBudgetChecker->>BudgetConfig: load baseline and tolerance
BundleBudgetChecker-->>CI: emit verdict and exit code
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0eb6bb6020
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
|
To use Codex here, create a Codex account and connect to github. |
What
First Tier D item. Protects the repo's perf/bundle-hygiene work from silent regression — a heavy new dependency, or an accidental client-side import of a big module (the "snapshot imported client-side" mistake flagged as a never-do).
scripts/check-bundle-budget.mjs— measures.nextclient chunk sizes (raw + gzip), compares total gzip to a committed baseline with a tolerance;--updaterecords the baseline; skips cleanly when there's no build output. PuremeasureChunks/compareToBudgetare exported and unit-tested.bundle-budget.json— shipsenforce:false,totalGzipBytes:null→ WARN-ONLY. It never blocks a PR until you capture a baseline and opt in.ci.yml— a warn-only "Bundle budget" step after Build (cannot fail a run yet).Rollout (operator, when ready)
npm run build:npm run check:bundle-budget -- --updateto record the baseline gzip size."enforce": trueinbundle-budget.json(and tunetolerancePct, default 10%).--update.Verification
6/6 vitest (measure + compare logic), no-build smoke (skips),
check:github-actions, eslint,tsc(own files clean), prettier — all green.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests