Skip to content

pilot: weighbridge package-weight gate - #761

Open
garrity-miepub wants to merge 1 commit into
mainfrom
pilot/weighbridge
Open

garrity-miepub wants to merge 1 commit into
mainfrom
pilot/weighbridge

Conversation

@garrity-miepub

Copy link
Copy Markdown
Collaborator

What & why

Pilots mieweb/weighbridge — a CI gate that weighs the npm package on every PR and fails if a limit in weighbridge.json is exceeded. Bloat arrives one "small" dependency at a time; this makes every weight increase a conscious, diffable decision (raise the limit in the same PR) instead of silent drift. Refs #622.

What's weighed (limits ≈ measured 0.11.0 baseline + 10% headroom):

metric baseline limit
pack tarball 8.81 MB 9.73 MB
pack unpacked 41.48 MB (1524 files) 45.78 MB
pack section dist/ 41.05 MB 45.30 MB
pack section agent/ 384.5 KB 439.5 KB
bundle . gzip 777.5 KB 859.4 KB
bundle ./hooks gzip 11.4 KB 12.7 KB
bundle ./utils gzip 29.7 KB 33.2 KB
bundle ./tailwind-preset gzip 9.8 KB 11.2 KB
import ./hooks / ./utils / ./tailwind-preset 3–11 ms 2000 ms

All peerDependencies are externalized, so bundle gzip ≈ the weight this library itself adds to a consumer's app. The main entry has no import-time gate — it's a browser-targeting bundle (HTMLElement is not defined under plain Node).

Changes

  • weighbridge.json — scale config (new)
  • .github/workflows/weighbridge.yml — build + mieweb/weighbridge@v1 gate on PRs/pushes to main (new; pilot skips the trending/badges extras, which need contents: write)
  • scripts/build-datavis.mjs, scripts/build-esheet.mjs — bug found during the pilot: their stdout [build:…] diagnostics corrupt npm pack --json output (parsed from the first [). Diagnostics now go to stderr, where they belong.
  • .gitignore — weighbridge local report/baseline outputs

Pilot observations for discussion

  • dist/ ships 41 MB unpacked — sourcemaps plus the duplicated ESM+CJS chunk graph are the likely bulk; weighbridge now makes that visible per-PR.
  • If the pilot sticks, a follow-up can add the reference workflow's trending extras (weigh-ins branch, sticky PR comment with sparklines, shields badges, release weigh tickets).

Checklist

  • pnpm typecheck && pnpm lint && pnpm format && pnpm test pass
  • Visual tests pass / baselines updated if rendering changed (pnpm test:visual) — n/a, no rendering change

RTL — see CONTRIBUTING.md → RTL & direction-agnostic styling

  • No new physical-direction classes or inline styles — n/a, no component changes
  • Directional icons flip with rtl:-scale-x-100 — n/a
  • ArrowLeft/ArrowRight handlers are direction-aware — n/a
  • New class strings safelisted — n/a, no new class strings
  • Direction-sensitive rendering has RTL visual coverage — n/a

Weighs pack size, per-entry min+gzip bundle size, and import time on
every PR; limits set at ~10% headroom over the 0.11.0 baseline. Build
script diagnostics moved to stderr so `npm pack --json` stays parseable.

Refs #622
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying ui with  Cloudflare Pages  Cloudflare Pages

Latest commit: e1ba04e
Status: ✅  Deploy successful!
Preview URL: https://ebf89ab4.ui-6d0.pages.dev
Branch Preview URL: https://pilot-weighbridge.ui-6d0.pages.dev

View logs

@garrity-miepub
garrity-miepub marked this pull request as ready for review November 12, 2026 19:38
Copilot AI balanced review requested due to automatic review settings November 12, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the package-weight gate changes.

No open issues 🎉

What changed in this PR

This PR pilots Weighbridge as a package-weight gate, making increases beyond configured limits explicit and reviewable.

Changes:

  • Adds limits for package size, selected directory sizes, entry-point bundle sizes, and import times.
  • Adds a read-only CI workflow to build and weigh the package on non-draft PRs targeting main and pushes to main.
  • Moves build diagnostics to stderr to avoid corrupting npm pack --json output and ignores local Weighbridge reports.
File Description
weighbridge.json Defines weight limits and externalizes peer dependencies from bundle measurements.
scripts/​build-esheet.mjs Sends the build-skip diagnostic to stderr.
scripts/​build-datavis.mjs Sends build-status diagnostics to stderr.
.gitignore Excludes local Weighbridge reports and baseline outputs.
.github/​workflows/​weighbridge.yml Builds the package and runs the Weighbridge gate in CI.

Review effort: Balanced

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.

2 participants