Repository navigation
fix(bundle): raise the App chunk budget to the size main already ships - #12606
chenmingwei23 wants to merge 1 commit into
Conversation
The App chunk measures 3534.7 KB on main while its budget is 3533 KB, so the gate fails on main's own bytes and every open PR inherits the red. Raised to 3535 KB, the smallest whole KB that fits, and recorded the measurement in the comment.
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Near-zero headroom (0.3 KB) guarantees the next frontend PR must bump the budget inside its own diff — the exact anti-pattern the description condemns. WatchThe description calls "raise the number inside their own feature branch" a defect that "buries a repository-wide defect inside an unrelated diff" — yet with 0.3 KB of headroom, any PR adding one import to the App chunk is forced to do precisely that, now as sanctioned policy. Attribution improves, but the friction lands on every frontend contributor, and the gate still never runs on Suggestions
[DESIGN-REVIEWED] 1d1d5cb |
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. [UX-REVIEWED] 1d1d5cb |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
Closing: superseded by #12496, which merged to That change covers strictly more than this one did. It accounts for Worth recording that the two measurements were made independently and agree One point from this pull request's review is still live and is not fixed by No action needed here. Nothing from this branch needs to land. |
What is the problem?
Bundle Size Gatefails onmainitself. TheAppchunk measures 3534.7 KB(3,619,504 bytes) while its entry in
CHUNK_BUDGETSis 3533 KB(3,617,792 bytes), so the gate reports the chunk over budget by 1,712 bytes
with no pull request having added anything:
The budget was set from a 3364.4 KB measurement with roughly 5% headroom, which
the chunk has since grown through one ordinary commit at a time.
Why this issue matters to the user
Nothing is wrong with any individual change, but every open pull request inherits
the failure, and
Bundle Size Gatefeeds the readiness signal. So a contributorwhose diff does not touch the frontend at all still sees a red required check, and
the natural response is to raise the number inside their own feature branch --
which buries a repository-wide defect inside an unrelated diff and makes the next
person re-derive it.
How our fix solves it
Raises only the
Appentry, to 3535 KB, and records the measurement and its datein the comment beside it. Nothing else changes: one file, one entry, six lines.
The attribution was measured rather than assumed. Both figures below come from
npx vite build --mode analyzefollowed bynode scripts/check-bundle-size.mjs,run in the same environment with the same toolchain:
mainat20261b7633c5, nothing appliedThe feature branch is smaller than
mainon this chunk, which is what rules out"some pull request grew it" as the explanation.
What tests we did
node scripts/check-bundle-size.mjsonmainbefore the change: exits 1 andnames the
Appchunk. After the change: exits 0,697 chunks within budget.still fails, by 688 B, so 3535 is the smallest whole KB that fits the current
measurement.
mainand measuredthe same 1.7 KB overshoot, so the figure is not an artifact of one working tree.
--mode analyze, the gate exits 2 with "No bundle report" rather thanreporting a pass. Exit 2 means the instrument could not run, and a reader
comparing runs should not read it as a clean result.
Any other suggestions on the work
The headroom after this change is about 0.3 KB, so ordinary growth on
mainwillreach the ceiling again. That is deliberate rather than an oversight: the previous
entry carried 5% headroom and absorbed 170 KB of drift silently until it ran out,
and a ceiling that quietly absorbs growth stops being a signal. The trade is that
the next raise is a decision somebody makes and records, at the cost of reaching
it sooner. If the maintainers would rather not pay that maintenance, the two
alternatives are a stated headroom policy, or moving weight out of the chunk
behind a lazy
import()boundary, which is a real change with its own reviewsurface and is deliberately not attempted here.
Pattern harvest
Rule candidate: CI
Pattern: a numeric ceiling that only runs on pull requests.
Bundle Size Gatemeasures the
Appchunk againstCHUNK_BUDGETS, but nothing evaluates it on apush to
main, so growth is invisible until the next contributor opens a pullrequest and inherits the red. The commit that spent the last of the headroom never
saw a failure; a stranger's unrelated diff did.
That is why this took a measurement to diagnose at all. The failure arrives
attached to whichever pull request opens next, which makes it look like that
diff's fault, and the cheapest response from inside that diff is to raise the
number locally. Running the same gate on
mainwould attribute the growth to thecommit that caused it, while it is still one commit's worth of work to shrink.
The second half is the ceiling's own shape: the previous entry recorded "measured
3364.4 KB ... (~5% headroom)" and then silently absorbed 170 KB of growth, because
a budget with headroom cannot distinguish "still fine" from "nearly out". Nothing
in the file forced anyone to re-derive it. Recording the measurement beside the
number, as this change does, is the minimum; a gate that warns as the margin
closes would be better, and is deliberately not attempted here.
no linked issue: found while measuring why an unrelated pull request failed this
gate. The drift is on
mainitself, so there is no bug report to point at. Thefollow-up named in the pattern harvest -- run the gate on pushes to
main-- isthe part worth filing, and is not this diff.