Skip to content

chore: preflight --quick reports a typecheck that fails only on missing workspace builds as skipped - #13005

Draft
cixzhang wants to merge 2 commits into
mainfrom
chore/preflight-quick-missing-builds
Draft

cixzhang wants to merge 2 commits into
mainfrom
chore/preflight-quick-missing-builds

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Who this helps

Anyone running pnpm preflight --quick in a fresh checkout or worktree. Quick mode builds nothing, so a package whose typecheck reads another workspace package's build output fails on modules that simply aren't built yet. For example, the CLI's template docs import @astryxdesign/theme-neutral/built. Today that shows as a red typecheck FAIL and "not ready: 1", although the change has no type error.

What changes

  • scripts/preflight.mjs: in --quick mode the typecheck keeps its output (shown as before, and saved for the check). When it fails and every TypeScript error is a TS2307 on a workspace package's build output (@astryxdesign/<package>/built… or a …/dist… path), the row reports SKIP with "skipped, workspace builds missing; run pnpm build first". It does not count toward "not ready", and it never reads as a pass: the verdict ends "not checked: typecheck (workspace builds missing); run pnpm build, then run again before you flip". Any other error, including a missing third-party module, still fails the check. The default (full) mode is unchanged, since it builds first.
  • scripts/preflight.test.mjs: red-first cases. missingBuilds names only all-build-output error sets: a mixed set, no errors and a missing npm package all give null. The quick plan's typecheck keeps and judges its output. runChecks turns the all-missing-builds failure into a SKIP that the verdict doesn't count as a failure but reports as "not checked", never "quick checks pass", and keeps a real type error as FAIL, naming the command.
  • docs/contributing/pull-requests.md: one sentence in the --quick paragraph.

Tests

  • scripts/preflight.test.mjs: 21 passed; the 3 new cases failed on main's preflight.mjs first.
  • Found by a real --quick run on a fresh clone: its only typecheck errors were two TS2307 on @astryxdesign/theme-neutral/built in the CLI's template docs.
  • Prettier clean.

CI impact

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

Overlap checked: none

Owning session: noopbot (a61f66c2), under CI & Release (ca77f950). Land path: the drain's serial merge loop, 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 9:23pm 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, 9:28 PM UTC

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 250ecbc

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 6887671

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@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, since the pull request is still a draft.

The quick-mode SKIP works as described: an unbuilt CLI typecheck gives exactly the two @astryxdesign/theme-neutral/built errors and now ends "not checked", and the three new tests fail against main's script and pass here. Two non-blocking edges are worth a look:

  • A non-TypeScript failure in another package of the same run (a tsc out-of-memory abort, say) is also reported as "workspace builds missing", because missingBuilds reads only error TS lines, so the guide's "any other error fails it" says more than the code does.
  • The …/dist… branch of BUILD_OUTPUT also matches third-party specifiers such as next/dist/…, and anchoring it to relative paths would keep it to workspace builds.
Claims and files checked

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

  • Claim: on main, a quick run that fails only on unbuilt workspace packages shows typecheck FAIL and "not ready: 1" — verified (the base runChecks and formatTable; the red-first run).
  • Claim: the quick typecheck still shows its output and saves it for the check — verified (scripts/preflight.mjs:735-746); it now prints when the typecheck ends rather than live.
  • Claim: when every TypeScript error is a missing @astryxdesign/<package>/built or dist module, the row is SKIP with the missing-builds note — verified (scripts/preflight.mjs:475-494, :552-567; an unbuilt CLI typecheck).
  • Claim: that SKIP does not count toward "not ready" and the verdict says "not checked", never a pass — verified for the printed verdict (scripts/preflight.mjs:604-617); the exit status is 0.
  • Claim: any other error, including a missing third-party module, still fails — verified for TypeScript errors (the mixed-set and bare-package tests); the two edges above are the exceptions.
  • Claim: the default mode is unchanged — verified (only the quick plan sets the new fields).
  • Claim: the tests cover the classifier, the quick plan and the SKIP verdict, and keep a real type error as FAIL — verified (scripts/preflight.test.mjs:276-340).
  • Claim: the guide gains one sentence in the --quick paragraph — verified (docs/contributing/pull-requests.md:167-170).
  • Claim: 21 tests pass and the 3 new ones fail on main's script first — verified (21 passed on the head; 3 failed and 18 passed against main's script).
  • Claim: a fresh-clone quick run found only two missing theme-neutral/built errors in the CLI — verified (an unbuilt CLI typecheck gives exactly those two, in two template pages).
  • Claim: Prettier clean — verified.
  • Claim: no CI impact and no workflow changes — verified (no workflow or CI script changes).
  • Claim: no overlapping pull request — consistent with a search of open pull requests; not a code claim.
  • Claim: the ownership and landing note — a process statement with nothing in the code to check.
  • File: scripts/preflight.mjs — non-blocking notes (the two classifier edges, buffered output, the exit status, and a header @output that omits the new verdict).
  • File: scripts/preflight.test.mjs — clear.
  • File: docs/contributing/pull-requests.md — non-blocking ("any other error fails it" is broader than the classifier).

Automated review (maintainer link)

Comment thread scripts/preflight.mjs

/** A missing module that is a workspace package's build output. */
const BUILD_OUTPUT =
/error TS2307: Cannot find module '(?:@astryxdesign\/[^']+\/built(?:\/[^']*)?|[^']*\/dist(?:\/[^']*)?)'/;

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: the …/dist… branch also matches third-party specifiers, for example 'next/dist/shared/lib/image-config', which four docsite tests import, so a missing third-party module reached through a dist subpath would SKIP. The docsite is outside the quick typecheck today; anchoring the branch to relative specifiers (starting ./ or ../) keeps it to workspace builds.

Comment thread scripts/preflight.mjs
Comment on lines +490 to +491
const errors = text.split('\n').filter(line => /error TS\d+/.test(line));
if (errors.length === 0 || !errors.every(line => BUILD_OUTPUT.test(line)))

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: only error TS lines are classified, but the exit code covers every package in the recursive run. Built-only TS2307 from one package plus a non-TypeScript failure from another (tsc out of memory, a failing step in a typecheck chain) gives SKIP "workspace builds missing". Skipping only when every failing package in pnpm's [ERROR] <package> summary printed build-output errors would keep "any other error fails it" true.

Comment thread scripts/preflight.mjs
Comment on lines +737 to +746
const result = spawnSync(command[0], command.slice(1), {
cwd: ROOT,
env: {...process.env, ...env},
stdio: ['ignore', 'pipe', 'pipe'],
maxBuffer: 256 * 1024 * 1024,
});
const text = `${result.stdout ?? ''}${result.stderr ?? ''}`;
process.stdout.write(text);
fs.writeFileSync(stdout, text);
return result.status ?? 1;

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: piping through spawnSync buffers the whole typecheck, so nothing prints until it ends and stderr follows stdout. Streaming while keeping the log would need an asynchronous spawn, if live output matters here.

This branch was successfully deployed

1 active deployment
Preview — 68876718 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