fix(plan): extend the command's env context with prefix envs before interpreting it#440
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
5dfba0f to
5a198fe
Compare
5a198fe to
8771d84
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8771d844d7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // per-and-item duplicate above scopes the extension to this | ||
| // command, matching shell semantics (`FOO=1 a && b` does not | ||
| // set `FOO` for `b`). | ||
| context.add_envs(and_item.envs.iter()); |
There was a problem hiding this comment.
Handle PATH prefix overrides case-insensitively on Windows
On Windows, environment variables are case-insensitive and the inherited path is commonly named Path; this insertion adds a separate PATH key instead of replacing the existing one. get_path_env later does a case-insensitive FxHashMap iteration, so with both Path and PATH present it can pick the inherited value and ignore a prefix like PATH=./bin tool, meaning executable lookup is still planned against the wrong path on Windows. This should mirror prepend_path_env and update the existing path key case-insensitively.
Useful? React with 👍 / 👎.

Motivation
Command-prefix env assignments should shape planning the same way they shape the spawned shell command. Without that, a task like
PATH=./bin toolcan be planned against the wrongPATH, and nested task expansion can observe an env context that does not match the command the user wrote. This PR makes command-local env available at the point where the command is interpreted, so planning and execution agree.Review focus
PATHresolving a tool during planning.Verification
cargo check --all-featurescargo clippy --all-features -- -D warningscargo testcargo test -p vite_task_plan --test plan_snapshotsDraft while the stack is under review.