Skip to content

Commit 91b6059

Browse files
committed
docs: clarify cache override propagation and inheritance in comments
Update CacheOverride::None doc to explain inheritance from parent context. Add comments on the if-guard in plan_query_request explaining why skipping the update enables propagation, and why overrides are relative to the workspace config rather than the parent's resolved state. https://claude.ai/code/session_01AYbt3E5j8Adk9NB7Sprkah
1 parent 11b90cf commit 91b6059

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

crates/vite_task_plan/src/plan.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,17 @@ pub async fn plan_query_request(
557557
query_plan_request: QueryPlanRequest,
558558
mut context: PlanContext<'_>,
559559
) -> Result<ExecutionGraph, Error> {
560-
// Apply cache override from this request (nested `vp run --no-cache` etc.)
561-
// If the nested command has no override, inherit the parent's resolved config.
560+
// Apply cache override from `--cache` / `--no-cache` flags on this request.
561+
//
562+
// When `None`, we skip the update so the context keeps whatever the parent
563+
// resolved — this is how `vp run --cache outer` propagates to a nested
564+
// `vp run inner` that has no flags of its own.
562565
let cache_override = query_plan_request.plan_options.cache_override;
563566
if cache_override != CacheOverride::None {
567+
// Override is relative to the *workspace* config, not the parent's
568+
// resolved config. This means `vp run --no-cache outer` where outer
569+
// runs `vp run --cache inner` re-enables caching from the workspace
570+
// defaults, rather than from the parent's disabled state.
564571
let final_cache = resolve_cache_with_override(
565572
*context.indexed_task_graph().global_cache_config(),
566573
cache_override,

crates/vite_task_plan/src/plan_request.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ impl ScriptCommand {
3434
/// CLI-level cache override from `--cache` / `--no-cache` flags.
3535
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
3636
pub enum CacheOverride {
37-
/// No override — use the resolved config from the task graph.
37+
/// No override — inherit the parent's resolved cache config.
38+
/// For a top-level `vp run`, this is the workspace config.
39+
/// For a nested `vp run` inside a script, this is whatever the parent resolved.
3840
#[default]
3941
None,
4042
/// Force all caching on (`--cache` flag).

0 commit comments

Comments
 (0)