Skip to content

Commit 042ab37

Browse files
branchseerclaude
andauthored
fix: rename passThroughEnvs to untrackedEnv (#226)
## Key Changes - **Configuration fields**: Renamed `pass_through_envs` to `untracked_env` in: - `EnvConfig` and related structures - `EnabledCacheConfig` user configuration - `EnvFingerprints` struct - All snapshot test fixtures - **Constants and defaults**: Updated `DEFAULT_PASSTHROUGH_ENVS` to `DEFAULT_UNTRACKED_ENV` - **Cache fingerprint tracking**: Renamed `pass_through_env_config` to `untracked_env_config` in fingerprint structures - **Display and error messages**: Updated all user-facing messages and enum variants: - `PassThroughEnvAdded` → `UntrackedEnvAdded` - `PassThroughEnvRemoved` → `UntrackedEnvRemoved` - Error messages now reference "untracked env" instead of "pass-through env" - **Documentation and comments**: Updated all comments, docs, and TypeScript type definitions to use the new terminology - **Test fixtures**: Updated all snapshot files and test configuration files to reflect the new naming Co-authored-by: Claude <noreply@anthropic.com>
1 parent c69a26d commit 042ab37

File tree

82 files changed

+448
-451
lines changed

Some content is hidden

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

82 files changed

+448
-451
lines changed

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Tasks are defined in `vite-task.json`:
133133
"dependsOn": ["build", "package#task"],
134134
"cache": true,
135135
"env": ["NODE_ENV"],
136-
"passThroughEnvs": ["CI"],
136+
"untrackedEnv": ["CI"],
137137
"input": ["src/**", "!dist/**", { "auto": true }]
138138
}
139139
}
@@ -146,7 +146,7 @@ Tasks are defined in `vite-task.json`:
146146
- `dependsOn`: explicit task dependencies (`taskName` or `package#task`)
147147
- `cache` (task): enable/disable caching for this task (default: `true`)
148148
- `env`: env var names to fingerprint and pass to the task
149-
- `passThroughEnvs`: env var names to pass without fingerprinting
149+
- `untrackedEnv`: env var names to pass without fingerprinting
150150
- `input`: files for cache fingerprinting (globs, `{ "auto": true }`, negation patterns)
151151

152152
## Task Dependencies

crates/vite_task/docs/task-cache.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub struct SpawnFingerprint {
105105
pub cwd: RelativePathBuf,
106106
pub command_fingerprint: CommandFingerprint,
107107
pub fingerprinted_envs: BTreeMap<Str, Str>,
108-
pub pass_through_envs: BTreeSet<Str>,
108+
pub untracked_env: BTreeSet<Str>,
109109
pub fingerprint_ignores: Option<Vec<Str>>,
110110
}
111111

@@ -124,25 +124,25 @@ This ensures cache invalidation when:
124124

125125
- Working directory changes (package location changes)
126126
- Command or arguments change
127-
- Declared environment variables differ (pass-through envs don't affect cache)
127+
- Declared environment variables differ (untracked envs don't affect cache)
128128
- Program location changes (inside/outside workspace)
129129

130130
### 3. Environment Variable Impact on Cache
131131

132132
The `fingerprinted_envs` field is crucial for cache correctness:
133133

134134
- Only includes env vars explicitly declared in the task's `env` array
135-
- Does NOT include pass-through envs (PATH, CI, etc.)
135+
- Does NOT include untracked envs (PATH, CI, etc.)
136136
- These env vars become part of the cache key
137137

138138
When a task runs:
139139

140-
1. All env vars (including pass-through) are available to the process
140+
1. All env vars (including untracked) are available to the process
141141
2. Only declared env vars affect the cache key
142142
3. If a declared env var changes value, cache will miss
143-
4. If a pass-through env changes, cache will still hit
143+
4. If an untracked env changes, cache will still hit
144144

145-
The `pass_through_envs` field stores env names (not values) — if the set of pass-through env names changes, the cache invalidates, but value changes don't.
145+
The `untracked_env` field stores env names (not values) — if the set of untracked env names changes, the cache invalidates, but value changes don't.
146146

147147
### 4. Execution Cache Key
148148

crates/vite_task/docs/wildcard-env-patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This approach becomes cumbersome when dealing with multiple environment variable
3232
## Non-Goals
3333

3434
1. Full regex support (only glob-style wildcards)
35-
2. Wildcard patterns in `passThroughEnvs` (same as `env`)
35+
2. Wildcard patterns in `untrackedEnv` (same as `env`)
3636
3. Complex glob patterns like `{VITE,NODE}_*` (supported by wax crate)
3737

3838
## Proposed Solution

crates/vite_task/src/session/cache/display.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ pub enum SpawnFingerprintChange {
2424
/// Environment variable value changed
2525
EnvValueChanged { key: Str, old_value: Str, new_value: Str },
2626

27-
// Pass-through env config changes
28-
/// Pass-through env pattern added
29-
PassThroughEnvAdded { name: Str },
30-
/// Pass-through env pattern removed
31-
PassThroughEnvRemoved { name: Str },
27+
// Untracked env config changes
28+
/// Untracked env pattern added
29+
UntrackedEnvAdded { name: Str },
30+
/// Untracked env pattern removed
31+
UntrackedEnvRemoved { name: Str },
3232

3333
// Command changes
3434
/// Program changed
@@ -55,11 +55,11 @@ pub fn format_spawn_change(change: &SpawnFingerprintChange) -> Str {
5555
SpawnFingerprintChange::EnvValueChanged { key, old_value, new_value } => {
5656
vite_str::format!("env {key} value changed from '{old_value}' to '{new_value}'")
5757
}
58-
SpawnFingerprintChange::PassThroughEnvAdded { name } => {
59-
vite_str::format!("pass-through env '{name}' added")
58+
SpawnFingerprintChange::UntrackedEnvAdded { name } => {
59+
vite_str::format!("untracked env '{name}' added")
6060
}
61-
SpawnFingerprintChange::PassThroughEnvRemoved { name } => {
62-
vite_str::format!("pass-through env '{name}' removed")
61+
SpawnFingerprintChange::UntrackedEnvRemoved { name } => {
62+
vite_str::format!("untracked env '{name}' removed")
6363
}
6464
SpawnFingerprintChange::ProgramChanged => Str::from("program changed"),
6565
SpawnFingerprintChange::ArgsChanged => Str::from("args changed"),
@@ -104,14 +104,14 @@ pub fn detect_spawn_fingerprint_changes(
104104
}
105105
}
106106

107-
// Check pass-through env config changes
108-
let old_pass_through: FxHashSet<_> = old_env.pass_through_env_config.iter().collect();
109-
let new_pass_through: FxHashSet<_> = new_env.pass_through_env_config.iter().collect();
110-
for name in old_pass_through.difference(&new_pass_through) {
111-
changes.push(SpawnFingerprintChange::PassThroughEnvRemoved { name: (*name).clone() });
107+
// Check untracked env config changes
108+
let old_untracked: FxHashSet<_> = old_env.untracked_env_config.iter().collect();
109+
let new_untracked: FxHashSet<_> = new_env.untracked_env_config.iter().collect();
110+
for name in old_untracked.difference(&new_untracked) {
111+
changes.push(SpawnFingerprintChange::UntrackedEnvRemoved { name: (*name).clone() });
112112
}
113-
for name in new_pass_through.difference(&old_pass_through) {
114-
changes.push(SpawnFingerprintChange::PassThroughEnvAdded { name: (*name).clone() });
113+
for name in new_untracked.difference(&old_untracked) {
114+
changes.push(SpawnFingerprintChange::UntrackedEnvAdded { name: (*name).clone() });
115115
}
116116

117117
// Check program changes
@@ -164,9 +164,9 @@ pub fn format_cache_status_inline(cache_status: &CacheStatus) -> Option<Str> {
164164
| SpawnFingerprintChange::EnvValueChanged { .. },
165165
) => "envs changed",
166166
Some(
167-
SpawnFingerprintChange::PassThroughEnvAdded { .. }
168-
| SpawnFingerprintChange::PassThroughEnvRemoved { .. },
169-
) => "pass-through env config changed",
167+
SpawnFingerprintChange::UntrackedEnvAdded { .. }
168+
| SpawnFingerprintChange::UntrackedEnvRemoved { .. },
169+
) => "untracked env config changed",
170170
Some(SpawnFingerprintChange::ProgramChanged) => "program changed",
171171
Some(SpawnFingerprintChange::ArgsChanged) => "args changed",
172172
Some(SpawnFingerprintChange::CwdChanged) => "working directory changed",

crates/vite_task_bin/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn synthesize_node_modules_bin_task(
6363
args: args.into(),
6464
cache_config: UserCacheConfig::with_config(EnabledCacheConfig {
6565
env: None,
66-
pass_through_envs: None,
66+
untracked_env: None,
6767
input: None,
6868
}),
6969
envs: Arc::clone(envs),
@@ -128,7 +128,7 @@ impl vite_task::CommandHandler for CommandHandler {
128128
cache_config: UserCacheConfig::with_config({
129129
EnabledCacheConfig {
130130
env: None,
131-
pass_through_envs: Some(vec![name]),
131+
untracked_env: Some(vec![name]),
132132
input: None,
133133
}
134134
}),

crates/vite_task_bin/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async fn run() -> anyhow::Result<ExitStatus> {
3434
cache_config: UserCacheConfig::with_config({
3535
EnabledCacheConfig {
3636
env: Some(Box::from([Str::from("FOO")])),
37-
pass_through_envs: None,
37+
untracked_env: None,
3838
input: None,
3939
}
4040
}),

crates/vite_task_bin/tests/e2e_snapshots/fixtures/cache-miss-reasons/snapshots.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ steps = [
2222
]
2323

2424
[[e2e]]
25-
name = "pass-through env added"
25+
name = "untracked env added"
2626
steps = [
2727
"vp run test # cache miss",
28-
"json-edit vite-task.json \"_.tasks.test.passThroughEnvs = ['MY_PASSTHROUGH']\" # add pass-through env",
29-
"vp run test # cache miss: pass-through env added",
28+
"json-edit vite-task.json \"_.tasks.test.untrackedEnv = ['MY_UNTRACKED']\" # add untracked env",
29+
"vp run test # cache miss: untracked env added",
3030
]
3131

3232
[[e2e]]
33-
name = "pass-through env removed"
33+
name = "untracked env removed"
3434
steps = [
35-
"json-edit vite-task.json \"_.tasks.test.passThroughEnvs = ['MY_PASSTHROUGH']\" # setup",
35+
"json-edit vite-task.json \"_.tasks.test.untrackedEnv = ['MY_UNTRACKED']\" # setup",
3636
"vp run test # cache miss",
37-
"json-edit vite-task.json \"delete _.tasks.test.passThroughEnvs\" # remove pass-through env",
38-
"vp run test # cache miss: pass-through env removed",
37+
"json-edit vite-task.json \"delete _.tasks.test.untrackedEnv\" # remove untracked env",
38+
"vp run test # cache miss: untracked env removed",
3939
]
4040

4141
[[e2e]]

crates/vite_task_bin/tests/e2e_snapshots/fixtures/cache-miss-reasons/snapshots/pass-through env added.snap

Lines changed: 0 additions & 12 deletions
This file was deleted.

crates/vite_task_bin/tests/e2e_snapshots/fixtures/cache-miss-reasons/snapshots/pass-through env removed.snap

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
3+
expression: e2e_outputs
4+
---
5+
> vp run test # cache miss
6+
$ print-file test.txt
7+
initial content
8+
> json-edit vite-task.json "_.tasks.test.untrackedEnv = ['MY_UNTRACKED']" # add untracked env
9+
10+
> vp run test # cache miss: untracked env added
11+
$ print-file test.txtcache miss: untracked env config changed, executing
12+
initial content

0 commit comments

Comments
 (0)