Repository navigation
chore: preflight --quick reports a typecheck that fails only on missing workspace builds as skipped - #13005
chore: preflight --quick reports a typecheck that fails only on missing workspace builds as skipped#13005cixzhang wants to merge 2 commits into
Conversation
…ng workspace builds as skipped
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 250ecbc |
…s "not checked", never a pass
|
/approve-spec 6887671 |
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
There was a problem hiding this comment.
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
missingBuildsreads onlyerror TSlines, so the guide's "any other error fails it" says more than the code does. - The
…/dist…branch ofBUILD_OUTPUTalso matches third-party specifiers such asnext/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 baserunChecksandformatTable; 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>/builtordistmodule, 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
--quickparagraph — 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 againstmain's script). - Claim: a fresh-clone quick run found only two missing
theme-neutral/builterrors 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@outputthat 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).
|
|
||
| /** A missing module that is a workspace package's build output. */ | ||
| const BUILD_OUTPUT = | ||
| /error TS2307: Cannot find module '(?:@astryxdesign\/[^']+\/built(?:\/[^']*)?|[^']*\/dist(?:\/[^']*)?)'/; |
There was a problem hiding this comment.
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.
| const errors = text.split('\n').filter(line => /error TS\d+/.test(line)); | ||
| if (errors.length === 0 || !errors.every(line => BUILD_OUTPUT.test(line))) |
There was a problem hiding this comment.
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.
| 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; |
There was a problem hiding this comment.
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.
Who this helps
Anyone running
pnpm preflight --quickin 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 redtypecheck FAILand "not ready: 1", although the change has no type error.What changes
scripts/preflight.mjs: in--quickmode the typecheck keeps its output (shown as before, and saved for the check). When it fails and every TypeScript error is aTS2307on a workspace package's build output (@astryxdesign/<package>/built…or a…/dist…path), the row reports SKIP with "skipped, workspace builds missing; runpnpm buildfirst". It does not count toward "not ready", and it never reads as a pass: the verdict ends "not checked: typecheck (workspace builds missing); runpnpm 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.missingBuildsnames 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.runChecksturns 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--quickparagraph.Tests
scripts/preflight.test.mjs: 21 passed; the 3 new cases failed on main'spreflight.mjsfirst.--quickrun on a fresh clone: its only typecheck errors were twoTS2307on@astryxdesign/theme-neutral/builtin the CLI's template docs.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.