voidzero-dev / voidzero-dev/vite-plus
vp run: a task with no declared `output` is still cached, and the cache hit silently drops its files
- Dominant language
- Rust
- Stars
- 5.8k
- Forks
- 262
- Avg merge
- 1d 34m
- Merged PRs (30d)
- 135
Description
### 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`:
```ts
import { defineConfig } from "vite";
export default defineConfig({
run: { tasks: { generate: "node -e \"require('fs').writeFileSync('generated.txt', 'hello')\"" } },
});
```
```console
$ 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 ""
* 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
Contributor guide
Research direction
Reproduce the issue from vite.config.ts with `vp run generate`, removing generated.txt between runs, and compare behavior with and without `output`. Trace the `vp run` cache-hit path and task configuration validation. Done means a task without declared outputs no longer silently reports a successful hit while omitting generated files, and mistyped output configuration is actionable if that part is addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, rust, typescript
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100