Automatic output tracking misses files a task renames into place, so a cache hit restores nothing
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- node.js, rust
- Domínio
- build-system, tooling
Direção de pesquisa
Start with crates/fspy_preload_unix/src/interceptions/mod.rs to see how filesystem calls are intercepted, then read crates/vt/src/session/cache/archive.rs to understand how recorded outputs are archived. The issue calls out Linux rename, renameat, and renameat2, plus macOS rename and renameat; done means those renames record the destination so a cache hit restores the renamed file or folder contents.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Written by an AI agent (Claude) on behalf of @jasonkuhrt.
Problem
With automatic output tracking, the default when cache.output is omitted or holds { auto: true }, a task that writes its output somewhere else and then renames it into place gets a cache entry without that output. A cache hit then restores nothing.
Writing to a temporary path and renaming is the standard way to replace a file or a folder atomically. TanStack Router's generator writes its route tree this way: a temp file, then rename (safeFileWrite, router-generator/src/generator.ts L1203-L1277). Our own code generators stage a whole folder and rename it over the old one.
Reproduction on vite-plus 1.4.0, with no remote cache:
// vite.config.ts
import { defineConfig } from 'vite-plus';
export default defineConfig({
run: {
tasks: {
generate: {
command: 'node generate.mjs',
cache: { input: ['generate.mjs'] },
},
},
},
});
// generate.mjs: stages the output, then renames it into place
import { mkdirSync, renameSync, rmSync, writeFileSync } from 'node:fs';
rmSync('.staging', { recursive: true, force: true });
mkdirSync('.staging');
writeFileSync('.staging/a.ts', 'export const a = 1;\n');
rmSync('generated', { recursive: true, force: true });
renameSync('.staging', 'generated');
$ vp run generate
$ node generate.mjs
$ ls generated
a.ts
$ rm -rf generated
$ vp run generate
vp run: cache hit, 39ms saved.
$ ls generated
ls: generated: No such file or directory # the hit restored nothing
Replacing the renameSync line with a direct writeFileSync('generated/a.ts', …) makes the same hit restore generated/a.ts.
Cause
fspy records the write to .staging/a.ts. It has no rename interception (fspy_preload_unix/src/interceptions/mod.rs covers access, dirent, open, spawn and stat), so generated/a.ts is never recorded. When outputs are archived, the recorded .staging/a.ts no longer exists and is skipped (archive.rs L29-L34), which leaves the entry empty.
The workaround today is a positive cache.output glob for the destination. But a glob archives whatever matches on disk, including files a previous run left there, so it gives up what automatic tracking gets right.
Proposal: cover the common case, leave the long tail to explicit config
Record a rename's destination as a write:
- A file renamed to
dst:dstis written. - A folder renamed to
dst: every file underdstis written. These can be collected by walkingdstwhen outputs are archived, instead of tracking each file inside.
Covering rename, renameat and renameat2 on Linux and rename and renameat on macOS should catch nearly every atomic-write tool, since that is how Node's fs.rename and most tools' atomic writers move files.
Deliberately out of scope, where users keep declaring cache.output:
RENAME_EXCHANGE;- moving files into place with
link; - platforms or syscalls the interception layer doesn't reach yet.
Cross-filesystem moves need nothing, since they copy and so are already recorded as writes.
Related: #904 covers the cache-hit side, where a hit leaves behind files the cached run did not write.
- Linguagem predominante
- Rust
- Estrelas
- 480
- Forks
- 50
- Merge médio
- 1d 5h
- PRs com merge (30d)
- 63
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de voidzero-dev/vite-task
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
voidzero-dev/vite-task#921 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 56/100
voidzero-dev/vite-task#910 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Export OpenTelemetry client spans for the native remote cacheTalvez já em andamento @jasonkuhrt assumiu há 1 dia. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
voidzero-dev/vite-task#906 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 56/100
voidzero-dev/vite-task#905 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
voidzero-dev/vite-task#904 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de voidzero-dev/vite-task
Issues semelhantes
-
ai_p2 bug comp-datalake
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
ClickHouse/ClickHouse#128306 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
documentation
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
bug triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
area: ui enhancement good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
JavenKazebee/capture-room#166 ·
Mantenedores costumam responder em até 1 dia