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
fix(cache): resolve and validate tracked envs from the session env snapshot
The IPC Recorder's env map and PostRunFingerprint::validate both read the
live process env (std::env::vars_os / var_os). Tasks' envs come from the
plan; std::env::vars_os is only meant to bootstrap the session snapshot
(Session.envs) at init. Thread that snapshot through ExecutionContext /
execute_spawn into Recorder::new (now Arc-shared) and through
ExecutionCache::try_hit into validate, so getEnv/getEnvs and the
tracked-env lookup validation resolve against the same map the plan was
built from — and tests can inject envs via Session::init_with.
Document the rule in CLAUDE.md (Code Constraints → Environment Variables).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -140,6 +140,10 @@ Enforced by `.clippy.toml`:
140
140
- Only convert to std paths when interfacing with std library functions
141
141
- Add necessary methods in `vite_path` instead of falling back to std path types
142
142
143
+
### Environment Variables
144
+
145
+
`std::env::vars_os` is read exactly once — in `Session::init` — to bootstrap the session env snapshot (`Session.envs`). Everything downstream (planning, spawn env resolution, IPC `getEnv`/`getEnvs`, cache fingerprint validation) must use that snapshot or the plan's resolved env maps, never re-read the live process env. This keeps a run's behavior consistent with its plan and lets tests inject envs via `Session::init_with`.
146
+
143
147
### Cross-Platform Requirements
144
148
145
149
All code must work on both Unix and Windows without platform skipping:
Copy file name to clipboardExpand all lines: docs/runner-task-ipc/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Report information from the tools to the runner, to help runner cache results wi
20
20
Workflow:
21
21
22
22
1. For each spawn execution, `vite_task` starts an IPC server via `vite_task_server::serve` and passes the server's connection info plus the path to a materialized node addon into the child's env.
23
-
2. The task process loads the addon through `@voidzero-dev/vite-task-client` and reports back over IPC: which reads/writes to ignore, which envs it needs (returned by the runner from the spawn's resolved env map), and whether to disable caching.
23
+
2. The task process loads the addon through `@voidzero-dev/vite-task-client` and reports back over IPC: which reads/writes to ignore, which envs it needs (resolved by the runner from the session env snapshot its plan was bootstrapped from), and whether to disable caching.
24
24
3. When the task exits, the server drains and hands its collected reports back to `vite_task`, which feeds them into the cache layer.
0 commit comments