Cached compound command can replay a later step after preceding vp exec rewrites its input
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- node.js, rust
- Lĩnh vực
- build-system, tooling
Hướng nghiên cứu
Bắt đầu bằng cách clone repro được liên kết, xem xét vite.config.ts, scripts/generate.mjs và scripts/normalize.mjs, rồi chạy cả hai trường hợp tái hiện bằng PowerShell. Truy vết cách xử lý cache của lệnh ghép từ điểm vào vp exec; hoàn tất khi một bước && về sau không tìm thấy cache sau khi một bước trước đó ghi lại đầu vào của nó, với cả hai kiểm tra cuối cùng đều đạt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
A cached compound command can replay a later && step even after an earlier vp exec ... step rewrites the file that the later step reads.
This is not specific to vp fmt: the same behavior reproduces when the later step is a plain node command that reads and rewrites the generated file.
Repro repo: https://github.com/SegaraRai/vitetask-repro04
Environment
Observed with:
vite-plus:0.1.19- package manager:
pnpm@10.33.2 - Node: 24.x
- OS: Windows
The repro commands below use PowerShell syntax for setting environment variables.
Reproduction
Clone and install:
git clone https://github.com/SegaraRai/vitetask-repro04.git
cd vitetask-repro04
vp install
The repo defines these tasks in vite.config.ts:
tasks: {
generate: {
command: "vp exec node ./scripts/generate.mjs && vp fmt src/generated",
cache: true,
input: ["scripts/generate.mjs"],
},
"generate:normalize": {
command: "vp exec node ./scripts/generate.mjs && node ./scripts/normalize.mjs",
cache: true,
input: ["scripts/generate.mjs", "scripts/normalize.mjs"],
},
}
Case 1, with vp fmt as the second step:
vp cache clean
$env:REPRO_MESSAGE = "first"; vp run generate
$env:REPRO_MESSAGE = "second"; vp run generate
vp fmt src/generated --check
Case 2, with plain node as the second step:
vp cache clean
$env:REPRO_MESSAGE = "first"; vp run generate:normalize
$env:REPRO_MESSAGE = "second"; vp run generate:normalize
node ./scripts/check-normalized.mjs
There is also a convenience script if useful:
vp exec node ./scripts/repro.mjs
Observed behavior
On the second run, the first step executes uncached, rewrites src/generated/messages.ts, and the second step is replayed from cache.
Representative output for case 1:
$ vp exec node ./scripts/generate.mjs ⊘ cache disabled
$ vp fmt src/generated ◉ cache hit, replaying
Representative output for case 2:
$ vp exec node ./scripts/generate.mjs ⊘ cache disabled
$ node ./scripts/normalize.mjs ◉ cache hit, replaying
The final check then fails because the generated file contains fresh content from the first step but did not receive the second step's normalization/formatting.
Expected behavior
The second step should not be replayed when its previously tracked input file was modified by an earlier step in the same compound command. It should miss cache and run against the current file contents.
Notes
- This does not appear to be specific to
vp fmt; the plainnode ./scripts/normalize.mjsvariant reproduces the same behavior. - In local testing, replacing the first command with plain
node ./scripts/generate.mjsdid not reproduce the issue. - Including the changing value in the task's tracked
env/inputavoids this particular repro, but the concern here is intra-task filesystem changes between&&items. - This does not seem to be about restoring output files from cache. The file is rewritten by the preceding uncached step in the current run; the problem is that the following step is still replayed even though its read input has just changed.
A possible direction is that cache validation for later && items may need to account for filesystem writes from earlier items in the same task, especially when the earlier item is an expanded/cache-disabled vp exec invocation.
- Ngôn ngữ chính
- Rust
- Star
- 466
- Fork
- 42
- Merge trung bình
- 1 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 21
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của voidzero-dev/vite-task
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
voidzero-dev/vite-task#738 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
voidzero-dev/vite-task#719 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
voidzero-dev/vite-task#717 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
voidzero-dev/vite-task#702 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
voidzero-dev/vite-task#700 · 2 bình luận ·
Tất cả issue của voidzero-dev/vite-task
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
state:needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
zed-industries/zed#64680 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
RustPython/RustPython#8802 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
TheLarkInn/aipm#2390 ·