Skip to content

test(cli): Set a budget for the JavaScript commands read - #1945

Closed
sergical wants to merge 2 commits into
mainfrom
perf/cli-load-budget
Closed

sergical wants to merge 2 commits into
mainfrom
perf/cli-load-budget

Conversation

@sergical

@sergical sergical commented Nov 4, 2026

Copy link
Copy Markdown
Member

The CLI has no size check in CI. Only @sentry/mcp-server has one (MAX_BUNDLE_BYTES). A change can make every command read more code, or grow the package, and CI stays green. This PR sets the baseline that later size and startup changes measure against.

Baseline

The JavaScript each command reads at startup, on main (f0439045), signed out:

Command Reads Budget
sentry --version 1,568 KB 1,620 KB
sentry help 1,640 KB 1,690 KB
sentry auth status 1,661 KB 1,720 KB
sentry org list 1,729 KB 1,790 KB
sentry issue list 1,880 KB 1,940 KB
sentry help --json 4,021 KB 4,150 KB
All JavaScript in the npm package 17,768 KB 18,310 KB

Each budget is about 3% over the size today.

Changes

  • test/e2e/bundle.test.ts runs each command above and fails when it reads more JavaScript than its budget. It also fails when dist ships more JavaScript than its budget. The CLI package already runs test:e2e in CI, so this needs no new workflow or script.
  • The failure message gives the real size, for example: sentry --version reads 1568 KB, over its 1620 KB budget.
  • A new runReadingScripts helper records the scripts a run reads. The two tests that had their own copy of this code now use it.
  • packages/cli/AGENTS.md says what to do when a change goes over a budget: make the change smaller, or raise the budget and give the reason in the PR. Lower a budget when a command gets smaller.

Checks

  • test/e2e/bundle.test.ts: 17 tests pass in 2.5 s.
  • With three budgets set to 1,000 KB, the three tests fail with the real sizes.
  • pnpm run lint and tsc pass.

Created with Claude Code

sergical and others added 2 commits November 4, 2026 10:00
The CLI had no size check. A change could make every command read more
code, or grow the package, and CI stayed green.

The bundle e2e test now runs six commands and fails when one reads more
JavaScript than its budget. It also fails when the npm package ships more
JavaScript than its budget. Each budget is about 3% over the size today.

Co-authored-by: Claude <[email protected]>
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 4, 2026 3:06pm UTC

Request Review

@github-actions github-actions Bot added the risk: low PR risk score: low label Nov 4, 2026
@BYK
BYK marked this pull request as draft November 4, 2026 15:11
@BYK

BYK commented Nov 4, 2026

Copy link
Copy Markdown
Member

Too much in flux right now so putting this on hold. Thanks for the PR tho.

@sergical sergical closed this Nov 4, 2026

This branch was previously deployed

1 inactive deployment
Preview — 396bcf86 Deployed Nov 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants