You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs(cache): say that output: [{ auto: true }] records only files the run wrote #3482
Automatic output tracking records the files a task writes during the run that fills the cache entry. Code generators often skip files that are already current (the TanStack Router generator, paraglide-js compile, wrangler types). On a tree where the generated files already exist, the run that creates the cache entry writes nothing, so the entry holds no outputs. Delete the generated files, run the task again, and you get a cache hit that restores nothing.
Repro (vite-plus 1.7.0):
A task codegen that runs paraglide-js compile --outdir src/paraglide, with cache: { input: [{ auto: true }, '!src/paraglide/**'], output: [{ auto: true }] }.
vp run codegen twice: the second is a hit.
rm -rf src/paraglide && vp run codegen: a cache hit, and src/paraglide is still missing.
Listing the outputs explicitly (output: [{ auto: true }, 'src/paraglide/**']) fixes it. guide/automatic-data-tracking.md and config/run.md describe auto output as write tracking but don't warn about generators that skip unchanged files. Suggested: a row in the cases table, or a note under output, recommending explicit globs for generator tasks.
Priority:P2: has workaround. The caching engine is working as designed, but the missing documentation warning can surprise users of code generators that skip unchanged files. The workaround (adding explicit output globs to cache.output) is straightforward.
The root cause is not in the cache engine itself — automatic output tracking intentionally records only files the task process writes. The problem is that the docs don't warn that generators such as paraglide-js compile, TanStack Router, or wrangler types may write nothing when their outputs already exist, leaving a cache entry with no outputs. Deleting the generated files later then yields a cache hit that restores nothing.
I found a potential fix for this issue. I added warning boxes to docs/guide/automatic-data-tracking.md and docs/config/run.md that explain the limitation, plus a table row showing the workaround pattern output: [{ auto: true }, 'src/paraglide/**']. The fix branch is linked above; it should be reviewed before merging.
Automatic output tracking for vp run tasks records only files the task process actually writes during the run that creates the cache entry. Code generators that skip writing files which are already current therefore produce a cache entry with no outputs. If the generated files are later deleted, subsequent runs still hit the cache but restore nothing, leaving the output directory missing.
The issue requests a documentation note in guide/automatic-data-tracking.md and/or config/run.md warning about this behavior and recommending explicit output globs for generator tasks.
Environment
Repository: /home/runner/work/vite-plus/vite-plus
Branch: triagebot/fix-3482
vp version: v1.7.0 (local vite-plus 1.7.0)
Node.js: v24.22.3
pnpm: v12.11.2
OS: Ubuntu (GitHub Actions runner)
vite-plus linked from checkout at packages/cli
Reproduction Path
Created minimal reproduction at /tmp/vite-plus-triage/gh-3482/repro.
This exactly matches the reported behavior: a cache hit that restores nothing.
Control Case
Modified vite.config.ts to add an explicit output glob:
output: [{auto: true},'src/generated/**'],
After clearing cache and re-creating the initial file, the first two runs behaved the same (cache miss, then cache hit). However, after deleting src/generated/, the next run restored the missing file from the cache.
This confirms:
{ auto: true } output tracking only archives files the task wrote.
Explicit output globs archive files matching the pattern even when the task did not write them.
The suggested workaround (output: [{ auto: true }, '<glob>/**']) fixes the behavior.
Result
Reproduced: Yes.
The current behavior matches the report. A documentation update is appropriate to warn users that output: [{ auto: true }] records only writes, and to recommend explicit output globs for tasks that may skip already-current generated files.
Diagnosis
Affected Files and Lines
docs/guide/automatic-data-tracking.md:40
States: "File system tracking also tracks outputs. If you omit cache.output, Vite Task archives files the command writes after a successful run and restores them on a cache hit."
docs/guide/automatic-data-tracking.md:279
The "When To Add Manual Config" table lists cases for overriding inputs/outputs but does not mention generator tasks that skip up-to-date files.
docs/config/run.md:333-350
The cache.output section describes automatic write tracking and using explicit globs to exclude files (e.g., !build.log), but does not warn that tools which skip unchanged files create cache entries with no outputs.
Root Cause
The observed behavior is expected from the cache engine. Vite Task's automatic output tracking intentionally records only files the task process writes during the run. When a code generator sees that its outputs are already current and skips writing them, the cache entry for that run captures zero output files. Later, even if the generated files are deleted, the cache key still matches (inputs are unchanged), so Vite Task replays the cached run — including its empty output set — instead of re-running the generator.
The defect is in the documentation: it explains automatic output tracking as "files the command writes" without highlighting that unchanged-skipping generators may write nothing, producing a misleading cache hit.
Suggested Fix Approach
In docs/guide/automatic-data-tracking.md, add a warning or limitation note in the "File System Tracking" outputs subsection explaining that automatic output tracking only archives files actually written during the cache-filling run.
In the "When To Add Manual Config" table, add a row such as:
Case: Generator skips files that are already up to date
In docs/config/run.md, under cache.output, add a note that { auto: true } should be combined with explicit output globs for generator tasks that may skip writing unchanged files.
Edge Cases
Generators that always rewrite their outputs are unaffected.
Generators that partially skip files may create cache entries that restore only a subset of outputs, leading to inconsistent state.
Adding an explicit output glob archives the files as they existed at cache time, even if the generator would have produced different content on a fresh run. This is usually the desired behavior for deterministic generators.
Verification
Claim
Observed behavior: A cached vp run codegen task, configured with output: [{ auto: true }], produced a cache hit that restored no files after the generated output directory was deleted. The generator script skipped writing because the files already existed when the cache entry was created.
Expected behavior (reporter): The documentation should warn that automatic output tracking records only files written during the cache-filling run, and should recommend explicit output globs for generator tasks that skip unchanged files.
Research
Product documentation in docs/guide/automatic-data-tracking.md:40 states: "File system tracking also tracks outputs. If you omit cache.output, Vite Task archives files the command writes after a successful run and restores them on a cache hit." This wording matches the observed behavior (only written files are archived).
docs/config/run.md:333-337 describes cache.output as "automatic write tracking" and says Vite Task "uses automatic write tracking to choose those files." Again, the behavior is consistent with the docs.
Neither doc page warns that tools skipping unchanged files leave cache entries with empty outputs.
The "When To Add Manual Config" table in docs/guide/automatic-data-tracking.md:279 has no row for generator tasks that skip already-current files.
git blame shows these descriptions were added in 8696d857 ("docs: Vite Task cache reuse and tool-reported caching") and updated in 70185afa (a vite-task bump); neither commit added guidance for unchanged-skipping generators.
gh search issues --repo voidzero-dev/vite-plus "automatic output tracking" returns only this issue; no prior discussion was found.
The actual cache engine lives in vite-task, a git dependency in Cargo.toml; the behavior is not implemented in this repository.
Verdict
bug — The caching engine is behaving as documented (it tracks writes), but the documentation is incomplete for a common and non-obvious generator use case. Users reasonably expect cached tasks to restore their outputs after deletion; the current docs do not warn that automatic output tracking can fail to do so for generators that skip unchanged files. The requested documentation update is a valid bug fix.
Fix
Changed Files
docs/guide/automatic-data-tracking.md
Added a warning box after the automatic output tracking paragraph explaining that only files actually written during the cache-filling run are archived, with an example generator task that combines { auto: true } with an explicit output glob.
Added a row in the "When To Add Manual Config" table for generator tasks that skip unchanged files.
docs/config/run.md
Added a warning box under the cache.output section with the same guidance.
Rationale
The caching engine is behaving as designed; the defect is incomplete documentation. The fix makes the limitation visible in both the conceptual guide and the config reference, and shows users the exact pattern (output: [{ auto: true }, 'src/paraglide/**']) that resolves the issue.
Regression Test
No regression test was added. The change is documentation-only and does not affect executable behavior; existing caching tests are unaffected. Validation was performed with the original reproduction and a control case.
Re-ran the reproduction with the documented workaround (output: [{ auto: true }, 'src/generated/**']):
First run: cache miss, generator skips writing (file already exists).
Second run: cache hit.
After rm -rf src/generated, third run: cache hit and the missing src/generated/out.txt was restored.
Verified all referenced documentation links and commands remain valid; no new external links were introduced.
Alternatives Considered
Only adding a table row: less discoverable than a warning box with a complete example.
Only adding a warning in config/run.md: the guide page is where users learn the tracking model, so both locations are warranted.
Changing the caching engine to archive existing files matching output: [{ auto: true }] automatically: rejected because { auto: true } is explicitly write tracking; requiring explicit globs preserves the intended semantic boundary and avoids archiving unintended stale files.
This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
Activity
voidzero-bot commentedon Nov 18, 2026
cache.output) is straightforward.The root cause is not in the cache engine itself — automatic output tracking intentionally records only files the task process writes. The problem is that the docs don't warn that generators such as
paraglide-js compile, TanStack Router, orwrangler typesmay write nothing when their outputs already exist, leaving a cache entry with no outputs. Deleting the generated files later then yields a cache hit that restores nothing.I found a potential fix for this issue. I added warning boxes to
docs/guide/automatic-data-tracking.mdanddocs/config/run.mdthat explain the limitation, plus a table row showing the workaround patternoutput: [{ auto: true }, 'src/paraglide/**']. The fix branch is linked above; it should be reviewed before merging.Full Triage Report
Triage Report: #3482
Issue Summary
Automatic output tracking for
vp runtasks records only files the task process actually writes during the run that creates the cache entry. Code generators that skip writing files which are already current therefore produce a cache entry with no outputs. If the generated files are later deleted, subsequent runs still hit the cache but restore nothing, leaving the output directory missing.The issue requests a documentation note in
guide/automatic-data-tracking.mdand/orconfig/run.mdwarning about this behavior and recommending explicitoutputglobs for generator tasks.Environment
/home/runner/work/vite-plus/vite-plustriagebot/fix-3482vpversion: v1.7.0 (local vite-plus 1.7.0)vite-pluslinked from checkout atpackages/cliReproduction Path
Created minimal reproduction at
/tmp/vite-plus-triage/gh-3482/repro.Files
vite.config.ts(buggy configuration):generate.mjs(simulates a generator that skips up-to-date files):Initial state:
src/generated/out.txtexists with content"initial generated content".Steps and Results
rm -rf node_modules/.vite/task-cachesrc/generated/is still missing.This exactly matches the reported behavior: a cache hit that restores nothing.
Control Case
Modified
vite.config.tsto add an explicit output glob:After clearing cache and re-creating the initial file, the first two runs behaved the same (cache miss, then cache hit). However, after deleting
src/generated/, the next run restored the missing file from the cache.This confirms:
{ auto: true }output tracking only archives files the task wrote.output: [{ auto: true }, '<glob>/**']) fixes the behavior.Result
Reproduced: Yes.
The current behavior matches the report. A documentation update is appropriate to warn users that
output: [{ auto: true }]records only writes, and to recommend explicit output globs for tasks that may skip already-current generated files.Diagnosis
Affected Files and Lines
docs/guide/automatic-data-tracking.md:40cache.output, Vite Task archives files the command writes after a successful run and restores them on a cache hit."docs/guide/automatic-data-tracking.md:279docs/config/run.md:333-350cache.outputsection describes automatic write tracking and using explicit globs to exclude files (e.g.,!build.log), but does not warn that tools which skip unchanged files create cache entries with no outputs.Root Cause
The observed behavior is expected from the cache engine. Vite Task's automatic output tracking intentionally records only files the task process writes during the run. When a code generator sees that its outputs are already current and skips writing them, the cache entry for that run captures zero output files. Later, even if the generated files are deleted, the cache key still matches (inputs are unchanged), so Vite Task replays the cached run — including its empty output set — instead of re-running the generator.
The defect is in the documentation: it explains automatic output tracking as "files the command writes" without highlighting that unchanged-skipping generators may write nothing, producing a misleading cache hit.
Suggested Fix Approach
docs/guide/automatic-data-tracking.md, add a warning or limitation note in the "File System Tracking" outputs subsection explaining that automatic output tracking only archives files actually written during the cache-filling run.output: [{ auto: true }, 'src/paraglide/**']docs/config/run.md, undercache.output, add a note that{ auto: true }should be combined with explicit output globs for generator tasks that may skip writing unchanged files.Edge Cases
Verification
Claim
Observed behavior: A cached
vp run codegentask, configured withoutput: [{ auto: true }], produced a cache hit that restored no files after the generated output directory was deleted. The generator script skipped writing because the files already existed when the cache entry was created.Expected behavior (reporter): The documentation should warn that automatic output tracking records only files written during the cache-filling run, and should recommend explicit
outputglobs for generator tasks that skip unchanged files.Research
docs/guide/automatic-data-tracking.md:40states: "File system tracking also tracks outputs. If you omitcache.output, Vite Task archives files the command writes after a successful run and restores them on a cache hit." This wording matches the observed behavior (only written files are archived).docs/config/run.md:333-337describescache.outputas "automatic write tracking" and says Vite Task "uses automatic write tracking to choose those files." Again, the behavior is consistent with the docs.docs/guide/automatic-data-tracking.md:279has no row for generator tasks that skip already-current files.git blameshows these descriptions were added in8696d857("docs: Vite Task cache reuse and tool-reported caching") and updated in70185afa(a vite-task bump); neither commit added guidance for unchanged-skipping generators.gh search issues --repo voidzero-dev/vite-plus "automatic output tracking"returns only this issue; no prior discussion was found.vite-task, a git dependency inCargo.toml; the behavior is not implemented in this repository.Verdict
bug — The caching engine is behaving as documented (it tracks writes), but the documentation is incomplete for a common and non-obvious generator use case. Users reasonably expect cached tasks to restore their outputs after deletion; the current docs do not warn that automatic output tracking can fail to do so for generators that skip unchanged files. The requested documentation update is a valid bug fix.
Fix
Changed Files
docs/guide/automatic-data-tracking.md{ auto: true }with an explicit output glob.docs/config/run.mdcache.outputsection with the same guidance.Rationale
The caching engine is behaving as designed; the defect is incomplete documentation. The fix makes the limitation visible in both the conceptual guide and the config reference, and shows users the exact pattern (
output: [{ auto: true }, 'src/paraglide/**']) that resolves the issue.Regression Test
No regression test was added. The change is documentation-only and does not affect executable behavior; existing caching tests are unaffected. Validation was performed with the original reproduction and a control case.
Validation
git diff --check -- docs/config/run.md docs/guide/automatic-data-tracking.md— passed, no whitespace errors.output: [{ auto: true }, 'src/generated/**']):rm -rf src/generated, third run: cache hit and the missingsrc/generated/out.txtwas restored.Alternatives Considered
config/run.md: the guide page is where users learn the tracking model, so both locations are warranted.output: [{ auto: true }]automatically: rejected because{ auto: true }is explicitly write tracking; requiring explicit globs preserves the intended semantic boundary and avoids archiving unintended stale files.This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
I've opened a pull request with this fix: #3483
docs(cache): show how to restore skipped generator outputs (voidzero-…