Repository navigation
chore(bench): add self-contained bundle-size baselines - #826
Conversation
Every bundle fixture externalizes hookable, including the "full" ones, so inlining/removing it in a future refactor could silently move the number without the report catching it. Add clientSelfContained/serverSelfContained fixtures that inline hookable, and start tracking brotli size alongside gzip/raw wherever bundle stats are computed. update.ts now merges into last.json instead of overwriting it, so a partial build can't perturb baselines it didn't regenerate.
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. 📝 WalkthroughWalkthroughThe bundle benchmarking pipeline adds self-contained client and server builds, persists Brotli metrics in ChangesBundle metrics pipeline
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant BundleBuilds
participant UpdateScript
participant BaselineFile
participant BundleReport
BundleBuilds->>UpdateScript: Generate bundle artifacts
UpdateScript->>BaselineFile: Read existing statistics
UpdateScript->>BaselineFile: Write raw, gzip, and Brotli sizes
BundleReport->>BaselineFile: Read fallback baseline metrics
BundleReport->>BundleReport: Render raw, gzip, and Brotli columns
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… stats The merge behavior meant a required bundle that failed to build but had committed history would silently keep its old numbers. Keep the merge, but warn per-bundle when a dist file is missing and old stats are carried forward, mark those rows as (stale) in the console.table output, and print a summary count. Still throw when a required bundle is missing and has no history to fall back on.
📦 Bundle Size✅ No notable changes · 🆕 2 new bundles tracked All bundles (14)
⚡ Performance (directional)✅ No significant change (within CI noise) All benchmarks (9)
Baseline: main @ b9254db · 2026-07-12 · gzipped is the headline size metric · perf is directional (shared-runner, gated) |
Summary
Every bundle fixture in
bench/bundle/*.config.tsexternalizeshookable, including the "full" variants — so inlining/removing a dependency in a future refactor could move the real bundle size without the tracked numbers catching it.client-sc-build.config.ts/server-sc-build.config.ts: copies of the minimal client/server unbuild configs withexternals: ['hookable']removed, sohookableis inlined into the bundle.clientSelfContained,serverSelfContained) intobundles.tsand thetest:bundle-sizescript chain.br) size tracking alongside raw/gzip inupdate.tsandbundle-report.ts(used by bothanalyze.tsandreport.ts), additive only — existinglast.jsonentries keep their{size, gz}shape, new/regenerated ones get{size, gz, br}.update.tsnow merges intolast.jsoninstead of overwriting it wholesale, so a partial build (e.g. only the two new self-contained fixtures) can't perturb baselines it didn't rebuild. Required-bundle validation only fires when there's neither a fresh dist file nor a prior committed value.New baseline numbers
Self-contained bundles are larger than their externalized equivalents, as expected (they carry
hookable's ~1 kB source instead of assuming it's a shared/deduped external).Verification
git diff bench/bundle/last.json(pre-commit) showed only additions —clientSelfContained/serverSelfContainedkeys — no changes to any existing values.test:bundle-sizechain; numbers are reproducible.update.ts) to confirmbundle-report.ts's new Brotli column renders correctly andlast.jsonstays untouched for pre-existing entries.pnpm lintclean, no unrelated diffs.Deviations from spec
bundirectly (available in this environment) forupdate.ts/analyze.ts/report.ts— no fallback needed.bundle-report.ts(shared byanalyze.tsandreport.ts) also gained abrotliSize/baseBrotliSizepair onBundleDataand a new "Brotli" column in the collapsed "All bundles" table, so brotli numbers are visible in the PR comment, not just persisted tolast.json. This is additive and doesn't change the gzip-driven grew/shrank/new status logic.Test plan
pnpm lintclient-sc-build.config.tsandserver-sc-build.config.tsdirectly, confirmed hookable is inlined (visualizer/unbuild output showshookable/dist/index.mjsbundled in)bun bench/bundle/update.tsmerges new keys only, verified viagit diff bench/bundle/last.jsonbun bench/bundle/analyze.ts/report.tsrender the new fixtures with a Brotli columnSummary by CodeRabbit
New Features
Improvements