Summary
A run task that produces files but does not declare output is still cached. On a later cache hit, vp replays stdout, reports success, and does not restore the files — so the artifact is silently missing while the exit status is 0.
Declaring output works correctly (files are restored). The problem is that omitting it produces a wrong result rather than a refusal to cache.
Reproduction
vite.config.ts:
import { defineConfig } from "vite";
export default defineConfig({
run: { tasks: { generate: "node -e \"require('fs').writeFileSync('generated.txt', 'hello')\"" } },
});
$ vp run generate
$ node -e "require('fs').writeFileSync('generated.txt', 'hello')"
$ ls generated.txt
generated.txt
$ rm generated.txt
$ vp run generate
$ node -e "require('fs').writeFileSync('generated.txt', 'hello')" ◉ cache hit, replaying
---
vp run: cache hit, 35ms saved.
$ echo $?
0
$ ls generated.txt
ls: generated.txt: No such file or directory
Adding output: ["generated.txt"] to the task fixes it — the file comes back on a cache hit.
Expected
vp cannot know a task's outputs without a declaration, so the cache hit is unsound by construction. Rather than replaying a hit that silently drops the artifact, it would be better to either not cache a task with no declared output, or warn once that the task is being cached with no known outputs.
The current default means a codegen or build step written as a plain string task appears to work, then quietly stops producing anything the moment the cache warms — with a green exit status. That is very hard to attribute; ours surfaced as a CI check that compared a generated file against itself and reported "up to date".
Secondary: the config error for a mistyped key is not actionable
Reaching output took a while because the plural spelling is rejected with:
error: Failed to load task graph
* Failed to load task config file for package at "<path>"
* data did not match any variant of untagged enum UserTaskDefinition
The message names neither the offending key (outputs), the task, nor the accepted fields.
Environment
- vp 0.1.24
- macOS 15 (Darwin 25.4.0), arm64
- Node 26.8.1
Summary
A run task that produces files but does not declare output is still cached. On a later cache hit, vp replays stdout, reports success, and does not restore the files — so the artifact is silently missing while the exit status is 0.
Declaring output works correctly (files are restored). The problem is that omitting it produces a wrong result rather than a refusal to cache.
Reproduction
vite.config.ts:
Adding output: ["generated.txt"] to the task fixes it — the file comes back on a cache hit.
Expected
vp cannot know a task's outputs without a declaration, so the cache hit is unsound by construction. Rather than replaying a hit that silently drops the artifact, it would be better to either not cache a task with no declared output, or warn once that the task is being cached with no known outputs.
The current default means a codegen or build step written as a plain string task appears to work, then quietly stops producing anything the moment the cache warms — with a green exit status. That is very hard to attribute; ours surfaced as a CI check that compared a generated file against itself and reported "up to date".
Secondary: the config error for a mistyped key is not actionable
Reaching output took a while because the plural spelling is rejected with:
The message names neither the offending key (outputs), the task, nor the accepted fields.
Environment