Skip to content

[BF-025] 性能预算和 bundle guard - #84

Merged
baixiangcpp merged 1 commit into
mainfrom
perf/BF-025-performance-budget-bundle-guard
Jun 22, 2026
Merged

[BF-025] 性能预算和 bundle guard#84
baixiangcpp merged 1 commit into
mainfrom
perf/BF-025-performance-budget-bundle-guard

Conversation

@baixiangcpp

Copy link
Copy Markdown
Owner

Issue

Closes #45

Scope

  • Adds the BF-025 performance budget gate only.
  • Keeps the existing heavy dependency boundary guard in place.
  • Adds documentation for how and when to update route budgets.

Implementation

  • Added scripts/gates/check-performance-budget.js with config validation and build-output report modes.
  • Added scripts/gates/performance-budgets.json with baseline budgets for /, /en, /en/all-tools, /en/json-formatter, /en/markdown-preview, and /en/image-resizer.
  • Wired npm run check:performance-budget into npm run validate.
  • Wired npm run check:performance-budget:report into npm run build:post so CI prints and enforces the bundle summary after export.
  • Added docs/performance/performance-budget.md and guard tests for CI wiring.

Validation

  • npm run lint
    • PASS
  • npm run test
    • PASS: 218 files / 1091 tests
  • npm run validate
    • PASS, including check:performance-budget
  • npm run build
    • PASS: 1289 static pages; check:performance-budget:report passed in build:post
  • npm run test:e2e:smoke
    • PASS via npm run test:e2e:smoke -- --port=4179
  • npm run analyze
    • PASS exit code 0; generated .next/analyze/client.html, .next/analyze/nodejs.html, .next/analyze/edge.html
    • Analyzer printed server/edge parse warnings but completed successfully.
  • npm run check:bundle-boundaries
    • PASS: heavy dependencies stay behind approved lazy boundaries.

Bundle Budget Evidence

npm run check:performance-budget:report output from the successful build:

Route JS gzip JS raw Scripts CSS gzip HTML
/ 187.2 KiB / 214.8 KiB 627.3 KiB / 703.1 KiB 10 / 12 26.3 KiB / 34.2 KiB 63.7 KiB / 87.9 KiB
/en 220.2 KiB / 249.0 KiB 788.3 KiB / 878.9 KiB 15 / 17 26.3 KiB / 34.2 KiB 295.7 KiB / 351.6 KiB
/en/all-tools 243.4 KiB / 278.3 KiB 890.6 KiB / 1001.0 KiB 18 / 20 26.3 KiB / 34.2 KiB 522.2 KiB / 605.5 KiB
/en/json-formatter 299.5 KiB / 341.8 KiB 1061.1 KiB / 1191.4 KiB 24 / 27 26.3 KiB / 34.2 KiB 249.5 KiB / 312.5 KiB
/en/markdown-preview 251.6 KiB / 293.0 KiB 907.4 KiB / 1035.2 KiB 20 / 23 26.3 KiB / 34.2 KiB 234.9 KiB / 293.0 KiB
/en/image-resizer 290.2 KiB / 332.0 KiB 1031.3 KiB / 1152.3 KiB 24 / 27 26.3 KiB / 34.2 KiB 240.2 KiB / 302.7 KiB

Acceptance Criteria

  • CI 输出 bundle 体积摘要。
  • 超过预算时失败或要求显式 override。
  • 核心页面有基线。
  • 文档说明如何更新预算。
  • npm run validatenpm run build 通过。

Manual Checks

  • Confirmed the budget report reads exported out/ HTML and _next/static assets.
  • Confirmed the budget config is not an unlimited threshold and current main stays within limits.
  • Smoke test confirmed critical routes still render and navigate.

Privacy Check

  • 不采集工具输入
  • 不采集工具输出
  • 不新增未披露的外部请求
  • 不持久化敏感 payload
  • 不新增 analytics payload/query/file-name collection

Screenshots / Evidence

  • Non-UI CI/performance gate change; bundle report above is the evidence.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying byteflow with  Cloudflare Pages  Cloudflare Pages

Latest commit: ac696ba
Status: ✅  Deploy successful!
Preview URL: https://1180d25d.byteflow-c58.pages.dev
Branch Preview URL: https://perf-bf-025-performance-budg.byteflow-c58.pages.dev

View logs

@baixiangcpp
baixiangcpp merged commit 72dbf22 into main Jun 22, 2026
2 checks passed
@baixiangcpp
baixiangcpp deleted the perf/BF-025-performance-budget-bundle-guard branch June 22, 2026 15:47
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.

[BF-025] 性能预算和 bundle guard

1 participant