Skip to content

Commit b0067a9

Browse files
authored
refactor: migrate to Session API with improved caching and cross-platform support (#89)
## Summary Major refactoring of the task execution system with a new Session-based architecture, improved caching with detailed miss reasons, and comprehensive cross-platform support. ### Architecture Changes - Migrate to new Session API, removing legacy code from `vite_task` - Add new `vite_task_bin` crate for CLI and test infrastructure - Implement event-based Reporter trait with `LabeledReporter` for formatted output - Move cache status from Finish to Start event for immediate feedback ### Cache System Improvements - Display specific cache miss reasons (env changes, input changes, cwd changes) - Add option to disable cache per-task - Show simplified cache status for single built-in commands - Improve cache statistics display in execution summary ### Execution Infrastructure - Implement `execute_spawn()` with fspy tracking for file system access monitoring - Real-time output emission during spawn execution using `tokio::select!` - Add `PostRunFingerprint` for content-based cache invalidation - Support for synthetic tasks with `additional_envs` field ### Cross-Platform Fixes - Windows path handling in snapshot redaction - Use `@yarnpkg/shell` for cross-platform e2e tests - Preserve Windows system env vars for cmd.exe compatibility - Track `FindFirstFile`/`FindNextFile` on Windows for cache invalidation ### Testing - Add comprehensive e2e test fixtures (cache-disabled, cache-keys, cache-miss-reasons, etc.) - New snapshot test infrastructure with path and duration redaction - Add `test_bins` utilities for testing (json-edit, print-env, print-file, replace-file-content) ### Other Changes - Fix spelling: "Syntatic" → "Syntactic" - Add workspace `node_modules/.bin` to session PATH - Various CI workflow fixes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent ec517aa commit b0067a9

File tree

211 files changed

+9007
-6547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+9007
-6547
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,21 @@ jobs:
6363
env:
6464
RUSTFLAGS: '-D warnings --cfg tokio_unstable' # also update .cargo/config.toml
6565

66-
# fspy contains tests for Node.js fs accesses.
67-
# use x86_64 node for x86_64-apple-darwin target.
66+
# Set up node and pnpm for running tests
67+
# For x86_64-apple-darwin, use x64 node for fspy tests that verify Node.js fs accesses
6868
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
6969
with:
7070
node-version-file: .node-version
7171
architecture: x64
7272
if: ${{ matrix.target == 'x86_64-apple-darwin' }}
7373

74+
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
75+
if: ${{ matrix.target != 'x86_64-apple-darwin' }}
76+
77+
# `pnpm install` prepares test bins used in snapshot tests
78+
# Must run after setup-node so correct native binaries are installed
79+
- run: pnpm install
80+
7481
- run: cargo test --target ${{ matrix.target }}
7582
if: ${{ matrix.os != 'ubuntu-latest' }}
7683

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ dist
55
*.tsbuildinfo
66
.DS_Store
77
/.vscode/settings.json
8+
*.snap.new

Cargo.lock

Lines changed: 83 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ compact_str = "0.9.0"
5454
const_format = "0.2.34"
5555
constcat = "0.6.1"
5656
copy_dir = "0.1.3"
57+
cow-utils = "0.1.3"
5758
crossterm = { version = "0.29.0", features = ["event-stream"] }
5859
csv-async = { version = "1.3.1", features = ["tokio"] }
5960
ctor = "0.6"
60-
dashmap = "6.1.0"
6161
derive_more = "2.0.1"
6262
diff-struct = "0.5.3"
6363
directories = "6.0.0"
@@ -72,10 +72,8 @@ fspy_shared = { path = "crates/fspy_shared" }
7272
fspy_shared_unix = { path = "crates/fspy_shared_unix" }
7373
fspy_test_utils = { path = "crates/fspy_test_utils" }
7474
futures = "0.3.31"
75-
futures-core = "0.3.31"
7675
futures-util = "0.3.31"
7776
insta = "1.44.3"
78-
itertools = "0.14.0"
7977
libc = "0.2.172"
8078
memmap2 = "0.9.7"
8179
nix = { version = "0.30.1", features = ["dir"] }
@@ -91,6 +89,7 @@ rand = "0.9.1"
9189
ratatui = "0.29.0"
9290
rayon = "1.10.0"
9391
ref-cast = "1.0.24"
92+
regex = "1.11.3"
9493
rusqlite = "0.37.0"
9594
rustc-hash = "2.1.1"
9695
seccompiler = { git = "https://github.com/branchseer/seccompiler", branch = "seccomp-action-raw" }
@@ -119,9 +118,11 @@ twox-hash = "2.1.1"
119118
uuid = "1.18.1"
120119
vec1 = "1.12.1"
121120
vite_glob = { path = "crates/vite_glob" }
121+
vite_graph_ser = { path = "crates/vite_graph_ser" }
122122
vite_path = { path = "crates/vite_path" }
123123
vite_shell = { path = "crates/vite_shell" }
124124
vite_str = { path = "crates/vite_str" }
125+
vite_task = { path = "crates/vite_task" }
125126
vite_task_graph = { path = "crates/vite_task_graph" }
126127
vite_task_plan = { path = "crates/vite_task_plan" }
127128
vite_workspace = { path = "crates/vite_workspace" }

0 commit comments

Comments
 (0)