Skip to content

chore(scripts): pnpm size:pages --help prints its usage - #11840

Merged
cixzhang merged 2 commits into
mainfrom
tools/size-pages-help-2
Nov 18, 2026
Merged

cixzhang merged 2 commits into
mainfrom
tools/size-pages-help-2

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Maintainer impact

pnpm size:pages --help failed with "Unknown argument: --help". Someone checking INV10's numbers had to read the script to learn its flags, what the numbers mean, and which limit --unused-on checks.

Intended invariant

pnpm size:pages measures INV10's reference pages exactly as before. Only --help and -h are new.

Change

  • --help and -h print the usage and exit 0, before any other argument check.
  • The usage text covers:
    • every flag, including --unused-on <pages>;
    • what the numbers are: first-load minified and gzip bytes of each reference page, base against head;
    • INV10's limit as the script applies it: 0.3 KB gzip, 307 B;
    • an example run.
  • The same text replaces the one-line message printed when --base is missing.

Evidence

  • Failure before the change: pnpm size:pages --help printed "Unknown argument: --help" and exited 1.
  • Success after the change: pnpm size:pages --help and pnpm size:pages -h print the usage and exit 0.
  • Product/runtime behavior verified unchanged: no package source changes; the measurement path is untouched.
  • CI impact: none; no workflow changes.

Scope

Components: none (repository script and its test)

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • vitest run --project node scripts/measure-reference-pages.test.mjs: 11 tests pass. The two new ones check that --help and -h ask for help ahead of any other argument, and that the usage names every flag, the 307 B limit and the example.
  • pnpm size:pages -h: prints the usage, exits 0.

@vercel

vercel Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 15, 2026 7:47am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 15, 2026
@astracat-bot

astracat-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 15, 2026, 7:51 AM UTC

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 2dfd081

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot 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.

Changes requested: --help works, but it does not yet come before every other argument check, as the description says.

  • pnpm size:pages --fast --help, or a typo such as pnpm size:pages --base main --fsat --help, still exits 1 with Unknown argument: … and no usage, because parseArgs returns for help only when its loop reaches the flag (scripts/measure-reference-pages.mjs:330); check argv for --help and -h before the loop and add a test for ['--fast', '--help'], or narrow the description and the test name to say help applies when it comes before any unknown argument.

Everything else checks out: the usage matches the record's four reference pages and its 307 B limit, the measurement path is untouched, and the script's 11 tests pass.

Claims and files checked

Review mode: full; reason: no-earlier-review

Claims:

  • --help and -h print the usage and exit 0: verified (scripts/measure-reference-pages.mjs:330, :349-352; both commands exit 0 on this head).
  • Help is handled before any other argument check: false; an unknown argument before the flag is still refused (scripts/measure-reference-pages.mjs:328-339).
  • The usage covers every flag, including --unused-on <pages>: verified (:305-314).
  • The usage says the numbers are first-load minified and gzip bytes per reference page, base against head: verified (:299-301).
  • The usage gives the limit as 0.3 KB gzip, 307 B: verified (:39, :310), matching the record's 1,024-byte KB.
  • The usage includes an example run: verified (:316-317).
  • The same text replaces the message for a missing --base: verified (:341-343; the usage goes to stderr with exit 1).
  • Before the change, --help failed with "Unknown argument: --help" and exit 1: verified on the base.
  • No package source changes, and the measurement path is untouched: verified (the diff touches only USAGE, parseArgs and the help branch in main).
  • No CI impact and no workflow changes: verified.
  • The test file's 11 tests pass, including the two new ones: verified (11 passed).
  • No public API, product behavior, visual or policy change, and no internal context: verified.

Files:

  • scripts/measure-reference-pages.mjs: finding (help after an unknown argument).
  • scripts/measure-reference-pages.test.mjs: the new help test covers only arguments after -h; part of the same finding.

Automated review (maintainer link)

Comment thread scripts/measure-reference-pages.mjs Resolved

@astracat-bot astracat-bot Bot 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.

Approved pending CI: CI has not run on this head yet because it skips draft pull requests, so it runs once the pull request is marked ready for review.

The earlier finding is fixed: --help and -h now win wherever they appear (scripts/measure-reference-pages.mjs:328-330), and the new expectations pin both orders (scripts/measure-reference-pages.test.mjs:157-158). The usage matches the record's four reference pages and its 307 B limit, and the measurement path is untouched.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • --help and -h print the usage and exit 0, before any other argument check: verified (scripts/measure-reference-pages.mjs:328-330, :351-354; --fast --help and --base main --fsat --help exit 0 on this head).
  • The usage covers every flag, including --unused-on <pages>: verified (:306-314 against the parser at :333-341).
  • The usage says the numbers are first-load minified and gzip bytes of each reference page, base against head: verified (:299-301).
  • The usage gives the limit as 0.3 KB gzip, 307 B: verified (:39, :310), matching the record's 1,024-byte KB.
  • The usage includes an example run: verified (:316-317).
  • The same text replaces the message for a missing --base: verified (:343-345; the usage goes to stderr with exit 1).
  • Before the change, --help printed "Unknown argument: --help" and exited 1: verified on the base.
  • After the change, --help and -h print the usage and exit 0: verified on this head.
  • The measurement runs exactly as before, no package source changes, and only the help flags are new besides the missing---base text: verified (the diff touches only USAGE, parseArgs and the help branch in main).
  • No CI impact and no workflow changes: verified (only two files under scripts/ change).
  • No public API, product behavior, visual or policy change, and no internal context in public text: verified.
  • The test file's 11 tests pass, and the new ones check help ahead of any other argument and the usage's flags, limit and example: verified (11 passed; scripts/measure-reference-pages.test.mjs:154-175).

Files:

  • scripts/measure-reference-pages.mjs: clear.
  • scripts/measure-reference-pages.test.mjs: clear; it pins both help orders and the usage text.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 18, 2026 03:13
@cixzhang
cixzhang merged commit 8f09fef into main Nov 18, 2026
253 of 348 checks passed
@github-actions
github-actions Bot deleted the tools/size-pages-help-2 branch November 19, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — 2dfd0819 Deployed Nov 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant