fix(create): report install and format failures in the create summary - #2543
fix(create): report install and format failures in the create summary#2543m0g3r wants to merge 2 commits into
Conversation
`vp create` writes the template files first, then installs dependencies and formats the result. When either later step failed, the completion summary still reported "Scaffolded", suggested `vp run`, and exited 0 — three success signals for a project whose `node_modules` was missing. Track both step results, name the ones that failed, point `Next:` at the step that has to succeed first, and raise the exit code so scripts and CI see the failure. A skipped install (`VP_SKIP_INSTALL`) is not a failure, and the success path is unchanged. Closes voidzero-dev#2453
✅ Deploy Preview for viteplus-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The PTY snapshot suite caught this: `create_framework_shim_vue` and `new_create_vite` both scaffold a template whose `vite.config.ts` imports a plugin that is not installed yet (`@vitejs/plugin-vue`, `@vitejs/plugin-react`), so `vp fmt` cannot load the config and the format step fails on a project that is otherwise complete. Raising the exit code there turned both cases red. Only a failed install now changes the exit code. A format failure is still named in the summary — it is real, and silently dropping it is what voidzero-dev#2453 is about — but it leaves a runnable project, so it does not fail the command.
|
Thanks for approving the workflows — the run caught a real regression in this PR, and What failed. Root cause. Both cases scaffold a template whose generated Both declare that Why this settles the open question rather than needing a snapshot update. The PR body asked whether a format-only failure should exit non-zero, and offered the exit- So Verified in both directions: with the old expression restored, exactly the two guarding tests fail ( I have also corrected the description, which claimed I would not expect snapshot churn here. Generated by Claude Code |
Closes #2453
Problem
vp createwrites the template files first, then installs dependencies and formats the result. Those last two steps can fail after the project directory already exists — and when they did, the completion summary reported the run as a success anyway.Reproduced with the issue's recipe against this branch's base (
c4dcb15), using the built local CLI:Three success signals —
Scaffolded,Next: vp run, exit0— for a project that cannot run. The earlier "you may need to…" lines are easy to lose above a long install log, and a CI job reading only the exit code records the operation as successful.Changes
resolveCreateCompletion(increate/utils.ts) turns the install and format results into: which steps failed, which command is worth suggesting next, and whether the exit code should be non-zero.showCreateSummarynames each failed step, pointsNext:atvp installwhen dependencies are missing (the suggestedvp runcannot work without them), and raisesprocess.exitCode.runViteFmtcall sites; it is now threaded through alongside the install result.Same input on this branch:
The directory is still reported as scaffolded — as the issue notes, that part is true and is not the confusing bit.
Three behaviours deliberately preserved:
VP_SKIP_INSTALLreturnsstatus: 'skipped'; only'failed'counts.handleIgnoredBuildsalready setsprocess.exitCode = 1for a gated build that failed under--approve-builds, and this must not clear it.The success path is unchanged, byte for byte — no new line is printed and
Next:still readsvp run.A format failure is reported but does not fail the command
The first revision of this PR exited non-zero for a format-only failure too, and flagged that as a call for you to make. CI answered it, so I have taken the exit-
0variant rather than leave it open.The PTY snapshot suite failed on
create_framework_shim_vueandnew_create_vite, on all three platforms. Both scaffold a template whose generatedvite.config.tsimports a plugin that is not installed at the momentvp fmtruns:That project is complete and runnable; only formatting was skipped. Those two cases declare the
vp createstep assnapshot = false, so they recorded nothing until the step started exiting1— which is exactly the point: a routinevp createof areact-tsorvue-tstemplate would have started failing every CI job that runs it.So
resolveCreateCompletionnow returnsexitCode: installFailed ? 1 : 0. A format failure is still named in the summary (✗ Code was not formatted) — silently dropping it is what #2453 is about — andNext:still points atvp run, because the project runs. Only a missingnode_modulesmakes the command itself fail.Happy to scope the non-zero exit to
--no-interactiveruns as well, mirroring the existinghandleIgnoredBuildscondition, if you would prefer that.A note on the small refactor
showCreateSummaryandgetNextCommandmoved fromcreate/bin.tsto a newcreate/summary.ts, unchanged apart from the fix.bin.tsrunsmain()on import, so nothing in it can be unit-tested; moving these two functions is what let the regression test assert on the real summary output and exit code rather than only on the decision helper. Happy to drop the move if you would rather keep them inbin.ts.Testing
New
create/__tests__/summary.spec.tscovers the summary output and exit code; six cases added tocreate/__tests__/utils.spec.tscover the decision helper. Two of them now assert that a format-only failure is reported and leaves the exit code alone, so the snapshot regression above cannot come back silently.Verified in both directions. With
exitCoderestored to the previousfailures.length > 0 ? 1 : 0(and the tests kept), exactly the two guarding tests fail —2 failed | 53 passed:With the change applied,
55 passed.Checks actually run on the latest commit:
vitest run packages/cli/src/create/__tests__/{summary,utils}.spec.ts— 55 passed, and the both-directions result above.oxlint@1.79.0 -D correctness -D perf -D suspiciouson all four files — exit 0.oxfmt@0.64.0 --checkwith this repo'sfmtblock fromvite.config.ts— all four files correctly formatted. (Run without-cit reports issues on untouched files too, so the repo config is the meaningful check.)git diff --check— clean.Earlier revision, still valid for the parts it covers:
vitest run(full unit suite) — 1034 passed, 1 skipped, with 7 pre-existingpackages/promptssnapshot failures confirmed identical on a clean tree;tsgo -b tsconfig.json— error set byte-identical to a clean tree.Correcting the previous description: it said no
createsnapshot exercises a failing install or format, so I would not expect snapshot churn, and that I could not confirm it by running the suite. The first half was wrong — no fixture records such a failure, but two fixtures produce one, and they surface it through the exit code rather than through recorded output. CI caught what I could not run locally.The PTY snapshot suite still cannot run in my environment, so the fix above is verified by unit tests and by root-causing both recorded diffs, not by a local suite run.
AI assistance
Claude Opus 5 wrote the implementation, the tests, the reproductions, and this description. The change is agent-authored and has not had a separate human review. Every result quoted above is from an actual run, not an estimate.