Skip to content

chore: pnpm preflight runs the pre-review report and CI's checks for a change - #12755

Merged
cixzhang merged 4 commits into
mainfrom
chore/preflight
Nov 19, 2026
Merged

cixzhang merged 4 commits into
mainfrom
chore/preflight

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Who this helps

Contributors and agents who want to know, before they mark a pull request ready, whether CI will pass and what the pre-review checklist says. Today that means running pnpm review:pre and then guessing which of CI's checks apply to the change, or waiting for CI to find out.

What changes

  • scripts/preflight.mjs (pnpm preflight [--base <ref>] [--browser | --quick] [--wrap <command>]):
    • it checks committed work, as CI's test listers do (they diff commits): with uncommitted changes it stops with exit 2, and with no change it says so and exits 0. The changed files come from pre-review.mjs's own changedFiles (now exported), so the report and the checks always plan from the same files;
    • first pnpm review:pre's report, in-process (buildReport, at HEAD), then the checks CI runs for this change, scoped the way CI scopes them;
    • the scope comes from CI's own sources, with no second copy of their rules: change-scope.cjs classifyChanges decides the lane (spec-only, docsite-only, tooling-only, Lab-only, full suite or scoped); the Vitest lists come from the same vitest list --changed and fs-guard-tests.mjs commands the test legs run, from the merge base; --browser uses playwright-legs.mjs select-chromium with the scope pattern read from ci.yml's selection step, and pnpm test:a11y-contract:pr with BASE_SHA set to the merge base;
    • the checks: pnpm build and the typecheck of the changed packages and their dependents (on the Lab lane, CI's pnpm -F @astryxdesign/lab -F @astryxdesign/storybook typecheck; skipped on the spec, docsite and tooling lanes, as in CI), ESLint on the changed files, Prettier on the changed *.ts, *.tsx and *.md files (the set CI's formatting step checks, skipped on the docsite and spec lanes as there) and pnpm check:repo, the UI and Node Vitest tests the change reaches, pnpm check:knowledge and pnpm check:changesets. With --browser, it also builds Storybook and runs the accessibility and Chromium interaction specs the change selects;
    • a failing check stops at its failing command, and the next check still runs. A review:pre finding counts as a failure;
    • it prints one PASS, FAIL or SKIP line for each check, then the command of each failing check to copy, "ready to flip" or "not ready: N", and a line saying CI can run more for the change than these checks (whole-repository lint and its text and comment checks, the build tests, and the browser, visual, WebKit, accessibility and docsite jobs), so a pass is not CI's verdict. It exits 1 when a check fails;
    • --wrap <command> (or PREFLIGHT_WRAP) runs each heavy step (build, test, knowledge) as <command> <kind> <step...>, for a machine that limits concurrent heavy jobs;
    • it states its limit: it reproduces the pre-review checklist and CI's checks; a reviewer still judges the change.
    • --quick is not CI-equivalent. It runs review:pre, the typecheck of the changed packages alone (no build; their dependencies' build from an earlier pnpm build), ESLint on the changed files, the changed test files alone, check:knowledge and check:changesets, in minutes. It builds nothing and leaves out dependent packages, the tests the change reaches through an import, and the guards. It ignores --browser, and a passing run ends with "quick checks pass; run pnpm preflight before you flip", never "ready to flip". The default stays the scoped run of CI's main checks above.
  • scripts/preflight.test.mjs: which checks each lane plans (scoped component change, spec-only, Lab-only, full suite, --browser, and --quick: no build, no guard, no dependents, only changed tests, and its own verdict line); that a failing command fails its check, is named for copying, and does not stop the next check; that the wrapper takes only heavy steps; that an empty test list passes without running; the table's verdict lines; and that the Chromium scope read from ci.yml is a valid pattern.
  • Docs: docs/contributing/pull-requests.md adds "Before you mark ready", and AGENTS.md adds one line. package.json adds the preflight script.

Preflight is not a required step.

Tests

  • scripts/preflight.test.mjs: 18 passed (adds the committed-work stop and the no-change exit, the Lab lane's typecheck, Prettier on CI's file set and its spec-lane skip, and the verdict's "CI can run more" line). (The tests were written with the module, so the only red state was the missing module.)
  • An end-to-end run on a one-line Core change (--base HEAD, heavy steps wrapped) went through review:pre, the full build, the scoped typecheck, ESLint, check:repo, the UI lists and run (275 test files, scoped as CI scopes them), and the Node lists, then started the Node run (1,631 files, because the source-reading guards always run, as in CI). I stopped it at a 55-minute bound on a loaded machine. Six UI tests failed there under a load average near 40 (touch-timing and clipboard cases, plus a postinstall test that reads the checkout's location). Those failures come from the machine, not from preflight: it reported them as CI would.
  • Prettier clean.

CI impact

CI impact: none; a local command, and no workflow changes.

Overlap checked: none (no open pull request adds a local CI-equivalent runner)

Owning session: noopbot (a61f66c2), under CI & Release (ca77f950). Land path: the shipper, through merge-guard, on green, CodeBunny approval and Specs' exact-head /approve-spec.

@vercel

vercel Bot commented Nov 19, 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 19, 2026 1:50am UTC

Request Review

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

astracat-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 19, 2026, 1:54 AM UTC

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 40a4a66

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · b3619d2

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.

pnpm preflight is a useful addition, but four things need to change before approval.

  • The default run prints "ready to flip" and is described as CI-equivalent, yet it leaves out checks CI runs for the same change: the Lab typecheck (which it reports as "CI runs no typecheck on this lane"), the docsite build and tests, the Lint workflow's formatting, import-boundary, probe-theme and CLI README checks, the first UI leg's extra checks and the Storybook build.
  • Uncommitted and untracked changes choose the lane, but CI's test listers diff commits only, so an uncommitted record edit passes both Vitest rows without running the tests that read it.
  • changedChanges in scripts/preflight.mjs copies changedFiles from scripts/pre-review.mjs, so export and call the existing one and the report and the checks always plan from the same files.
  • On a branch with no changes the run crashes with "Cannot read properties of undefined (reading 'length')" and exits 1, because buildReport returns no findings then.

Either add the missing lane steps to the default plan or say what it leaves out, as --quick already does; the inline comments point at each spot.

Claims and files checked

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

  • Claim: the lane comes from CI's own classifier: verified.
  • Claim: the Vitest lists come from CI's own listers, from the merge base: verified for committed changes, false for uncommitted and untracked ones.
  • Claim: the typecheck is skipped only where CI's typecheck skips: false for Lab-only changes.
  • Claim: the default stays the full CI-equivalent run: false.
  • Claim: --browser adds the Storybook build, the accessibility contracts and the selected Chromium specs: verified in the plan, not run.
  • Claim: a failing command fails its check and the next check still runs: verified.
  • Claim: a pre-review finding counts as a failure: verified.
  • Claim: one PASS, FAIL or SKIP line per check, the failing commands, the verdict line and exit 1: verified.
  • Claim: --wrap wraps only the heavy steps: verified; the knowledge check inside check:repo is not wrapped.
  • Claim: --quick checks only the changed packages, files and tests, ignores --browser and never says "ready to flip": verified.
  • Claim: the output states that a reviewer still judges the change: verified.
  • Claim: the new tests pass (14): verified.
  • Claim: an end-to-end run on a loaded machine reported as CI would: not rerun.
  • Claim: Prettier clean: verified; ESLint clean too.
  • Claim: the guide section, the AGENTS.md line and the package script are added: verified.
  • Claim: no CI impact: verified, no workflow changes.
  • Claim: preflight is not a required step: verified.
  • Claim: no open pull request overlaps: verified by search.
  • File scripts/preflight.mjs: four blocking findings and three non-blocking notes.
  • File scripts/preflight.test.mjs: pins the Lab "no typecheck" note (first finding).
  • File docs/contributing/pull-requests.md: CI-equivalence wording (first finding).
  • File AGENTS.md: "CI's checks scoped to the change" wording (first finding).
  • File package.json: clear.

Automated review (maintainer link)

Comment thread scripts/preflight.mjs Resolved
Comment thread scripts/preflight.mjs Resolved
Comment thread scripts/preflight.mjs Resolved
Comment thread scripts/preflight.mjs Resolved
Comment thread scripts/preflight.mjs Resolved
…k and Prettier, names the CI checks it leaves out, and reuses review:pre's changed files
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 8c47c45

@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.

pnpm preflight now checks only committed work, stops cleanly on a branch with no change, reuses review:pre's change list and runs CI's Lab typecheck, but two things still need to change before approval.

  • The "Not run here (CI runs them)" line in scripts/preflight.mjs leaves out checks CI runs for the same change (whole-repo ESLint through pnpm lint, the public-text and comment-provenance checks, the test-build and Node browser-contract jobs, and the visual, WebKit and accessibility jobs), so "ready to flip" still promises more than the plan runs, and the description still calls the default "the full CI-equivalent run".
  • The new Prettier step checks every changed file while CI's formatting step checks only *.ts, *.tsx and *.md, so a one-line edit to a script such as .github/scripts/cli-smoke-test.mjs, one of 1,027 tracked files Prettier would rewrite, prints "not ready: 1" where CI passes.

Name the remaining CI checks completely or in general terms, and pass Prettier only the file patterns CI checks; the inline comments point at both spots.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules since the last review: 0.
  • Claim: uncommitted or untracked work stops with exit 2, and a branch with no change exits 0: verified.
  • Claim: the change list is review:pre's own, now exported: verified.
  • Claim: the review:pre report runs first, in process, on the committed change: verified.
  • Claim: the lane comes from CI's own classifier: verified.
  • Claim: the Vitest lists come from CI's own listers, from the merge base: verified.
  • Claim: --browser uses CI's Chromium selection and the pull-request accessibility contracts: verified in the plan, not run.
  • Claim: build and typecheck of the changed packages and their dependents, CI's Lab typecheck on the Lab lane, none on the spec, docsite and tooling lanes: verified.
  • Claim: ESLint on the changed files and pnpm check:repo: verified.
  • Claim: Prettier on the changed files, scoped the way CI scopes it: false; CI checks only *.ts, *.tsx and *.md.
  • Claim: the reached UI and Node tests, check:knowledge and check:changesets: verified.
  • Claim: a failing command fails its check, the next check still runs, and a review:pre finding counts as a failure: verified.
  • Claim: one PASS, FAIL or SKIP line per check, the failing commands, the verdict line and exit 1: verified.
  • Claim: a line names the CI checks the run leaves out: false; the list is incomplete.
  • Claim: --wrap wraps only the heavy steps: verified; the knowledge check inside check:repo is not wrapped.
  • Claim: the output states that a reviewer still judges the change: verified.
  • Claim: --quick checks only the changed packages, files and tests, ignores --browser and never says "ready to flip": verified.
  • Claim: the default stays the full CI-equivalent run: false.
  • Claim: the new tests pass (16): verified.
  • Claim: an end-to-end run on a loaded machine reported as CI would: not rerun.
  • Claim: Prettier clean: verified; ESLint clean too.
  • Claim: the guide section, the AGENTS.md line and the package script are added: verified.
  • Claim: preflight is not a required step, and there is no CI impact: verified.
  • Claim: no open pull request overlaps: verified by search.
  • File scripts/preflight.mjs: two blocking findings and four non-blocking notes.
  • File scripts/preflight.test.mjs: pins the not-run text and the Prettier command (both findings).
  • File docs/contributing/pull-requests.md: CI-equivalence and Prettier wording (both findings).
  • File AGENTS.md: "CI's checks scoped to the change" wording (first finding).
  • File scripts/pre-review.mjs: clear.
  • File package.json: clear.

Automated review (maintainer link)

Comment thread scripts/preflight.mjs Resolved
Comment thread scripts/preflight.mjs Resolved
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec b3619d2

@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: pnpm preflight now passes Prettier only the changed TypeScript and Markdown files that CI's formatting step checks, and a passing run says CI can run more and decides, which settles both points from the last review. CI has not run on this head yet; it runs once the pull request is marked ready.

  • Non-blocking: the AGENTS.md line still calls only --quick "not CI-equivalent", which implies the default run is; saying CI can run more than either would match the guide and the run's own output.
Claims and files checked

Review mode: incremental; reason: none

  • Changed rules since the last review (0): none.
  • Claim: uncommitted or untracked work stops with exit 2, and a branch with no change exits 0: verified.
  • Claim: the change list is review:pre's own, now exported, so the report and the checks plan from the same files: verified.
  • Claim: the review:pre report runs first, in process, on the committed change: verified.
  • Claim: the lane comes from CI's own classifier: verified.
  • Claim: the Vitest lists come from CI's own listers, from the merge base: verified.
  • Claim: --browser uses CI's Chromium selection, scoped by the pattern read from the CI workflow, and the pull-request accessibility contracts against the merge base: verified in the plan, not run.
  • Claim: build and typecheck of the changed packages and their dependents, CI's Lab typecheck on the Lab lane, and none on the spec, docsite and tooling lanes: verified.
  • Claim: ESLint on the changed files, Prettier on the changed *.ts, *.tsx and *.md files except on the docsite and spec lanes, and pnpm check:repo: verified.
  • Claim: the reached UI and Node tests, check:knowledge and check:changesets: verified.
  • Claim: a failing command fails its check, the next check still runs, and a review:pre finding counts as a failure: verified.
  • Claim: one PASS, FAIL or SKIP line per check, the failing commands, the verdict line, a line saying CI can run more, and exit 1 on a failure: verified.
  • Claim: --wrap or PREFLIGHT_WRAP wraps the build, test and knowledge steps: verified; the knowledge check inside check:repo is not wrapped.
  • Claim: the output states that a reviewer still judges the change: verified.
  • Claim: --quick checks only the changed packages, files and tests, ignores --browser and never says "ready to flip": verified.
  • Claim: the default is the scoped run of CI's main checks: verified.
  • Claim: the tests pass (18): verified.
  • Claim: an end-to-end run on a loaded machine reported failures as CI would: not rerun.
  • Claim: Prettier clean: verified; ESLint is clean too.
  • Claim: the guide section, the AGENTS.md line and the package script are added: verified.
  • Claim: preflight is not a required step, and there is no CI impact: verified.
  • Claim: no open pull request overlaps: verified by search.
  • File scripts/preflight.mjs: clear; five non-blocking notes in the review.
  • File scripts/preflight.test.mjs: clear.
  • File docs/contributing/pull-requests.md: clear.
  • File AGENTS.md: one non-blocking note.
  • File scripts/pre-review.mjs: clear.
  • File package.json: clear.

Automated review (maintainer link)

Comment thread AGENTS.md
`pnpm review:pre` and its checklist from a fresh session.
- Before you mark a pull request ready: `pnpm preflight` runs `pnpm review:pre`
and CI's checks scoped to the change (`--browser` adds the browser specs;
`--quick` is a fast subset, not CI-equivalent).

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.

Non-blocking: calling only --quick "not CI-equivalent" implies the default run is, while the guide and the run's own last line say CI can run more. Suggest: (--browser adds the browser specs; --quick is a faster subset; CI can run more than either).

@cixzhang
cixzhang marked this pull request as ready for review November 19, 2026 01:57
@cixzhang
cixzhang merged commit cf8cff5 into main Nov 19, 2026
158 checks passed
@github-actions
github-actions Bot deleted the chore/preflight branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — b3619d2b Deployed Nov 19, 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