Lesson 27 of 30
A budget that lives in a wiki page is a suggestion. A budget that fails a build is a rule — and the difference is what actually stops a regression from shipping.
12 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 3
A regression is caught by an automated bundle-size check on the exact PR that introduced it, versus being discovered three months later during a manual audit. Why is the CI-caught version specifically 'cheaper to fix,' beyond just being caught sooner?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
The earlier performance-budgets lesson in this track covered what a budget is and how you'd set the number — a bundle-size ceiling, an LCP threshold, whatever the team agreed on. That's necessary but not sufficient: a budget nobody enforces is just a number in a document that everyone forgets under deadline pressure. This lesson is about the enforcement mechanism — making the budget structurally impossible to silently violate.
The pattern is the same discipline as a test suite gating a merge, applied to a performance number instead of correctness: a CI step runs after a build, measures something concrete against the budget (a bundle-size check against the build output, or a Lighthouse run against a deployed preview), compares the result to the configured threshold, and either fails the build outright or, at minimum, posts the delta as a PR comment so a human has to consciously acknowledge it before merging. Either way, the regression becomes visible before it reaches production, tied to the specific commit that introduced it, instead of being discovered weeks later when someone happens to notice the site feels slower.
# .github/workflows/bundle-check.yml
- name: Build
run: pnpm build
- name: Check bundle size against budget
run: npx bundlesize
// bundlesize.config.json
{
"files": [
{ "path": "dist/main.*.js", "maxSize": "170 kB" }
]
}
If the built main bundle exceeds 170 kB, this step exits non-zero, the CI check goes red, and the PR is blocked from merging (or clearly flagged, depending on how strict the team wants to be) until the size is addressed or the budget is deliberately revised. Nobody has to remember to check; the pipeline checks for them, every single time, on every single PR.
"How would you stop performance regressions from shipping without relying on people remembering to check manually?" tests whether a candidate reaches for process and tooling (an automated, enforced gate) or just proposes "we should test more," which is precisely the kind of good intention that erodes under deadline pressure.