From 225ac59d7b2b11cb6b2aeb262b2157152f4c3c9d Mon Sep 17 00:00:00 2001 From: wan9chi Date: Tue, 22 Sep 2026 22:19:17 +0800 Subject: [PATCH 01/14] feat(cache): resolve remote cache configuration Co-authored-by: GPT-6 Co-authored-by: Claude Opus 5.5 --- crates/vt/src/cli/mod.rs | 29 ++ crates/vt/src/session/mod.rs | 1 + crates/vt_bin/src/lib.rs | 1 + crates/vt_graph/run-config.ts | 16 +- crates/vt_graph/src/config/mod.rs | 2 +- crates/vt_graph/src/config/user.rs | 26 ++ crates/vt_graph/src/lib.rs | 24 + crates/vt_plan/src/envs.rs | 7 +- crates/vt_plan/src/error.rs | 3 + crates/vt_plan/src/lib.rs | 6 +- crates/vt_plan/src/plan.rs | 92 +++- crates/vt_plan/src/plan_request.rs | 2 + crates/vt_plan/src/remote_cache.rs | 93 +++- .../fixtures/remote_cache_config/package.json | 11 + .../remote_cache_config/snapshots.toml | 51 +++ .../query_cli_overrides_invalid_env.jsonc | 98 ++++ .../snapshots/query_controls_excluded.jsonc | 95 ++++ .../snapshots/query_default_read.jsonc | 98 ++++ .../query_nested_cli_overrides_env.jsonc | 132 ++++++ .../snapshots/query_nested_env_override.jsonc | 129 ++++++ .../snapshots/query_nested_inherits_cli.jsonc | 129 ++++++ .../snapshots/query_no_cache.jsonc | 53 +++ .../query_prefix_controls_excluded.jsonc | 95 ++++ .../query_sibling_endpoint_isolation.jsonc | 242 ++++++++++ .../query_sibling_mode_isolation.jsonc | 239 ++++++++++ .../query_synthetic_local_only.jsonc | 92 ++++ .../snapshots/query_task_local_only.jsonc | 92 ++++ .../snapshots/task_graph.md | 424 ++++++++++++++++++ .../remote_cache_config/vite-task.json | 30 ++ .../remote_cache_non_root_config/package.json | 6 + .../packages/app/package.json | 3 + .../packages/app/vite-task.json | 1 + .../pnpm-workspace.yaml | 2 + .../snapshots.toml | 0 .../snapshots/task_graph_load_error.snap | 1 + .../package.json | 7 + .../snapshots.toml | 34 ++ .../snapshots/query_default_off.jsonc | 92 ++++ .../snapshots/query_invalid_cli_mode.snap | 4 + .../snapshots/query_invalid_endpoint.snap | 1 + .../snapshots/query_invalid_env_mode.snap | 1 + .../snapshots/query_missing_cli_endpoint.snap | 1 + .../query_nested_endpoint_enables_read.jsonc | 129 ++++++ ...sted_endpoint_preserves_explicit_off.jsonc | 126 ++++++ .../query_unsupported_endpoint_scheme.snap | 1 + .../snapshots/task_graph.md | 88 ++++ .../vite-task.json | 3 + 47 files changed, 2793 insertions(+), 19 deletions(-) create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/package.json create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_excluded.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_excluded.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_synthetic_local_only.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/package.json create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/package.json create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/vite-task.json create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/pnpm-workspace.yaml create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots.toml create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots/task_graph_load_error.snap create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/package.json create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_default_off.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_cli_mode.snap create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_endpoint.snap create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_env_mode.snap create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_missing_cli_endpoint.snap create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_preserves_explicit_off.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_unsupported_endpoint_scheme.snap create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/task_graph.md create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/vite-task.json diff --git a/crates/vt/src/cli/mod.rs b/crates/vt/src/cli/mod.rs index f2724163d..2d07fa1c7 100644 --- a/crates/vt/src/cli/mod.rs +++ b/crates/vt/src/cli/mod.rs @@ -19,6 +19,27 @@ pub enum LogMode { Grouped, } +/// Remote cache access selected on the command line. +#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)] +pub enum RemoteCacheMode { + /// Remote caching is disabled. + Off, + /// Cached results are downloaded. + Read, + /// Cached results are downloaded and new results are uploaded after successful execution. + ReadWrite, +} + +impl From for vt_plan::remote_cache::RemoteCacheMode { + fn from(mode: RemoteCacheMode) -> Self { + match mode { + RemoteCacheMode::Off => Self::Off, + RemoteCacheMode::Read => Self::Read, + RemoteCacheMode::ReadWrite => Self::ReadWrite, + } + } +} + #[derive(Debug, Clone, clap::Subcommand)] pub enum CacheSubcommand { /// Clean up all the cache @@ -48,6 +69,13 @@ pub struct RunFlags { #[clap(long, conflicts_with = "cache")] pub no_cache: bool, + /// How the remote cache is accessed. + /// + /// If you don't pass this flag, `VP_REMOTE_CACHE` selects the mode. If neither + /// is set, the mode is `read` when an endpoint is configured, or `off` otherwise. + #[clap(long)] + pub remote_cache: Option, + /// How task output is displayed. #[clap(long, default_value = "interleaved")] pub log: LogMode, @@ -233,6 +261,7 @@ impl ResolvedRunCommand { plan_options: PlanOptions { extra_args: self.additional_args.into(), cache_override, + remote_cache: self.flags.remote_cache.map(Into::into), concurrency_limit, parallel, fail_if_no_match, diff --git a/crates/vt/src/session/mod.rs b/crates/vt/src/session/mod.rs index edddddb3a..23b63305b 100644 --- a/crates/vt/src/session/mod.rs +++ b/crates/vt/src/session/mod.rs @@ -582,6 +582,7 @@ impl<'a> Session<'a> { plan_options: PlanOptions { extra_args: run_command.additional_args.clone().into(), cache_override: run_command.flags.cache_override(), + remote_cache: run_command.flags.remote_cache.map(Into::into), concurrency_limit: None, parallel: false, // The selector path runs whatever the user picked interactively; diff --git a/crates/vt_bin/src/lib.rs b/crates/vt_bin/src/lib.rs index c18112e0d..ebe44c02a 100644 --- a/crates/vt_bin/src/lib.rs +++ b/crates/vt_bin/src/lib.rs @@ -99,6 +99,7 @@ impl vt::CommandHandler for CommandHandler { untracked_env: None, input: None, output: None, + remote: None, }), envs: Arc::clone(&command.envs), })) diff --git a/crates/vt_graph/run-config.ts b/crates/vt_graph/run-config.ts index b32282aef..d253cd6ac 100644 --- a/crates/vt_graph/run-config.ts +++ b/crates/vt_graph/run-config.ts @@ -26,6 +26,12 @@ base: InputBase, }; export type InputBase = "package" | "workspace"; +export type RemoteCacheConfig = { +/** + * HTTP or HTTPS namespace endpoint. Overridden by `VP_REMOTE_CACHE_URL`. + */ +url: string, }; + export type Task = { /** * Command to run, or an array of commands to run in order. @@ -87,7 +93,11 @@ input?: Array, * - `{auto: true}` enables automatic output tracking * - Negative patterns (e.g. `"!dist/cache/**"`) exclude matched files */ -output?: Array, }; +output?: Array, +/** + * Whether this task can use the remote cache. Defaults to `true`. + */ +remote?: boolean, }; export type TaskDefinition = Task | Command; @@ -131,6 +141,10 @@ export type RunConfig = { * Setting it in a package's config will result in an error. */ cache?: UserGlobalCacheConfig, +/** + * Remote cache endpoint. Only allowed in the workspace root config. + */ +remoteCache?: RemoteCacheConfig, /** * Task definitions: full task objects, command strings, or command string arrays. */ diff --git a/crates/vt_graph/src/config/mod.rs b/crates/vt_graph/src/config/mod.rs index b98a364b7..640d30f9b 100644 --- a/crates/vt_graph/src/config/mod.rs +++ b/crates/vt_graph/src/config/mod.rs @@ -82,7 +82,7 @@ impl ResolvedTaskOptions { )?; Some(CacheConfig { - remote_cache: true, + remote_cache: enabled_cache_config.remote.unwrap_or(true), env_config: EnvConfig { fingerprinted_envs: enabled_cache_config .env diff --git a/crates/vt_graph/src/config/user.rs b/crates/vt_graph/src/config/user.rs index e526d1bed..fb930f48c 100644 --- a/crates/vt_graph/src/config/user.rs +++ b/crates/vt_graph/src/config/user.rs @@ -231,6 +231,9 @@ pub struct EnabledCacheConfig { #[serde(default)] #[cfg_attr(all(test, not(clippy)), ts(inline))] pub output: Option>, + + /// Whether this task can use the remote cache. Defaults to `true`. + pub remote: Option, } /// Options for user-defined tasks in `vite.config.*`, excluding the command. @@ -383,6 +386,15 @@ impl ResolvedGlobalCacheConfig { } } +/// Remote cache endpoint shared by tasks in a workspace. +#[derive(Debug, Clone, Deserialize)] +#[cfg_attr(all(test, not(clippy)), derive(TS), ts(rename = "RemoteCacheConfig"))] +#[serde(deny_unknown_fields, rename_all = "camelCase")] +pub struct UserRemoteCacheConfig { + /// HTTP or HTTPS namespace endpoint. Overridden by `VP_REMOTE_CACHE_URL`. + pub url: Str, +} + /// User configuration structure for `run` field in `vite.config.*` #[derive(Debug, Default, Deserialize)] // TS derive macro generates code using std types that clippy disallows; skip derive during linting @@ -395,6 +407,9 @@ pub struct UserRunConfig { /// Setting it in a package's config will result in an error. pub cache: Option, + /// Remote cache endpoint. Only allowed in the workspace root config. + pub remote_cache: Option, + /// Task definitions: full task objects, command strings, or command string arrays. pub tasks: Option>, @@ -733,6 +748,7 @@ mod tests { "untrackedEnv": ["FOO"], "input": ["src/**"], "output": ["dist/**"], + "remote": false, }, }); let user_config: UserTaskConfig = serde_json::from_value(user_config_json.clone()).unwrap(); @@ -744,6 +760,7 @@ mod tests { untracked_env: Some(std::iter::once("FOO".into()).collect()), input: Some(vec![UserInputEntry::Glob("src/**".into())]), output: Some(vec![UserOutputEntry::Glob("dist/**".into())]), + remote: Some(false), }) ); } @@ -757,6 +774,15 @@ mod tests { assert!(serde_json::from_value::(user_config_json).is_err()); } + #[test] + fn test_top_level_remote_cache_error() { + let user_config_json = json!({ + "command": "echo test", + "remoteCache": false, + }); + assert!(serde_json::from_value::(user_config_json).is_err()); + } + #[test] fn test_input_empty_array() { let user_config_json = json!({ diff --git a/crates/vt_graph/src/lib.rs b/crates/vt_graph/src/lib.rs index 69dd9db36..6057f793e 100644 --- a/crates/vt_graph/src/lib.rs +++ b/crates/vt_graph/src/lib.rs @@ -125,6 +125,11 @@ pub enum TaskGraphLoadError { #[error("`cache` can only be set in the workspace root config, but found in {package_path}")] CacheInNonRootPackage { package_path: Arc }, + #[error( + "`remoteCache` can only be set in the workspace root config, but found in {package_path}" + )] + RemoteCacheInNonRootPackage { package_path: Arc }, + #[error( "`enablePrePostScripts` can only be set in the workspace root config, but found in {package_path}" )] @@ -236,6 +241,9 @@ pub struct IndexedTaskGraph { /// Global cache configuration resolved from the workspace root config. resolved_global_cache: ResolvedGlobalCacheConfig, + /// Remote cache endpoint from the workspace root. + remote_cache: Option, + /// Whether pre/post script hooks are enabled (from `enablePrePostScripts` in workspace root config). pre_post_scripts_enabled: bool, } @@ -275,6 +283,7 @@ impl IndexedTaskGraph { // First pass: load all configs, extract root cache config, validate let mut root_cache = None; + let mut remote_cache = None; let mut root_pre_post_scripts_enabled = None; let mut package_configs: Vec<(PackageNodeIndex, Arc, UserRunConfig)> = Vec::with_capacity(package_graph.node_count()); @@ -303,6 +312,15 @@ impl IndexedTaskGraph { } } + if let Some(config) = &user_config.remote_cache { + if !is_workspace_root { + return Err(TaskGraphLoadError::RemoteCacheInNonRootPackage { + package_path: package_dir.clone(), + }); + } + remote_cache = Some(config.clone()); + } + if let Some(val) = user_config.enable_pre_post_scripts { if is_workspace_root { root_pre_post_scripts_enabled = Some(val); @@ -434,6 +452,7 @@ impl IndexedTaskGraph { node_indices_by_task_id, task_ids_by_node_index, resolved_global_cache, + remote_cache, pre_post_scripts_enabled: root_pre_post_scripts_enabled.unwrap_or(true), }; @@ -600,6 +619,11 @@ impl IndexedTaskGraph { &self.resolved_global_cache } + #[must_use] + pub const fn remote_cache_config(&self) -> Option<&config::user::UserRemoteCacheConfig> { + self.remote_cache.as_ref() + } + /// Whether pre/post script hooks are enabled workspace-wide. #[must_use] pub const fn pre_post_scripts_enabled(&self) -> bool { diff --git a/crates/vt_plan/src/envs.rs b/crates/vt_plan/src/envs.rs index 336540d3a..195f7b7f6 100644 --- a/crates/vt_plan/src/envs.rs +++ b/crates/vt_plan/src/envs.rs @@ -151,7 +151,12 @@ impl EnvFingerprints { fingerprinted_envs, // Save untracked_env names sorted for deterministic cache fingerprinting untracked_env_config: { - let mut sorted: Vec = env_config.untracked_env.iter().cloned().collect(); + let mut sorted: Vec = env_config + .untracked_env + .iter() + .filter(|name| !crate::remote_cache::is_control_env(EnvName::from_ref(*name))) + .cloned() + .collect(); sorted.sort(); sorted.into() }, diff --git a/crates/vt_plan/src/error.rs b/crates/vt_plan/src/error.rs index 8923c1d6b..03d2b367a 100644 --- a/crates/vt_plan/src/error.rs +++ b/crates/vt_plan/src/error.rs @@ -172,6 +172,9 @@ pub enum Error { )] NoPackagesMatched { sources: Vec }, + #[error(transparent)] + RemoteCache(#[from] crate::remote_cache::RemoteCacheConfigError), + #[error("Invalid value for VP_RUN_CONCURRENCY_LIMIT: {0:?}")] InvalidConcurrencyLimitEnv(Arc), diff --git a/crates/vt_plan/src/lib.rs b/crates/vt_plan/src/lib.rs index f74bf0aeb..277896583 100644 --- a/crates/vt_plan/src/lib.rs +++ b/crates/vt_plan/src/lib.rs @@ -209,10 +209,7 @@ pub async fn plan_query( ) -> Result { let indexed_task_graph = task_graph_loader.load_task_graph().await?; - let resolved_global_cache = resolve_cache_with_override( - *indexed_task_graph.global_cache_config(), - query_plan_request.plan_options.cache_override, - ); + let resolved_global_cache = *indexed_task_graph.global_cache_config(); let QueryPlanRequest { query, plan_options } = query_plan_request; let query = Arc::new(query); @@ -267,5 +264,6 @@ pub fn plan_synthetic( cwd, cwd, ParentCacheConfig::None, + None, ) } diff --git a/crates/vt_plan/src/plan.rs b/crates/vt_plan/src/plan.rs index b18f1887c..5f2473bd5 100644 --- a/crates/vt_plan/src/plan.rs +++ b/crates/vt_plan/src/plan.rs @@ -41,6 +41,7 @@ use crate::{ CacheOverride, PlanOptions, PlanRequest, QueryPlanRequest, ScriptCommand, SyntheticPlanRequest, }, + remote_cache::{self, RemoteCacheConfig}, resolve_cache_with_override, }; @@ -88,6 +89,7 @@ fn effective_cache_config( async fn plan_task_as_execution_node( task_node_index: TaskNodeIndex, mut context: PlanContext<'_>, + remote_cache: Option<&RemoteCacheConfig>, with_hooks: bool, ) -> Result { // Check for recursions in the task call stack. @@ -120,7 +122,8 @@ async fn plan_task_as_execution_node( // Extra args (e.g. `vt run test --coverage`) must not be forwarded to hooks. pre_context.set_extra_args(Arc::new([])); let pre_execution = - Box::pin(plan_task_as_execution_node(pre_hook_idx, pre_context, false)).await?; + Box::pin(plan_task_as_execution_node(pre_hook_idx, pre_context, remote_cache, false)) + .await?; items.extend(pre_execution.items); } @@ -305,6 +308,7 @@ async fn plan_task_as_execution_node( &cwd, package_path, parent_cache_config, + remote_cache, )?; ExecutionItemKind::Leaf(LeafExecutionKind::Spawn(spawn_execution)) } @@ -335,6 +339,7 @@ async fn plan_task_as_execution_node( Some(task_execution_cache_key), &and_item.envs, &resolved_options, + remote_cache, &script_command.envs, program_path, spawn_args, @@ -402,6 +407,7 @@ async fn plan_task_as_execution_node( }), &BTreeMap::new(), &resolved_options, + remote_cache, context.envs(), Arc::clone(&*SHELL_PROGRAM_PATH), SHELL_ARGS.iter().map(|s| Str::from(*s)).chain(std::iter::once(script)).collect(), @@ -424,7 +430,8 @@ async fn plan_task_as_execution_node( // Extra args must not be forwarded to hooks. post_context.set_extra_args(Arc::new([])); let post_execution = - Box::pin(plan_task_as_execution_node(post_hook_idx, post_context, false)).await?; + Box::pin(plan_task_as_execution_node(post_hook_idx, post_context, remote_cache, false)) + .await?; items.extend(post_execution.items); } @@ -490,8 +497,9 @@ fn resolve_synthetic_cache_config( Ok(match synthetic_cache_config.into_enabled() { Option::None => Option::None, Some(enabled_cache_config) => { - let EnabledCacheConfig { env, untracked_env, input, output } = + let EnabledCacheConfig { env, untracked_env, input, output, remote } = enabled_cache_config; + parent_config.remote_cache &= remote.unwrap_or(true); parent_config.env_config.fingerprinted_envs.extend(env.unwrap_or_default()); parent_config .env_config @@ -542,6 +550,10 @@ fn resolve_synthetic_cache_config( } } +#[expect( + clippy::too_many_arguments, + reason = "remote policy is separate from local cache configuration" +)] pub fn plan_synthetic_request( workspace_path: &Arc, prefix_envs: &BTreeMap, Str>, @@ -550,6 +562,7 @@ pub fn plan_synthetic_request( cwd: &Arc, package_dir: &AbsolutePath, parent_cache_config: ParentCacheConfig, + remote_cache: Option<&RemoteCacheConfig>, ) -> Result { let SyntheticPlanRequest { program, args, cache_config, envs } = synthetic_plan_request; @@ -570,6 +583,7 @@ pub fn plan_synthetic_request( execution_cache_key, prefix_envs, &resolved_options, + remote_cache, &envs, program_path, args, @@ -597,19 +611,33 @@ fn strip_prefix_for_cache( clippy::needless_pass_by_value, reason = "program_path ownership is needed for Arc construction" )] +#[expect( + clippy::too_many_arguments, + reason = "remote policy is separate from local cache configuration" +)] fn plan_spawn_execution( workspace_path: &Arc, execution_cache_key: Option, prefix_envs: &BTreeMap, Str>, resolved_task_options: &ResolvedTaskOptions, + remote_cache: Option<&RemoteCacheConfig>, envs: &Arc>, Arc>>, program_path: Arc, args: Arc<[Str]>, ) -> Result { - // The child env starts from the full context and is filtered in place by - // `EnvFingerprints::resolve` below — this clone is the one place the map's - // contents are actually copied per spawn. - let mut spawn_envs = (**envs).clone(); + // Controls are for planning only. Remove them before either task env + // filtering or post-run environment tracking can observe them. + let envs = if envs.keys().any(|name| crate::remote_cache::is_control_env(name)) { + Arc::new( + envs.iter() + .filter(|(name, _)| !crate::remote_cache::is_control_env(name)) + .map(|(name, value)| (name.clone(), Arc::clone(value))) + .collect(), + ) + } else { + Arc::clone(envs) + }; + let mut spawn_envs = (*envs).clone(); let cwd = Arc::clone(&resolved_task_options.cwd); let mut resolved_cache_metadata = None; @@ -624,6 +652,9 @@ fn plan_spawn_execution( // differently, like `foo` for `Foo=1` on Windows. let fingerprinted_envs = &mut env_fingerprints.fingerprinted_envs; for (name, value) in prefix_envs { + if crate::remote_cache::is_control_env(name) { + continue; + } fingerprinted_envs.retain(|existing, _| EnvName::from_ref(existing) != name); fingerprinted_envs.insert(name.inner().clone(), EnvValueHash::new(value.as_str())); } @@ -675,8 +706,8 @@ fn plan_spawn_execution( execution_cache_key, input_config: cache_config.input_config.clone(), output_config: cache_config.output_config.clone(), - remote_cache: None, - unfiltered_envs: Arc::clone(envs), + remote_cache: if cache_config.remote_cache { remote_cache.cloned() } else { None }, + unfiltered_envs: Arc::clone(&envs), }); } } @@ -692,6 +723,9 @@ fn plan_spawn_execution( // spelling, so remove the entry first: the task then sees the // assignment's spelling, which is the one fingerprinted above. for (name, value) in prefix_envs { + if crate::remote_cache::is_control_env(name) { + continue; + } let name = EnvName::new(Arc::::from(OsStr::new(name.inner().as_str()))); spawn_envs.remove(&name); spawn_envs.insert(name, OsStr::new(value.as_str()).into()); @@ -744,6 +778,14 @@ pub async fn plan_query_request( ); context.set_resolved_global_cache(final_cache); } + // Inherit explicit choices through the environment. Leave defaults unset so + // each invocation can choose its default using the endpoint available to it. + if let Some(mode) = plan_options.remote_cache { + context.add_envs(std::iter::once((remote_cache::MODE_ENV, mode.as_str()))); + } + let remote_cache = + remote_cache::resolve(context.indexed_task_graph().remote_cache_config(), context.envs())?; + // Resolve effective concurrency for this level. // // Priority (highest to lowest): @@ -831,7 +873,9 @@ pub async fn plan_query_request( task_context.set_extra_args(Arc::clone(&empty_extra_args)); } let task_execution = - plan_task_as_execution_node(task_index, task_context, true).boxed_local().await?; + plan_task_as_execution_node(task_index, task_context, remote_cache.as_ref(), true) + .boxed_local() + .await?; execution_node_indices_by_task_index .insert(task_index, inner_graph.add_node(task_execution)); } @@ -980,6 +1024,7 @@ mod tests { untracked_env: None, input: None, output: None, + remote: None, }), &pkg, &ws, @@ -1002,6 +1047,7 @@ mod tests { untracked_env: None, input: Some(vec![UserInputEntry::Glob("config/**".into())]), output: None, + remote: None, }), &pkg, &ws, @@ -1024,6 +1070,7 @@ mod tests { untracked_env: None, input: Some(vec![UserInputEntry::Glob("config/**".into())]), output: None, + remote: None, }), &pkg, &ws, @@ -1052,6 +1099,7 @@ mod tests { UserInputEntry::Auto(vt_graph::config::user::AutoTracking { auto: true }), ]), output: None, + remote: None, }), &pkg, &ws, @@ -1078,6 +1126,7 @@ mod tests { untracked_env: None, input: Some(vec![UserInputEntry::Glob("config/**".into())]), output: None, + remote: None, }), &pkg, &ws, @@ -1102,6 +1151,7 @@ mod tests { untracked_env: None, input: Some(vec![UserInputEntry::Glob("config/**".into())]), output: None, + remote: None, }), &pkg, &ws, @@ -1124,6 +1174,27 @@ mod tests { assert!(result.is_none()); } + #[test] + fn synthetic_disables_remote_cache_despite_parent() { + let (pkg, ws) = test_paths(); + let parent = parent_config(true, &["src/**"]); + let result = resolve_synthetic_cache_config( + ParentCacheConfig::Inherited(parent), + UserCacheConfig::with_config(EnabledCacheConfig { + env: None, + untracked_env: None, + input: None, + output: None, + remote: Some(false), + }), + &pkg, + &ws, + ) + .unwrap() + .unwrap(); + assert!(!result.remote_cache); + } + #[test] fn synthetic_negative_globs_merged() { let (pkg, ws) = test_paths(); @@ -1135,6 +1206,7 @@ mod tests { untracked_env: None, input: Some(vec![UserInputEntry::Glob("!dist/**".into())]), output: None, + remote: None, }), &pkg, &ws, diff --git a/crates/vt_plan/src/plan_request.rs b/crates/vt_plan/src/plan_request.rs index bc56ab8fb..ed5060c1c 100644 --- a/crates/vt_plan/src/plan_request.rs +++ b/crates/vt_plan/src/plan_request.rs @@ -50,6 +50,8 @@ pub enum CacheOverride { pub struct PlanOptions { pub extra_args: Arc<[Str]>, pub cache_override: CacheOverride, + /// Remote mode for this invocation. None inherits the planning environment. + pub remote_cache: Option, /// Per-level concurrency limit. `None` means inherit from the parent level /// (or default to [`crate::DEFAULT_CONCURRENCY_LIMIT`] at the root). pub concurrency_limit: Option, diff --git a/crates/vt_plan/src/remote_cache.rs b/crates/vt_plan/src/remote_cache.rs index 1c2356251..ceb15cf8b 100644 --- a/crates/vt_plan/src/remote_cache.rs +++ b/crates/vt_plan/src/remote_cache.rs @@ -1,9 +1,16 @@ -//! Remote cache settings carried by planned executions. +//! Remote cache settings resolved for each invocation during planning. -use std::sync::Arc; +use std::{ffi::OsStr, str::FromStr, sync::Arc}; +use rustc_hash::FxHashMap; use serde::Serialize; use url::Url; +use vt_casefold::EnvName; +use vt_graph::config::user::UserRemoteCacheConfig; +use vt_str::Str; + +pub(crate) const MODE_ENV: &str = "VP_REMOTE_CACHE"; +const URL_ENV: &str = "VP_REMOTE_CACHE_URL"; /// Remote access requested by an invocation. Local cache policy is independent. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] @@ -14,6 +21,29 @@ pub enum RemoteCacheMode { ReadWrite, } +impl RemoteCacheMode { + pub(crate) const fn as_str(self) -> &'static str { + match self { + Self::Off => "off", + Self::Read => "read", + Self::ReadWrite => "read-write", + } + } +} + +impl FromStr for RemoteCacheMode { + type Err = RemoteCacheConfigError; + + fn from_str(value: &str) -> Result { + match value { + "off" => Ok(Self::Off), + "read" => Ok(Self::Read), + "read-write" => Ok(Self::ReadWrite), + _ => Err(RemoteCacheConfigError::InvalidMode(value.into())), + } + } +} + /// Remote endpoint and access mode for a cacheable execution. #[derive(Debug, Clone, Serialize)] pub struct RemoteCacheConfig { @@ -28,3 +58,62 @@ pub enum RemoteCacheAccess { Read, ReadWrite, } + +#[derive(Debug, thiserror::Error)] +pub enum RemoteCacheConfigError { + #[error("Invalid remote cache mode {0:?}: expected off, read, or read-write")] + InvalidMode(Str), + #[error("{0} must be valid Unicode")] + InvalidEnv(&'static str), + #[error("Remote caching requires remoteCache.url or VP_REMOTE_CACHE_URL")] + MissingEndpoint, + #[error("Invalid remote cache endpoint: {0}")] + InvalidEndpoint(#[from] url::ParseError), + #[error("Remote cache endpoint must be an HTTP or HTTPS URL with a host")] + InvalidEndpointScheme, +} + +pub(crate) fn is_control_env + ?Sized>(name: &EnvName) -> bool { + [MODE_ENV, URL_ENV].into_iter().any(|control| name == EnvName::from_ref(OsStr::new(control))) +} + +fn env_value<'a>( + envs: &'a FxHashMap>, Arc>, + name: &'static str, +) -> Result, RemoteCacheConfigError> { + envs.get(EnvName::from_ref(OsStr::new(name))) + .map(|value| value.to_str().ok_or(RemoteCacheConfigError::InvalidEnv(name))) + .transpose() +} + +/// Resolve against this invocation's environment, including inherited overrides. +pub(crate) fn resolve( + configured: Option<&UserRemoteCacheConfig>, + envs: &FxHashMap>, Arc>, +) -> Result, RemoteCacheConfigError> { + let mode = env_value(envs, MODE_ENV)?.map(str::parse).transpose()?; + let endpoint = + env_value(envs, URL_ENV)?.or_else(|| configured.map(|config| config.url.as_str())); + let url = endpoint + .map(|endpoint| { + let url = Url::parse(endpoint)?; + if !matches!(url.scheme(), "http" | "https") || !url.has_host() { + return Err(RemoteCacheConfigError::InvalidEndpointScheme); + } + Ok(Arc::new(url)) + }) + .transpose()?; + + match (mode, url) { + (Some(RemoteCacheMode::Off), _) | (None, None) => Ok(None), + (Some(RemoteCacheMode::Read) | None, Some(url)) => { + Ok(Some(RemoteCacheConfig { url, mode: RemoteCacheAccess::Read })) + } + (Some(RemoteCacheMode::ReadWrite), Some(url)) => { + Ok(Some(RemoteCacheConfig { url, mode: RemoteCacheAccess::ReadWrite })) + } + (Some(RemoteCacheMode::Read | RemoteCacheMode::ReadWrite), None) => { + Err(RemoteCacheConfigError::MissingEndpoint) + } + } +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/package.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/package.json new file mode 100644 index 000000000..be7fbe32c --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/package.json @@ -0,0 +1,11 @@ +{ + "name": "@test/remote-cache-config", + "scripts": { + "inherit": "vt run build", + "env-off": "VP_REMOTE_CACHE=off vt run build", + "cli-read": "VP_REMOTE_CACHE=off vt run --remote-cache=read build", + "siblings": "VP_REMOTE_CACHE=off vt run build && vt run build", + "endpoints": "VP_REMOTE_CACHE_URL=https://other.example/projects/nested vt run build && vt run build", + "prefix": "VP_REMOTE_CACHE=off VP_REMOTE_CACHE_URL=https://other.example vtt print-file package.json" + } +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml new file mode 100644 index 000000000..bcc511ed2 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml @@ -0,0 +1,51 @@ +[[plan]] +name = "default_read" +args = ["run", "build"] + +[[plan]] +name = "cli_overrides_invalid_env" +args = ["run", "--remote-cache=read-write", "build"] +env = { "VP_REMOTE_CACHE" = "invalid" } + +[[plan]] +name = "task_local_only" +args = ["run", "--remote-cache=read-write", "local-only"] + +[[plan]] +name = "no_cache" +args = ["run", "--no-cache", "build"] + +[[plan]] +name = "synthetic_local_only" +args = ["run", "synthetic"] + +[[plan]] +name = "controls_excluded" +args = ["run", "tracked-controls"] +env = { "VP_REMOTE_CACHE" = "read-write", "VP_REMOTE_CACHE_URL" = "https://other.example/projects/test" } + +[[plan]] +name = "prefix_controls_excluded" +args = ["run", "prefix"] + +[[plan]] +name = "nested_inherits_cli" +args = ["run", "--remote-cache=off", "inherit"] +env = { "VP_REMOTE_CACHE" = "read-write" } + +[[plan]] +name = "nested_env_override" +args = ["run", "--remote-cache=read", "env-off"] +env = { "VP_REMOTE_CACHE" = "off" } + +[[plan]] +name = "nested_cli_overrides_env" +args = ["run", "--remote-cache=off", "cli-read"] + +[[plan]] +name = "sibling_mode_isolation" +args = ["run", "siblings"] + +[[plan]] +name = "sibling_endpoint_isolation" +args = ["run", "endpoints"] diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc new file mode 100644 index 000000000..0ed5a626a --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc @@ -0,0 +1,98 @@ +// run --remote-cache=read-write build +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": { + "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", + "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" + }, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": { + "mode": "read-write", + "url": "https://cache.example/projects/test" + } + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "NO_COLOR": "1", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_excluded.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_excluded.jsonc new file mode 100644 index 000000000..36a82f24f --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_excluded.jsonc @@ -0,0 +1,95 @@ +// run tracked-controls +{ + "graph": [ + { + "key": [ + "/", + "tracked-controls" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "tracked-controls", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "tracked-controls", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "tracked-controls", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": { + "mode": "read-write", + "url": "https://other.example/projects/test" + } + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "PATH": "/node_modules/.bin:", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc new file mode 100644 index 000000000..f86662cef --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc @@ -0,0 +1,98 @@ +// run build +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": { + "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", + "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" + }, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": { + "mode": "read", + "url": "https://cache.example/projects/test" + } + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "NO_COLOR": "1", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc new file mode 100644 index 000000000..e48b73fba --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc @@ -0,0 +1,132 @@ +// run --remote-cache=off cli-read +{ + "graph": [ + { + "key": [ + "/", + "cli-read" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "cli-read", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "cli-read", + "package_path": "/" + }, + "command": "VP_REMOTE_CACHE=off vt run --remote-cache=read build", + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": { + "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", + "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" + }, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": { + "mode": "read", + "url": "https://cache.example/projects/test" + } + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "NO_COLOR": "1", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc new file mode 100644 index 000000000..c64799ab1 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc @@ -0,0 +1,129 @@ +// run --remote-cache=read env-off +{ + "graph": [ + { + "key": [ + "/", + "env-off" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "env-off", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "env-off", + "package_path": "/" + }, + "command": "VP_REMOTE_CACHE=off vt run build", + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": { + "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", + "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" + }, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": null + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "NO_COLOR": "1", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc new file mode 100644 index 000000000..2a285fbda --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc @@ -0,0 +1,129 @@ +// run --remote-cache=off inherit +{ + "graph": [ + { + "key": [ + "/", + "inherit" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "inherit", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "inherit", + "package_path": "/" + }, + "command": "vt run build", + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": { + "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", + "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" + }, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": null + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "NO_COLOR": "1", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc new file mode 100644 index 000000000..bbc262c46 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc @@ -0,0 +1,53 @@ +// run --no-cache build +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_excluded.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_excluded.jsonc new file mode 100644 index 000000000..655ae0bae --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_excluded.jsonc @@ -0,0 +1,95 @@ +// run prefix +{ + "graph": [ + { + "key": [ + "/", + "prefix" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "prefix", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "prefix", + "package_path": "/" + }, + "command": "VP_REMOTE_CACHE=off VP_REMOTE_CACHE_URL=https://other.example vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "prefix", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": { + "mode": "read", + "url": "https://cache.example/projects/test" + } + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "PATH": "/node_modules/.bin:", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc new file mode 100644 index 000000000..cf6e35be6 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc @@ -0,0 +1,242 @@ +// run endpoints +{ + "graph": [ + { + "key": [ + "/", + "endpoints" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "endpoints", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "endpoints", + "package_path": "/" + }, + "command": "VP_REMOTE_CACHE_URL=https://other.example/projects/nested vt run build", + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": { + "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", + "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" + }, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": { + "mode": "read", + "url": "https://other.example/projects/nested" + } + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "NO_COLOR": "1", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 + } + } + }, + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "endpoints", + "package_path": "/" + }, + "command": "vt run build", + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": { + "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", + "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" + }, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": { + "mode": "read", + "url": "https://cache.example/projects/test" + } + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "NO_COLOR": "1", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc new file mode 100644 index 000000000..42e68a650 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc @@ -0,0 +1,239 @@ +// run siblings +{ + "graph": [ + { + "key": [ + "/", + "siblings" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "siblings", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "siblings", + "package_path": "/" + }, + "command": "VP_REMOTE_CACHE=off vt run build", + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": { + "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", + "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" + }, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": null + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "NO_COLOR": "1", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 + } + } + }, + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "siblings", + "package_path": "/" + }, + "command": "vt run build", + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": { + "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", + "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" + }, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": { + "mode": "read", + "url": "https://cache.example/projects/test" + } + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "NO_COLOR": "1", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_synthetic_local_only.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_synthetic_local_only.jsonc new file mode 100644 index 000000000..3f7bea76f --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_synthetic_local_only.jsonc @@ -0,0 +1,92 @@ +// run synthetic +{ + "graph": [ + { + "key": [ + "/", + "synthetic" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "synthetic", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "synthetic", + "package_path": "/" + }, + "command": "vt tool print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "synthetic", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": null + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "PATH": "/node_modules/.bin:", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc new file mode 100644 index 000000000..6b10fa1d7 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc @@ -0,0 +1,92 @@ +// run --remote-cache=read-write local-only +{ + "graph": [ + { + "key": [ + "/", + "local-only" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "local-only", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "local-only", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "local-only", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": null + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "PATH": "/node_modules/.bin:", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md new file mode 100644 index 000000000..208ad0750 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md @@ -0,0 +1,424 @@ +# task graph + +```mermaid +flowchart TD + task_0["/#build"] + task_1["/#cli-read"] + task_2["/#endpoints"] + task_3["/#env-off"] + task_4["/#inherit"] + task_5["/#local-only"] + task_6["/#prefix"] + task_7["/#siblings"] + task_8["/#synthetic"] + task_9["/#tracked-controls"] +``` + +## `/#build` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "build", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vtt print-file package.json" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": true, + "env_config": { + "fingerprinted_envs": [ + "!PATH", + "*" + ], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "TaskConfig" +} +``` + +## `/#cli-read` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "cli-read", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "VP_REMOTE_CACHE=off vt run --remote-cache=read build" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": true, + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" +} +``` + +## `/#endpoints` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "endpoints", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "VP_REMOTE_CACHE_URL=https://other.example/projects/nested vt run build && vt run build" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": true, + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" +} +``` + +## `/#env-off` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "env-off", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "VP_REMOTE_CACHE=off vt run build" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": true, + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" +} +``` + +## `/#inherit` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "inherit", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vt run build" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": true, + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" +} +``` + +## `/#local-only` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "local-only", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vtt print-file package.json" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": false, + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "TaskConfig" +} +``` + +## `/#prefix` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "prefix", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "VP_REMOTE_CACHE=off VP_REMOTE_CACHE_URL=https://other.example vtt print-file package.json" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": true, + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" +} +``` + +## `/#siblings` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "siblings", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "VP_REMOTE_CACHE=off vt run build && vt run build" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": true, + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" +} +``` + +## `/#synthetic` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "synthetic", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vt tool print-file package.json" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": false, + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "TaskConfig" +} +``` + +## `/#tracked-controls` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "tracked-controls", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vtt print-file package.json" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": true, + "env_config": { + "fingerprinted_envs": [ + "VP_REMOTE_CACHE", + "VP_REMOTE_CACHE_URL" + ], + "untracked_env": [ + "VP_REMOTE_CACHE", + "VP_REMOTE_CACHE_URL", + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "TaskConfig" +} +``` + diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json new file mode 100644 index 000000000..ec180e0f8 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json @@ -0,0 +1,30 @@ +{ + "cache": true, + "remoteCache": { + "url": "https://cache.example/projects/test" + }, + "tasks": { + "build": { + "command": "vtt print-file package.json", + "cache": { + "env": ["*", "!PATH"], + "remote": true + } + }, + "local-only": { + "command": "vtt print-file package.json", + "cache": { "remote": false } + }, + "synthetic": { + "command": "vt tool print-file package.json", + "cache": { "remote": false } + }, + "tracked-controls": { + "command": "vtt print-file package.json", + "cache": { + "env": ["VP_REMOTE_CACHE", "VP_REMOTE_CACHE_URL"], + "untrackedEnv": ["VP_REMOTE_CACHE", "VP_REMOTE_CACHE_URL"] + } + } + } +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/package.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/package.json new file mode 100644 index 000000000..fef916cc3 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/package.json @@ -0,0 +1,6 @@ +{ + "name": "@test/remote-cache-non-root-config", + "workspaces": [ + "packages/*" + ] +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/package.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/package.json new file mode 100644 index 000000000..c3db9bba0 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/package.json @@ -0,0 +1,3 @@ +{ + "name": "@test/app" +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/vite-task.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/vite-task.json new file mode 100644 index 000000000..1f99e9492 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/vite-task.json @@ -0,0 +1 @@ +{ "remoteCache": { "url": "https://cache.example/projects/test" } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/pnpm-workspace.yaml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/pnpm-workspace.yaml new file mode 100644 index 000000000..924b55f42 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots.toml new file mode 100644 index 000000000..e69de29bb diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots/task_graph_load_error.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots/task_graph_load_error.snap new file mode 100644 index 000000000..b9a6094f5 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots/task_graph_load_error.snap @@ -0,0 +1 @@ +`remoteCache` can only be set in the workspace root config, but found in /packages/app \ No newline at end of file diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/package.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/package.json new file mode 100644 index 000000000..164135393 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/package.json @@ -0,0 +1,7 @@ +{ + "name": "@test/remote-cache-without-endpoint", + "scripts": { + "build": "vtt print-file package.json", + "with-url": "VP_REMOTE_CACHE_URL=https://cache.example/projects/inner vt run build" + } +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml new file mode 100644 index 000000000..f640ae8a2 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml @@ -0,0 +1,34 @@ +[[plan]] +name = "default_off" +args = ["run", "build"] + +[[plan]] +name = "nested_endpoint_enables_read" +args = ["run", "with-url"] + +[[plan]] +name = "nested_endpoint_preserves_explicit_off" +args = ["run", "--remote-cache=off", "with-url"] + +[[plan]] +name = "missing_cli_endpoint" +args = ["run", "--remote-cache=read", "build"] + +[[plan]] +name = "invalid_env_mode" +args = ["run", "build"] +env = { "VP_REMOTE_CACHE" = "invalid" } + +[[plan]] +name = "invalid_cli_mode" +args = ["run", "--remote-cache=invalid", "build"] + +[[plan]] +name = "invalid_endpoint" +args = ["run", "build"] +env = { "VP_REMOTE_CACHE_URL" = "cache.example/projects/test" } + +[[plan]] +name = "unsupported_endpoint_scheme" +args = ["run", "build"] +env = { "VP_REMOTE_CACHE_URL" = "file:///cache" } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_default_off.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_default_off.jsonc new file mode 100644 index 000000000..5950a2b5b --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_default_off.jsonc @@ -0,0 +1,92 @@ +// run build +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": null + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "PATH": "/node_modules/.bin:", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_cli_mode.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_cli_mode.snap new file mode 100644 index 000000000..7c78ef10d --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_cli_mode.snap @@ -0,0 +1,4 @@ +error: invalid value 'invalid' for '--remote-cache ' + [possible values: off, read, read-write] + +For more information, try '--help'. diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_endpoint.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_endpoint.snap new file mode 100644 index 000000000..0bd4b52cb --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_endpoint.snap @@ -0,0 +1 @@ +Invalid remote cache endpoint: relative URL without a base: relative URL without a base \ No newline at end of file diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_env_mode.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_env_mode.snap new file mode 100644 index 000000000..0a397532c --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_env_mode.snap @@ -0,0 +1 @@ +Invalid remote cache mode "invalid": expected off, read, or read-write \ No newline at end of file diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_missing_cli_endpoint.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_missing_cli_endpoint.snap new file mode 100644 index 000000000..91decb8fb --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_missing_cli_endpoint.snap @@ -0,0 +1 @@ +Remote caching requires remoteCache.url or VP_REMOTE_CACHE_URL \ No newline at end of file diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc new file mode 100644 index 000000000..e110091bd --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc @@ -0,0 +1,129 @@ +// run with-url +{ + "graph": [ + { + "key": [ + "/", + "with-url" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "with-url", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "with-url", + "package_path": "/" + }, + "command": "VP_REMOTE_CACHE_URL=https://cache.example/projects/inner vt run build", + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": { + "mode": "read", + "url": "https://cache.example/projects/inner" + } + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "PATH": "/node_modules/.bin:", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_preserves_explicit_off.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_preserves_explicit_off.jsonc new file mode 100644 index 000000000..311ec8814 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_preserves_explicit_off.jsonc @@ -0,0 +1,126 @@ +// run --remote-cache=off with-url +{ + "graph": [ + { + "key": [ + "/", + "with-url" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "with-url", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "with-url", + "package_path": "/" + }, + "command": "VP_REMOTE_CACHE_URL=https://cache.example/projects/inner vt run build", + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "package.json" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "command_item_index": 0, + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "remote_cache": null + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "FORCE_COLOR": "1", + "PATH": "/node_modules/.bin:", + "VP_RUN": "1" + }, + "cwd": "/" + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_unsupported_endpoint_scheme.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_unsupported_endpoint_scheme.snap new file mode 100644 index 000000000..0f3f9dea8 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_unsupported_endpoint_scheme.snap @@ -0,0 +1 @@ +Remote cache endpoint must be an HTTP or HTTPS URL with a host \ No newline at end of file diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/task_graph.md new file mode 100644 index 000000000..37a53dc21 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/task_graph.md @@ -0,0 +1,88 @@ +# task graph + +```mermaid +flowchart TD + task_0["/#build"] + task_1["/#with-url"] +``` + +## `/#build` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "build", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vtt print-file package.json" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": true, + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" +} +``` + +## `/#with-url` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-without-endpoint", + "task_name": "with-url", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "VP_REMOTE_CACHE_URL=https://cache.example/projects/inner vt run build" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "remote_cache": true, + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + }, + "output_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" +} +``` + diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/vite-task.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/vite-task.json new file mode 100644 index 000000000..d548edfac --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/vite-task.json @@ -0,0 +1,3 @@ +{ + "cache": true +} From e95a0b552c1bddad00d05c32f264a55c7a6389a5 Mon Sep 17 00:00:00 2001 From: wan9chi Date: Tue, 22 Sep 2026 22:23:43 +0800 Subject: [PATCH 02/14] test(plan): focus remote cache snapshots Co-authored-by: GPT-6 Co-authored-by: Claude Opus 5.5 --- .../remote_cache_config/snapshots.toml | 15 ++ .../query_cli_overrides_invalid_env.jsonc | 66 +------ .../snapshots/query_controls_excluded.jsonc | 61 +------ .../snapshots/query_default_read.jsonc | 66 +------ .../query_nested_cli_overrides_env.jsonc | 86 +--------- .../snapshots/query_nested_env_override.jsonc | 86 +--------- .../snapshots/query_nested_inherits_cli.jsonc | 86 +--------- .../snapshots/query_no_cache.jsonc | 32 +--- .../query_prefix_controls_excluded.jsonc | 61 +------ .../query_sibling_endpoint_isolation.jsonc | 161 ++---------------- .../query_sibling_mode_isolation.jsonc | 161 ++---------------- .../query_synthetic_local_only.jsonc | 61 +------ .../snapshots/query_task_local_only.jsonc | 61 +------ .../snapshots.toml | 4 + .../snapshots/query_default_off.jsonc | 70 +------- .../query_nested_endpoint_enables_read.jsonc | 90 +--------- ...sted_endpoint_preserves_explicit_off.jsonc | 90 +--------- 17 files changed, 90 insertions(+), 1167 deletions(-) diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml index bcc511ed2..bd3fdbeef 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml @@ -1,3 +1,18 @@ +[fields] +key = true + +[fields.cache_metadata] +remote_cache = true +spawn_fingerprint.env_fingerprints.untracked_env_config = true + +[fields.cache_metadata.spawn_fingerprint.env_fingerprints.fingerprinted_envs] +VP_REMOTE_CACHE = true +VP_REMOTE_CACHE_URL = true + +[fields.spawn_command.spawn_envs] +VP_REMOTE_CACHE = true +VP_REMOTE_CACHE_URL = true + [[plan]] name = "default_read" args = ["run", "build"] diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc index 0ed5a626a..5ffb03189 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc @@ -7,92 +7,34 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { - "fingerprinted_envs": { - "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", - "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" - }, + "fingerprinted_envs": {}, "untracked_env_config": [ "" ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": { "mode": "read-write", "url": "https://cache.example/projects/test" } }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "NO_COLOR": "1", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_excluded.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_excluded.jsonc index 36a82f24f..63f09c576 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_excluded.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_excluded.jsonc @@ -7,37 +7,13 @@ "tracked-controls" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "tracked-controls", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "tracked-controls", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { "fingerprinted_envs": {}, "untracked_env_config": [ @@ -45,51 +21,20 @@ ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "tracked-controls", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": { "mode": "read-write", "url": "https://other.example/projects/test" } }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "PATH": "/node_modules/.bin:", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc index f86662cef..dbdf0c433 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc @@ -7,92 +7,34 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { - "fingerprinted_envs": { - "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", - "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" - }, + "fingerprinted_envs": {}, "untracked_env_config": [ "" ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": { "mode": "read", "url": "https://cache.example/projects/test" } }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "NO_COLOR": "1", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc index e48b73fba..f332b617d 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc @@ -7,22 +7,8 @@ "cli-read" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "cli-read", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "cli-read", - "package_path": "/" - }, - "command": "VP_REMOTE_CACHE=off vt run --remote-cache=read build", - "cwd": "/" - }, "kind": { "Expanded": { "graph": [ @@ -32,101 +18,41 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { - "fingerprinted_envs": { - "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", - "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" - }, + "fingerprinted_envs": {}, "untracked_env_config": [ "" ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": { "mode": "read", "url": "https://cache.example/projects/test" } }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "NO_COLOR": "1", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc index c64799ab1..f218da734 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc @@ -7,22 +7,8 @@ "env-off" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "env-off", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "env-off", - "package_path": "/" - }, - "command": "VP_REMOTE_CACHE=off vt run build", - "cwd": "/" - }, "kind": { "Expanded": { "graph": [ @@ -32,98 +18,38 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { - "fingerprinted_envs": { - "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", - "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" - }, + "fingerprinted_envs": {}, "untracked_env_config": [ "" ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": null }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "NO_COLOR": "1", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc index 2a285fbda..d68e783bf 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc @@ -7,22 +7,8 @@ "inherit" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "inherit", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "inherit", - "package_path": "/" - }, - "command": "vt run build", - "cwd": "/" - }, "kind": { "Expanded": { "graph": [ @@ -32,98 +18,38 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { - "fingerprinted_envs": { - "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", - "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" - }, + "fingerprinted_envs": {}, "untracked_env_config": [ "" ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": null }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "NO_COLOR": "1", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc index bbc262c46..bbe71fdf7 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc @@ -7,47 +7,21 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": null, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_excluded.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_excluded.jsonc index 655ae0bae..03dc881e2 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_excluded.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_excluded.jsonc @@ -7,37 +7,13 @@ "prefix" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "prefix", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "prefix", - "package_path": "/" - }, - "command": "VP_REMOTE_CACHE=off VP_REMOTE_CACHE_URL=https://other.example vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { "fingerprinted_envs": {}, "untracked_env_config": [ @@ -45,51 +21,20 @@ ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "prefix", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": { "mode": "read", "url": "https://cache.example/projects/test" } }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "PATH": "/node_modules/.bin:", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc index cf6e35be6..de64903ac 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc @@ -7,22 +7,8 @@ "endpoints" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "endpoints", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "endpoints", - "package_path": "/" - }, - "command": "VP_REMOTE_CACHE_URL=https://other.example/projects/nested vt run build", - "cwd": "/" - }, "kind": { "Expanded": { "graph": [ @@ -32,107 +18,40 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { - "fingerprinted_envs": { - "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", - "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" - }, + "fingerprinted_envs": {}, "untracked_env_config": [ "" ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": { "mode": "read", "url": "https://other.example/projects/nested" } }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "NO_COLOR": "1", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } } }, { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "endpoints", - "package_path": "/" - }, - "command": "vt run build", - "cwd": "/" - }, "kind": { "Expanded": { "graph": [ @@ -142,101 +61,41 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { - "fingerprinted_envs": { - "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", - "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" - }, + "fingerprinted_envs": {}, "untracked_env_config": [ "" ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": { "mode": "read", "url": "https://cache.example/projects/test" } }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "NO_COLOR": "1", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc index 42e68a650..dedc543c6 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc @@ -7,22 +7,8 @@ "siblings" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "siblings", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "siblings", - "package_path": "/" - }, - "command": "VP_REMOTE_CACHE=off vt run build", - "cwd": "/" - }, "kind": { "Expanded": { "graph": [ @@ -32,104 +18,37 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { - "fingerprinted_envs": { - "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", - "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" - }, + "fingerprinted_envs": {}, "untracked_env_config": [ "" ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": null }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "NO_COLOR": "1", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } } }, { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "siblings", - "package_path": "/" - }, - "command": "vt run build", - "cwd": "/" - }, "kind": { "Expanded": { "graph": [ @@ -139,101 +58,41 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { - "fingerprinted_envs": { - "FORCE_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", - "NO_COLOR": "sha256:6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" - }, + "fingerprinted_envs": {}, "untracked_env_config": [ "" ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": { "mode": "read", "url": "https://cache.example/projects/test" } }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "NO_COLOR": "1", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_synthetic_local_only.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_synthetic_local_only.jsonc index 3f7bea76f..11d460a1b 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_synthetic_local_only.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_synthetic_local_only.jsonc @@ -7,37 +7,13 @@ "synthetic" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "synthetic", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "synthetic", - "package_path": "/" - }, - "command": "vt tool print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { "fingerprinted_envs": {}, "untracked_env_config": [ @@ -45,48 +21,17 @@ ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "synthetic", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": null }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "PATH": "/node_modules/.bin:", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc index 6b10fa1d7..d856fe09a 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc @@ -7,37 +7,13 @@ "local-only" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "local-only", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-config", - "task_name": "local-only", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], "env_fingerprints": { "fingerprinted_envs": {}, "untracked_env_config": [ @@ -45,48 +21,17 @@ ] } }, - "execution_cache_key": { - "UserTask": { - "task_name": "local-only", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": null }, "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "PATH": "/node_modules/.bin:", - "VP_RUN": "1" - }, - "cwd": "/" + "spawn_envs": {} } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml index f640ae8a2..0c2bd3096 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml @@ -1,3 +1,7 @@ +[fields] +key = true +cache_metadata = { remote_cache = true } + [[plan]] name = "default_off" args = ["run", "build"] diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_default_off.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_default_off.jsonc index 5950a2b5b..8708ec15b 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_default_off.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_default_off.jsonc @@ -7,86 +7,20 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-without-endpoint", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-without-endpoint", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": null - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "PATH": "/node_modules/.bin:", - "VP_RUN": "1" - }, - "cwd": "/" } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc index e110091bd..6f0c21fd1 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc @@ -7,22 +7,8 @@ "with-url" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-without-endpoint", - "task_name": "with-url", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-without-endpoint", - "task_name": "with-url", - "package_path": "/" - }, - "command": "VP_REMOTE_CACHE_URL=https://cache.example/projects/inner vt run build", - "cwd": "/" - }, "kind": { "Expanded": { "graph": [ @@ -32,98 +18,30 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-without-endpoint", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-without-endpoint", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": { "mode": "read", "url": "https://cache.example/projects/inner" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "PATH": "/node_modules/.bin:", - "VP_RUN": "1" - }, - "cwd": "/" } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_preserves_explicit_off.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_preserves_explicit_off.jsonc index 311ec8814..282423f1b 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_preserves_explicit_off.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_preserves_explicit_off.jsonc @@ -7,22 +7,8 @@ "with-url" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-without-endpoint", - "task_name": "with-url", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-without-endpoint", - "task_name": "with-url", - "package_path": "/" - }, - "command": "VP_REMOTE_CACHE_URL=https://cache.example/projects/inner vt run build", - "cwd": "/" - }, "kind": { "Expanded": { "graph": [ @@ -32,95 +18,27 @@ "build" ], "node": { - "task_display": { - "package_name": "@test/remote-cache-without-endpoint", - "task_name": "build", - "package_path": "/" - }, "items": [ { - "execution_item_display": { - "task_display": { - "package_name": "@test/remote-cache-without-endpoint", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "cwd": "/" - }, "kind": { "Leaf": { "Spawn": { "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" - } - }, - "args": [ - "print-file", - "package.json" - ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "command_item_index": 0, - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, - "output_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] - }, "remote_cache": null - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "spawn_envs": { - "FORCE_COLOR": "1", - "PATH": "/node_modules/.bin:", - "VP_RUN": "1" - }, - "cwd": "/" } } } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } } } ] - }, - "neighbors": [] + } } - ], - "concurrency_limit": 4 + ] } From f2fa2ab7ad79729c4039ea809de142e2fe76859a Mon Sep 17 00:00:00 2001 From: wan9chi Date: Wed, 23 Sep 2026 19:51:29 +0800 Subject: [PATCH 03/14] refactor(cache): defer remote cache endpoint validation Carry the endpoint from `remoteCache.url` or `VP_REMOTE_CACHE_URL` as a string, so an endpoint can't fail planning before remote caching uses it. Treat empty control values as unset, as a CI secret unavailable to the job expands to an empty string. Co-authored-by: Claude Opus 5.5 --- Cargo.lock | 286 ------------------ Cargo.toml | 1 - crates/vt_plan/Cargo.toml | 1 - crates/vt_plan/src/remote_cache.rs | 26 +- .../remote_cache_config/snapshots.toml | 5 + ...query_empty_env_endpoint_uses_config.jsonc | 40 +++ .../snapshots.toml | 6 +- .../query_empty_controls_unset.jsonc | 26 ++ .../query_endpoint_not_validated.jsonc | 29 ++ .../snapshots/query_invalid_endpoint.snap | 1 - .../query_unsupported_endpoint_scheme.snap | 1 - 11 files changed, 112 insertions(+), 310 deletions(-) create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_empty_controls_unset.jsonc create mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_endpoint_not_validated.jsonc delete mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_endpoint.snap delete mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_unsupported_endpoint_scheme.snap diff --git a/Cargo.lock b/Cargo.lock index 8d914ad24..d9496e796 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1018,17 +1018,6 @@ dependencies = [ "objc2", ] -[[package]] -name = "displaydoc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - [[package]] name = "document-features" version = "0.2.12" @@ -1232,15 +1221,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - [[package]] name = "fsevent-sys" version = "4.1.0" @@ -1731,89 +1711,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "icu_collections" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" -dependencies = [ - "displaydoc", - "potential_utf", - "utf8_iter", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec 1.15.1", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" - -[[package]] -name = "icu_properties" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" - -[[package]] -name = "icu_provider" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - [[package]] name = "id-arena" version = "2.3.0" @@ -1826,27 +1723,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec 1.15.1", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - [[package]] name = "indenter" version = "0.3.4" @@ -2140,12 +2016,6 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" -[[package]] -name = "litemap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" - [[package]] name = "litrs" version = "1.0.0" @@ -2770,12 +2640,6 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "132dca9b868d927b35b5dd728167b2dee150eb1ad686008fc71ccb298b776fca" -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - [[package]] name = "pest" version = "2.8.6" @@ -2981,15 +2845,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "potential_utf" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" -dependencies = [ - "zerovec", -] - [[package]] name = "powerfmt" version = "0.2.0" @@ -3739,12 +3594,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - [[package]] name = "stackalloc" version = "1.2.1" @@ -3850,28 +3699,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "syn" -version = "3.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - [[package]] name = "syscalls" version = "0.8.1" @@ -4076,16 +3903,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" -[[package]] -name = "tinystr" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" -dependencies = [ - "displaydoc", - "zerovec", -] - [[package]] name = "tokio" version = "1.49.0" @@ -4365,19 +4182,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39abd59bf32521c7f2301b52d05a6a2c975b6003521cbd0c6dc1582f0a22104" -[[package]] -name = "url" -version = "2.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", - "serde_derive", -] - [[package]] name = "utf8-chars" version = "3.0.6" @@ -4387,12 +4191,6 @@ dependencies = [ "arrayvec", ] -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "utf8parse" version = "0.2.2" @@ -4660,7 +4458,6 @@ dependencies = [ "tokio", "toml", "tracing", - "url", "vt", "vt_bin", "vt_casefold", @@ -5293,12 +5090,6 @@ dependencies = [ "wasmparser", ] -[[package]] -name = "writeable" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" - [[package]] name = "xattr" version = "1.6.1" @@ -5321,29 +5112,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" -[[package]] -name = "yoke" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33811428bee40dbceb6d545e95754741d17a6aef9a4849f0fd62e2ba4f412a78" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", - "synstructure", -] - [[package]] name = "zerocopy" version = "0.8.39" @@ -5364,60 +5132,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "zerofrom" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", - "synstructure", -] - -[[package]] -name = "zerotrie" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - [[package]] name = "zmij" version = "1.0.20" diff --git a/Cargo.toml b/Cargo.toml index c3e02155a..9a5647905 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,6 @@ bytemuck = "1.23.0" cargo-platform = "=0.3.2" cc = "1.2.39" clap = "4.5.53" -url = "2.5.8" color-eyre = "0.6.5" compact_str = "0.9.0" constcat = "0.6.1" diff --git a/crates/vt_plan/Cargo.toml b/crates/vt_plan/Cargo.toml index 86efc13f9..b19c276de 100644 --- a/crates/vt_plan/Cargo.toml +++ b/crates/vt_plan/Cargo.toml @@ -24,7 +24,6 @@ sha2 = { workspace = true } shell-escape = { workspace = true } thiserror = { workspace = true } tracing = { workspace = true } -url = { workspace = true, features = ["serde"] } vt_casefold = { workspace = true } vt_glob = { workspace = true } vt_graph_ser = { workspace = true } diff --git a/crates/vt_plan/src/remote_cache.rs b/crates/vt_plan/src/remote_cache.rs index ceb15cf8b..aad6f4956 100644 --- a/crates/vt_plan/src/remote_cache.rs +++ b/crates/vt_plan/src/remote_cache.rs @@ -4,7 +4,6 @@ use std::{ffi::OsStr, str::FromStr, sync::Arc}; use rustc_hash::FxHashMap; use serde::Serialize; -use url::Url; use vt_casefold::EnvName; use vt_graph::config::user::UserRemoteCacheConfig; use vt_str::Str; @@ -48,7 +47,8 @@ impl FromStr for RemoteCacheMode { #[derive(Debug, Clone, Serialize)] pub struct RemoteCacheConfig { pub mode: RemoteCacheAccess, - pub url: Arc, + /// Endpoint as configured. It is validated when the remote cache is used. + pub url: Str, } /// Access permitted when remote caching is enabled. @@ -67,21 +67,20 @@ pub enum RemoteCacheConfigError { InvalidEnv(&'static str), #[error("Remote caching requires remoteCache.url or VP_REMOTE_CACHE_URL")] MissingEndpoint, - #[error("Invalid remote cache endpoint: {0}")] - InvalidEndpoint(#[from] url::ParseError), - #[error("Remote cache endpoint must be an HTTP or HTTPS URL with a host")] - InvalidEndpointScheme, } pub(crate) fn is_control_env + ?Sized>(name: &EnvName) -> bool { [MODE_ENV, URL_ENV].into_iter().any(|control| name == EnvName::from_ref(OsStr::new(control))) } +/// Reads a control env. An empty value counts as unset, like a CI secret that +/// isn't available to the job. fn env_value<'a>( envs: &'a FxHashMap>, Arc>, name: &'static str, ) -> Result, RemoteCacheConfigError> { envs.get(EnvName::from_ref(OsStr::new(name))) + .filter(|value| !value.is_empty()) .map(|value| value.to_str().ok_or(RemoteCacheConfigError::InvalidEnv(name))) .transpose() } @@ -92,17 +91,10 @@ pub(crate) fn resolve( envs: &FxHashMap>, Arc>, ) -> Result, RemoteCacheConfigError> { let mode = env_value(envs, MODE_ENV)?.map(str::parse).transpose()?; - let endpoint = - env_value(envs, URL_ENV)?.or_else(|| configured.map(|config| config.url.as_str())); - let url = endpoint - .map(|endpoint| { - let url = Url::parse(endpoint)?; - if !matches!(url.scheme(), "http" | "https") || !url.has_host() { - return Err(RemoteCacheConfigError::InvalidEndpointScheme); - } - Ok(Arc::new(url)) - }) - .transpose()?; + let url = env_value(envs, URL_ENV)? + .or_else(|| configured.map(|config| config.url.as_str())) + .filter(|url| !url.is_empty()) + .map(Str::from); match (mode, url) { (Some(RemoteCacheMode::Off), _) | (None, None) => Ok(None), diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml index bd3fdbeef..e0949c120 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml @@ -34,6 +34,11 @@ args = ["run", "--no-cache", "build"] name = "synthetic_local_only" args = ["run", "synthetic"] +[[plan]] +name = "empty_env_endpoint_uses_config" +args = ["run", "build"] +env = { "VP_REMOTE_CACHE_URL" = "" } + [[plan]] name = "controls_excluded" args = ["run", "tracked-controls"] diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc new file mode 100644 index 000000000..dbdf0c433 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc @@ -0,0 +1,40 @@ +// run build +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "items": [ + { + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "remote_cache": { + "mode": "read", + "url": "https://cache.example/projects/test" + } + }, + "spawn_command": { + "spawn_envs": {} + } + } + } + } + } + ] + } + } + ] +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml index 0c2bd3096..8347ad81b 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml @@ -28,11 +28,11 @@ name = "invalid_cli_mode" args = ["run", "--remote-cache=invalid", "build"] [[plan]] -name = "invalid_endpoint" +name = "endpoint_not_validated" args = ["run", "build"] env = { "VP_REMOTE_CACHE_URL" = "cache.example/projects/test" } [[plan]] -name = "unsupported_endpoint_scheme" +name = "empty_controls_unset" args = ["run", "build"] -env = { "VP_REMOTE_CACHE_URL" = "file:///cache" } +env = { "VP_REMOTE_CACHE" = "", "VP_REMOTE_CACHE_URL" = "" } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_empty_controls_unset.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_empty_controls_unset.jsonc new file mode 100644 index 000000000..8708ec15b --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_empty_controls_unset.jsonc @@ -0,0 +1,26 @@ +// run build +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "items": [ + { + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "remote_cache": null + } + } + } + } + } + ] + } + } + ] +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_endpoint_not_validated.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_endpoint_not_validated.jsonc new file mode 100644 index 000000000..305cf9bab --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_endpoint_not_validated.jsonc @@ -0,0 +1,29 @@ +// run build +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "items": [ + { + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "remote_cache": { + "mode": "read", + "url": "cache.example/projects/test" + } + } + } + } + } + } + ] + } + } + ] +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_endpoint.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_endpoint.snap deleted file mode 100644 index 0bd4b52cb..000000000 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_endpoint.snap +++ /dev/null @@ -1 +0,0 @@ -Invalid remote cache endpoint: relative URL without a base: relative URL without a base \ No newline at end of file diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_unsupported_endpoint_scheme.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_unsupported_endpoint_scheme.snap deleted file mode 100644 index 0f3f9dea8..000000000 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_unsupported_endpoint_scheme.snap +++ /dev/null @@ -1 +0,0 @@ -Remote cache endpoint must be an HTTP or HTTPS URL with a host \ No newline at end of file From c1420952e4b9290261e1b681e9f35a6191bd330a Mon Sep 17 00:00:00 2001 From: wan9chi Date: Wed, 23 Sep 2026 19:51:50 +0800 Subject: [PATCH 04/14] fix(cache): pass remote cache controls through to tasks `VP_REMOTE_CACHE` and `VP_REMOTE_CACHE_URL` reach task processes like other `VP_*` variables, including the mode set by `--remote-cache`, so `vp` processes started by a task inherit the invocation's remote cache settings. They stay out of cache fingerprints, including envs matched by `cache.env`, command prefix envs, and runner-aware env queries, so runs with different remote access share cache entries. Co-authored-by: Claude Opus 5.5 --- crates/vt_plan/src/envs.rs | 12 ++++----- crates/vt_plan/src/plan.rs | 26 ++++++------------- crates/vt_plan/src/remote_cache.rs | 18 +++++++++++++ .../remote_cache_config/snapshots.toml | 5 ++-- .../query_cli_overrides_invalid_env.jsonc | 4 ++- ...d.jsonc => query_controls_untracked.jsonc} | 7 ++++- ...query_empty_env_endpoint_uses_config.jsonc | 4 ++- .../query_nested_cli_overrides_env.jsonc | 4 ++- .../snapshots/query_nested_env_override.jsonc | 4 ++- .../snapshots/query_nested_inherits_cli.jsonc | 4 ++- .../snapshots/query_no_cache.jsonc | 4 ++- ... => query_prefix_controls_untracked.jsonc} | 5 +++- .../query_sibling_endpoint_isolation.jsonc | 4 ++- .../query_sibling_mode_isolation.jsonc | 4 ++- .../snapshots/query_task_local_only.jsonc | 4 ++- 15 files changed, 71 insertions(+), 38 deletions(-) rename crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/{query_controls_excluded.jsonc => query_controls_untracked.jsonc} (76%) rename crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/{query_prefix_controls_excluded.jsonc => query_prefix_controls_untracked.jsonc} (83%) diff --git a/crates/vt_plan/src/envs.rs b/crates/vt_plan/src/envs.rs index 195f7b7f6..b0dffc847 100644 --- a/crates/vt_plan/src/envs.rs +++ b/crates/vt_plan/src/envs.rs @@ -134,7 +134,10 @@ impl EnvFingerprints { let Some(name) = name.inner().to_str() else { continue; }; - if !fingerprinted_env_patterns.is_match(name) { + // Matching controls still reach the task, just untracked. + if !fingerprinted_env_patterns.is_match(name) + || crate::remote_cache::is_control_env(EnvName::from_ref(name)) + { continue; } let Some(value) = value.to_str() else { @@ -151,12 +154,7 @@ impl EnvFingerprints { fingerprinted_envs, // Save untracked_env names sorted for deterministic cache fingerprinting untracked_env_config: { - let mut sorted: Vec = env_config - .untracked_env - .iter() - .filter(|name| !crate::remote_cache::is_control_env(EnvName::from_ref(*name))) - .cloned() - .collect(); + let mut sorted: Vec = env_config.untracked_env.iter().cloned().collect(); sorted.sort(); sorted.into() }, diff --git a/crates/vt_plan/src/plan.rs b/crates/vt_plan/src/plan.rs index 5f2473bd5..8ea07c326 100644 --- a/crates/vt_plan/src/plan.rs +++ b/crates/vt_plan/src/plan.rs @@ -625,19 +625,10 @@ fn plan_spawn_execution( program_path: Arc, args: Arc<[Str]>, ) -> Result { - // Controls are for planning only. Remove them before either task env - // filtering or post-run environment tracking can observe them. - let envs = if envs.keys().any(|name| crate::remote_cache::is_control_env(name)) { - Arc::new( - envs.iter() - .filter(|(name, _)| !crate::remote_cache::is_control_env(name)) - .map(|(name, value)| (name.clone(), Arc::clone(value))) - .collect(), - ) - } else { - Arc::clone(envs) - }; - let mut spawn_envs = (*envs).clone(); + // The child env starts from the full context and is filtered in place by + // `EnvFingerprints::resolve` below — this clone is the one place the map's + // contents are actually copied per spawn. + let mut spawn_envs = (**envs).clone(); let cwd = Arc::clone(&resolved_task_options.cwd); let mut resolved_cache_metadata = None; @@ -652,7 +643,7 @@ fn plan_spawn_execution( // differently, like `foo` for `Foo=1` on Windows. let fingerprinted_envs = &mut env_fingerprints.fingerprinted_envs; for (name, value) in prefix_envs { - if crate::remote_cache::is_control_env(name) { + if remote_cache::is_control_env(name) { continue; } fingerprinted_envs.retain(|existing, _| EnvName::from_ref(existing) != name); @@ -707,7 +698,9 @@ fn plan_spawn_execution( input_config: cache_config.input_config.clone(), output_config: cache_config.output_config.clone(), remote_cache: if cache_config.remote_cache { remote_cache.cloned() } else { None }, - unfiltered_envs: Arc::clone(&envs), + // Runner-aware env queries must not record the controls in the + // post-run fingerprint either. + unfiltered_envs: remote_cache::without_control_envs(envs), }); } } @@ -723,9 +716,6 @@ fn plan_spawn_execution( // spelling, so remove the entry first: the task then sees the // assignment's spelling, which is the one fingerprinted above. for (name, value) in prefix_envs { - if crate::remote_cache::is_control_env(name) { - continue; - } let name = EnvName::new(Arc::::from(OsStr::new(name.inner().as_str()))); spawn_envs.remove(&name); spawn_envs.insert(name, OsStr::new(value.as_str()).into()); diff --git a/crates/vt_plan/src/remote_cache.rs b/crates/vt_plan/src/remote_cache.rs index aad6f4956..14cfdedd2 100644 --- a/crates/vt_plan/src/remote_cache.rs +++ b/crates/vt_plan/src/remote_cache.rs @@ -69,10 +69,28 @@ pub enum RemoteCacheConfigError { MissingEndpoint, } +/// Whether `name` is one of the env vars that select remote cache access. +/// They pass through to tasks like other `VP_*` variables, but never enter a +/// cache fingerprint, so runs with different remote access share entries. pub(crate) fn is_control_env + ?Sized>(name: &EnvName) -> bool { [MODE_ENV, URL_ENV].into_iter().any(|control| name == EnvName::from_ref(OsStr::new(control))) } +/// `envs` without the remote cache controls. +pub(crate) fn without_control_envs( + envs: &Arc>, Arc>>, +) -> Arc>, Arc>> { + if !envs.keys().any(is_control_env) { + return Arc::clone(envs); + } + Arc::new( + envs.iter() + .filter(|(name, _)| !is_control_env(name)) + .map(|(name, value)| (name.clone(), Arc::clone(value))) + .collect(), + ) +} + /// Reads a control env. An empty value counts as unset, like a CI secret that /// isn't available to the job. fn env_value<'a>( diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml index e0949c120..35ee330d4 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml @@ -29,6 +29,7 @@ args = ["run", "--remote-cache=read-write", "local-only"] [[plan]] name = "no_cache" args = ["run", "--no-cache", "build"] +env = { "VP_REMOTE_CACHE" = "read-write" } [[plan]] name = "synthetic_local_only" @@ -40,12 +41,12 @@ args = ["run", "build"] env = { "VP_REMOTE_CACHE_URL" = "" } [[plan]] -name = "controls_excluded" +name = "controls_untracked" args = ["run", "tracked-controls"] env = { "VP_REMOTE_CACHE" = "read-write", "VP_REMOTE_CACHE_URL" = "https://other.example/projects/test" } [[plan]] -name = "prefix_controls_excluded" +name = "prefix_controls_untracked" args = ["run", "prefix"] [[plan]] diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc index 5ffb03189..3b09c6a52 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc @@ -27,7 +27,9 @@ } }, "spawn_command": { - "spawn_envs": {} + "spawn_envs": { + "VP_REMOTE_CACHE": "read-write" + } } } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_excluded.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_untracked.jsonc similarity index 76% rename from crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_excluded.jsonc rename to crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_untracked.jsonc index 63f09c576..ccdebb77a 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_excluded.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_untracked.jsonc @@ -17,6 +17,8 @@ "env_fingerprints": { "fingerprinted_envs": {}, "untracked_env_config": [ + "VP_REMOTE_CACHE", + "VP_REMOTE_CACHE_URL", "" ] } @@ -27,7 +29,10 @@ } }, "spawn_command": { - "spawn_envs": {} + "spawn_envs": { + "VP_REMOTE_CACHE": "read-write", + "VP_REMOTE_CACHE_URL": "https://other.example/projects/test" + } } } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc index dbdf0c433..aab70db34 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc @@ -27,7 +27,9 @@ } }, "spawn_command": { - "spawn_envs": {} + "spawn_envs": { + "VP_REMOTE_CACHE_URL": "" + } } } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc index f332b617d..cec1ed55c 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc @@ -38,7 +38,9 @@ } }, "spawn_command": { - "spawn_envs": {} + "spawn_envs": { + "VP_REMOTE_CACHE": "read" + } } } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc index f218da734..a5bd9802f 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc @@ -35,7 +35,9 @@ "remote_cache": null }, "spawn_command": { - "spawn_envs": {} + "spawn_envs": { + "VP_REMOTE_CACHE": "off" + } } } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc index d68e783bf..e259b84ef 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc @@ -35,7 +35,9 @@ "remote_cache": null }, "spawn_command": { - "spawn_envs": {} + "spawn_envs": { + "VP_REMOTE_CACHE": "off" + } } } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc index bbe71fdf7..af4313d13 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_no_cache.jsonc @@ -14,7 +14,9 @@ "Spawn": { "cache_metadata": null, "spawn_command": { - "spawn_envs": {} + "spawn_envs": { + "VP_REMOTE_CACHE": "read-write" + } } } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_excluded.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_untracked.jsonc similarity index 83% rename from crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_excluded.jsonc rename to crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_untracked.jsonc index 03dc881e2..a1d35524c 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_excluded.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_untracked.jsonc @@ -27,7 +27,10 @@ } }, "spawn_command": { - "spawn_envs": {} + "spawn_envs": { + "VP_REMOTE_CACHE": "off", + "VP_REMOTE_CACHE_URL": "https://other.example" + } } } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc index de64903ac..ed3a8ef20 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc @@ -38,7 +38,9 @@ } }, "spawn_command": { - "spawn_envs": {} + "spawn_envs": { + "VP_REMOTE_CACHE_URL": "https://other.example/projects/nested" + } } } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc index dedc543c6..6ae096b98 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc @@ -35,7 +35,9 @@ "remote_cache": null }, "spawn_command": { - "spawn_envs": {} + "spawn_envs": { + "VP_REMOTE_CACHE": "off" + } } } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc index d856fe09a..1b5ca185a 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc @@ -24,7 +24,9 @@ "remote_cache": null }, "spawn_command": { - "spawn_envs": {} + "spawn_envs": { + "VP_REMOTE_CACHE": "read-write" + } } } } From 82e41598ea969952171177218182dc9b08cc46eb Mon Sep 17 00:00:00 2001 From: wan9chi Date: Thu, 24 Sep 2026 10:16:52 +0800 Subject: [PATCH 05/14] feat(config): move the remote cache endpoint under `cache` Configure the workspace endpoint as `cache: { remote: { url } }` in the workspace root config, next to the task-level `cache: { remote }` setting. `cache` is already limited to the workspace root, so the separate `remoteCache` check is no longer needed. Co-authored-by: Claude Opus 5.5 --- crates/vt_graph/run-config.ts | 10 ++-- crates/vt_graph/src/config/user.rs | 48 ++++++++++++++++--- crates/vt_graph/src/lib.rs | 23 ++------- crates/vt_plan/src/remote_cache.rs | 2 +- .../remote_cache_config/vite-task.json | 8 ++-- .../remote_cache_non_root_config/package.json | 6 --- .../packages/app/package.json | 3 -- .../packages/app/vite-task.json | 1 - .../pnpm-workspace.yaml | 2 - .../snapshots.toml | 0 .../snapshots/task_graph_load_error.snap | 1 - .../snapshots/query_missing_cli_endpoint.snap | 2 +- 12 files changed, 58 insertions(+), 48 deletions(-) delete mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/package.json delete mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/package.json delete mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/vite-task.json delete mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/pnpm-workspace.yaml delete mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots.toml delete mode 100644 crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots/task_graph_load_error.snap diff --git a/crates/vt_graph/run-config.ts b/crates/vt_graph/run-config.ts index d253cd6ac..2845c4bc0 100644 --- a/crates/vt_graph/run-config.ts +++ b/crates/vt_graph/run-config.ts @@ -121,7 +121,11 @@ scripts?: boolean, * * Default: `true` */ -tasks?: boolean, }; +tasks?: boolean, +/** + * Remote cache shared by tasks in the workspace. + */ +remote?: RemoteCacheConfig, }; export type UserPackageDependency = { /** @@ -141,10 +145,6 @@ export type RunConfig = { * Setting it in a package's config will result in an error. */ cache?: UserGlobalCacheConfig, -/** - * Remote cache endpoint. Only allowed in the workspace root config. - */ -remoteCache?: RemoteCacheConfig, /** * Task definitions: full task objects, command strings, or command string arrays. */ diff --git a/crates/vt_graph/src/config/user.rs b/crates/vt_graph/src/config/user.rs index fb930f48c..c9865ce3c 100644 --- a/crates/vt_graph/src/config/user.rs +++ b/crates/vt_graph/src/config/user.rs @@ -334,7 +334,7 @@ pub enum UserTaskDefinition { /// /// This option can only be set in the workspace root's config file. /// Setting it in a package's config will result in an error. -#[derive(Debug, Clone, Copy, Deserialize, PartialEq, Eq)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] // TS derive macro generates code using std types that clippy disallows; skip derive during linting #[cfg_attr(all(test, not(clippy)), derive(TS), ts(optional_fields))] #[serde(untagged, deny_unknown_fields)] @@ -359,9 +359,23 @@ pub enum UserGlobalCacheConfig { /// /// Default: `true` tasks: Option, + + /// Remote cache shared by tasks in the workspace. + remote: Option, }, } +impl UserGlobalCacheConfig { + /// The remote cache settings, if configured. + #[must_use] + pub fn into_remote(self) -> Option { + match self { + Self::Bool(_) => None, + Self::Detailed { remote, .. } => remote, + } + } +} + /// Resolved global cache configuration with concrete boolean values. #[derive(Debug, Clone, Copy)] pub struct ResolvedGlobalCacheConfig { @@ -379,15 +393,16 @@ impl ResolvedGlobalCacheConfig { None => Self { scripts: false, tasks: true }, Some(UserGlobalCacheConfig::Bool(true)) => Self { scripts: true, tasks: true }, Some(UserGlobalCacheConfig::Bool(false)) => Self { scripts: false, tasks: false }, - Some(UserGlobalCacheConfig::Detailed { scripts, tasks }) => { + Some(UserGlobalCacheConfig::Detailed { scripts, tasks, .. }) => { Self { scripts: scripts.unwrap_or(false), tasks: tasks.unwrap_or(true) } } } } } -/// Remote cache endpoint shared by tasks in a workspace. -#[derive(Debug, Clone, Deserialize)] +/// Remote cache settings in the workspace root's `cache` config. +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] +// TS derive macro generates code using std types that clippy disallows; skip derive during linting #[cfg_attr(all(test, not(clippy)), derive(TS), ts(rename = "RemoteCacheConfig"))] #[serde(deny_unknown_fields, rename_all = "camelCase")] pub struct UserRemoteCacheConfig { @@ -407,9 +422,6 @@ pub struct UserRunConfig { /// Setting it in a package's config will result in an error. pub cache: Option, - /// Remote cache endpoint. Only allowed in the workspace root config. - pub remote_cache: Option, - /// Task definitions: full task objects, command strings, or command string arrays. pub tasks: Option>, @@ -1000,6 +1012,28 @@ mod tests { assert!(!resolved.tasks); } + #[test] + fn test_global_cache_detailed_remote() { + let config: UserGlobalCacheConfig = serde_json::from_value(json!({ + "scripts": true, + "remote": { "url": "https://cache.example/projects/test" }, + })) + .unwrap(); + let resolved = ResolvedGlobalCacheConfig::resolve_from(Some(&config)); + assert!(resolved.scripts); + assert!(resolved.tasks); + assert_eq!( + config.into_remote(), + Some(UserRemoteCacheConfig { url: "https://cache.example/projects/test".into() }) + ); + + assert!( + serde_json::from_value::(json!({ "remote": { "foo": 42 } })) + .is_err() + ); + assert!(serde_json::from_value::(json!({ "remoteCache": {} })).is_err()); + } + #[test] fn test_global_cache_none_defaults() { let resolved = ResolvedGlobalCacheConfig::resolve_from(None); diff --git a/crates/vt_graph/src/lib.rs b/crates/vt_graph/src/lib.rs index 6057f793e..07ac34f2e 100644 --- a/crates/vt_graph/src/lib.rs +++ b/crates/vt_graph/src/lib.rs @@ -125,11 +125,6 @@ pub enum TaskGraphLoadError { #[error("`cache` can only be set in the workspace root config, but found in {package_path}")] CacheInNonRootPackage { package_path: Arc }, - #[error( - "`remoteCache` can only be set in the workspace root config, but found in {package_path}" - )] - RemoteCacheInNonRootPackage { package_path: Arc }, - #[error( "`enablePrePostScripts` can only be set in the workspace root config, but found in {package_path}" )] @@ -241,7 +236,7 @@ pub struct IndexedTaskGraph { /// Global cache configuration resolved from the workspace root config. resolved_global_cache: ResolvedGlobalCacheConfig, - /// Remote cache endpoint from the workspace root. + /// Remote cache settings from the workspace root's `cache.remote`. remote_cache: Option, /// Whether pre/post script hooks are enabled (from `enablePrePostScripts` in workspace root config). @@ -283,7 +278,6 @@ impl IndexedTaskGraph { // First pass: load all configs, extract root cache config, validate let mut root_cache = None; - let mut remote_cache = None; let mut root_pre_post_scripts_enabled = None; let mut package_configs: Vec<(PackageNodeIndex, Arc, UserRunConfig)> = Vec::with_capacity(package_graph.node_count()); @@ -293,7 +287,7 @@ impl IndexedTaskGraph { let package_dir: Arc = workspace_root.path.join(&package.path).into(); let is_workspace_root = package.path.as_str().is_empty(); - let user_config = config_loader + let mut user_config = config_loader .load_user_config_file(&package_dir) .await .map_err(|error| TaskGraphLoadError::ConfigLoadError { @@ -302,7 +296,7 @@ impl IndexedTaskGraph { })? .unwrap_or_default(); - if let Some(cache) = user_config.cache { + if let Some(cache) = user_config.cache.take() { if is_workspace_root { root_cache = Some(cache); } else { @@ -312,15 +306,6 @@ impl IndexedTaskGraph { } } - if let Some(config) = &user_config.remote_cache { - if !is_workspace_root { - return Err(TaskGraphLoadError::RemoteCacheInNonRootPackage { - package_path: package_dir.clone(), - }); - } - remote_cache = Some(config.clone()); - } - if let Some(val) = user_config.enable_pre_post_scripts { if is_workspace_root { root_pre_post_scripts_enabled = Some(val); @@ -335,6 +320,7 @@ impl IndexedTaskGraph { } let resolved_global_cache = ResolvedGlobalCacheConfig::resolve_from(root_cache.as_ref()); + let remote_cache = root_cache.and_then(config::user::UserGlobalCacheConfig::into_remote); let mut top_level_cache_fields = TopLevelCacheFieldsCollector::default(); @@ -619,6 +605,7 @@ impl IndexedTaskGraph { &self.resolved_global_cache } + /// Remote cache settings from the workspace root config. #[must_use] pub const fn remote_cache_config(&self) -> Option<&config::user::UserRemoteCacheConfig> { self.remote_cache.as_ref() diff --git a/crates/vt_plan/src/remote_cache.rs b/crates/vt_plan/src/remote_cache.rs index 14cfdedd2..425ce3e7f 100644 --- a/crates/vt_plan/src/remote_cache.rs +++ b/crates/vt_plan/src/remote_cache.rs @@ -65,7 +65,7 @@ pub enum RemoteCacheConfigError { InvalidMode(Str), #[error("{0} must be valid Unicode")] InvalidEnv(&'static str), - #[error("Remote caching requires remoteCache.url or VP_REMOTE_CACHE_URL")] + #[error("Remote caching requires cache.remote.url or VP_REMOTE_CACHE_URL")] MissingEndpoint, } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json index ec180e0f8..98410afeb 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json @@ -1,7 +1,9 @@ { - "cache": true, - "remoteCache": { - "url": "https://cache.example/projects/test" + "cache": { + "scripts": true, + "remote": { + "url": "https://cache.example/projects/test" + } }, "tasks": { "build": { diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/package.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/package.json deleted file mode 100644 index fef916cc3..000000000 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "@test/remote-cache-non-root-config", - "workspaces": [ - "packages/*" - ] -} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/package.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/package.json deleted file mode 100644 index c3db9bba0..000000000 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "@test/app" -} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/vite-task.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/vite-task.json deleted file mode 100644 index 1f99e9492..000000000 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/packages/app/vite-task.json +++ /dev/null @@ -1 +0,0 @@ -{ "remoteCache": { "url": "https://cache.example/projects/test" } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/pnpm-workspace.yaml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/pnpm-workspace.yaml deleted file mode 100644 index 924b55f42..000000000 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/pnpm-workspace.yaml +++ /dev/null @@ -1,2 +0,0 @@ -packages: - - packages/* diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots.toml deleted file mode 100644 index e69de29bb..000000000 diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots/task_graph_load_error.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots/task_graph_load_error.snap deleted file mode 100644 index b9a6094f5..000000000 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_non_root_config/snapshots/task_graph_load_error.snap +++ /dev/null @@ -1 +0,0 @@ -`remoteCache` can only be set in the workspace root config, but found in /packages/app \ No newline at end of file diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_missing_cli_endpoint.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_missing_cli_endpoint.snap index 91decb8fb..adb634a0b 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_missing_cli_endpoint.snap +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_missing_cli_endpoint.snap @@ -1 +1 @@ -Remote caching requires remoteCache.url or VP_REMOTE_CACHE_URL \ No newline at end of file +Remote caching requires cache.remote.url or VP_REMOTE_CACHE_URL \ No newline at end of file From f819ce10a4a1aba4963306723331bb298f346704 Mon Sep 17 00:00:00 2001 From: wan9chi Date: Thu, 24 Sep 2026 11:02:29 +0800 Subject: [PATCH 06/14] test(cache): cover remote cache control names on Windows `VP_REMOTE_CACHE` and `VP_REMOTE_CACHE_URL` now match env names by the platform's rules, so on Windows a differently spelled control selects the remote cache and stays out of fingerprints. Co-authored-by: Claude Opus 5.5 --- crates/vt_plan/src/envs.rs | 26 ++++++++++++++++++++++ crates/vt_plan/src/remote_cache.rs | 35 ++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/crates/vt_plan/src/envs.rs b/crates/vt_plan/src/envs.rs index b0dffc847..2a47ec17e 100644 --- a/crates/vt_plan/src/envs.rs +++ b/crates/vt_plan/src/envs.rs @@ -286,6 +286,32 @@ mod tests { } } + #[test] + fn test_remote_cache_controls_are_not_fingerprinted() { + // Controls pass through when a pattern matches them, but never enter + // the fingerprint. On Windows the lowercase spellings are the same + // variables. + let mut envs = create_test_envs(vec![ + ("VP_REMOTE_CACHE", "read-write"), + ("vp_remote_cache_url", "https://cache.example"), + ("OTHER", "value"), + ]); + let env_config = create_env_config(&["*"], &[]); + + let result = EnvFingerprints::resolve(&mut envs, &env_config).unwrap(); + + assert!(envs.contains_key(EnvName::from_ref(OsStr::new("VP_REMOTE_CACHE")))); + assert!(envs.contains_key(EnvName::from_ref(OsStr::new("vp_remote_cache_url")))); + let mut fingerprinted: Vec<&str> = + result.fingerprinted_envs.keys().map(Str::as_str).collect(); + fingerprinted.sort_unstable(); + if cfg!(windows) { + assert_eq!(fingerprinted, ["FORCE_COLOR", "OTHER"]); + } else { + assert_eq!(fingerprinted, ["FORCE_COLOR", "OTHER", "vp_remote_cache_url"]); + } + } + #[test] fn test_force_color_fallback_fingerprinted_when_opted_in_but_parent_absent() { // User opts in to `FORCE_COLOR` as fingerprinted, but parent has no diff --git a/crates/vt_plan/src/remote_cache.rs b/crates/vt_plan/src/remote_cache.rs index 425ce3e7f..1f9604bf5 100644 --- a/crates/vt_plan/src/remote_cache.rs +++ b/crates/vt_plan/src/remote_cache.rs @@ -127,3 +127,38 @@ pub(crate) fn resolve( } } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn controls_match_env_names_by_platform_rules() { + for name in ["VP_REMOTE_CACHE", "VP_REMOTE_CACHE_URL"] { + assert!(is_control_env(EnvName::from_ref(name))); + } + for name in ["vp_remote_cache", "Vp_Remote_Cache_Url"] { + assert_eq!(is_control_env(EnvName::from_ref(name)), cfg!(windows), "{name}"); + } + assert!(!is_control_env(EnvName::from_ref("VP_REMOTE_CACHE_TOKEN"))); + + let envs = + [("vp_remote_cache", "read-write"), ("vp_remote_cache_url", "https://cache.example")] + .into_iter() + .map(|(name, value)| { + ( + EnvName::new(Arc::::from(OsStr::new(name))), + Arc::::from(OsStr::new(value)), + ) + }) + .collect(); + let resolved = resolve(None, &envs).unwrap(); + if cfg!(windows) { + let resolved = resolved.unwrap(); + assert_eq!(resolved.mode, RemoteCacheAccess::ReadWrite); + assert_eq!(resolved.url.as_str(), "https://cache.example"); + } else { + assert!(resolved.is_none()); + } + } +} From 74e92bbe1af83eb20d48f2a50e2298fe0903103b Mon Sep 17 00:00:00 2001 From: wan9chi Date: Thu, 24 Sep 2026 17:05:03 +0800 Subject: [PATCH 07/14] refactor(config): resolve the remote cache with the global cache config Resolve the `cache.remote.url` endpoint into `ResolvedGlobalCacheConfig` with the other workspace cache settings, instead of keeping it in a separate field on the task graph. `--cache` and `--no-cache` keep the configured endpoint. Store endpoints as `Arc`: they are usually too long for an inline `Str`, and each cacheable execution carries a copy. Co-authored-by: Claude Opus 5.5 --- crates/vt_graph/Cargo.toml | 2 +- crates/vt_graph/src/config/user.rs | 40 +++++++++++++----------------- crates/vt_graph/src/lib.rs | 11 -------- crates/vt_plan/Cargo.toml | 2 +- crates/vt_plan/src/context.rs | 4 +-- crates/vt_plan/src/lib.rs | 20 +++++++++------ crates/vt_plan/src/plan.rs | 12 ++++----- crates/vt_plan/src/remote_cache.rs | 15 ++++++----- 8 files changed, 46 insertions(+), 60 deletions(-) diff --git a/crates/vt_graph/Cargo.toml b/crates/vt_graph/Cargo.toml index 1fc421017..603b9faeb 100644 --- a/crates/vt_graph/Cargo.toml +++ b/crates/vt_graph/Cargo.toml @@ -13,7 +13,7 @@ async-trait = { workspace = true } wincode = { workspace = true, features = ["derive"] } petgraph = { workspace = true } rustc-hash = { workspace = true } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true, features = ["derive", "rc"] } serde_json = { workspace = true } thiserror = { workspace = true } tracing = { workspace = true } diff --git a/crates/vt_graph/src/config/user.rs b/crates/vt_graph/src/config/user.rs index c9865ce3c..a7c8f8db5 100644 --- a/crates/vt_graph/src/config/user.rs +++ b/crates/vt_graph/src/config/user.rs @@ -365,22 +365,13 @@ pub enum UserGlobalCacheConfig { }, } -impl UserGlobalCacheConfig { - /// The remote cache settings, if configured. - #[must_use] - pub fn into_remote(self) -> Option { - match self { - Self::Bool(_) => None, - Self::Detailed { remote, .. } => remote, - } - } -} - -/// Resolved global cache configuration with concrete boolean values. -#[derive(Debug, Clone, Copy)] +/// Resolved global cache configuration with concrete values. +#[derive(Debug, Clone)] pub struct ResolvedGlobalCacheConfig { pub scripts: bool, pub tasks: bool, + /// Remote cache endpoint from `cache.remote.url`, if configured. + pub remote_url: Option>, } impl ResolvedGlobalCacheConfig { @@ -390,12 +381,18 @@ impl ResolvedGlobalCacheConfig { #[must_use] pub fn resolve_from(config: Option<&UserGlobalCacheConfig>) -> Self { match config { - None => Self { scripts: false, tasks: true }, - Some(UserGlobalCacheConfig::Bool(true)) => Self { scripts: true, tasks: true }, - Some(UserGlobalCacheConfig::Bool(false)) => Self { scripts: false, tasks: false }, - Some(UserGlobalCacheConfig::Detailed { scripts, tasks, .. }) => { - Self { scripts: scripts.unwrap_or(false), tasks: tasks.unwrap_or(true) } + None => Self { scripts: false, tasks: true, remote_url: None }, + Some(UserGlobalCacheConfig::Bool(true)) => { + Self { scripts: true, tasks: true, remote_url: None } + } + Some(UserGlobalCacheConfig::Bool(false)) => { + Self { scripts: false, tasks: false, remote_url: None } } + Some(UserGlobalCacheConfig::Detailed { scripts, tasks, remote }) => Self { + scripts: scripts.unwrap_or(false), + tasks: tasks.unwrap_or(true), + remote_url: remote.as_ref().map(|remote| Arc::clone(&remote.url)), + }, } } } @@ -407,7 +404,7 @@ impl ResolvedGlobalCacheConfig { #[serde(deny_unknown_fields, rename_all = "camelCase")] pub struct UserRemoteCacheConfig { /// HTTP or HTTPS namespace endpoint. Overridden by `VP_REMOTE_CACHE_URL`. - pub url: Str, + pub url: Arc, } /// User configuration structure for `run` field in `vite.config.*` @@ -1022,10 +1019,7 @@ mod tests { let resolved = ResolvedGlobalCacheConfig::resolve_from(Some(&config)); assert!(resolved.scripts); assert!(resolved.tasks); - assert_eq!( - config.into_remote(), - Some(UserRemoteCacheConfig { url: "https://cache.example/projects/test".into() }) - ); + assert_eq!(resolved.remote_url.as_deref(), Some("https://cache.example/projects/test")); assert!( serde_json::from_value::(json!({ "remote": { "foo": 42 } })) diff --git a/crates/vt_graph/src/lib.rs b/crates/vt_graph/src/lib.rs index 07ac34f2e..22a235ccb 100644 --- a/crates/vt_graph/src/lib.rs +++ b/crates/vt_graph/src/lib.rs @@ -236,9 +236,6 @@ pub struct IndexedTaskGraph { /// Global cache configuration resolved from the workspace root config. resolved_global_cache: ResolvedGlobalCacheConfig, - /// Remote cache settings from the workspace root's `cache.remote`. - remote_cache: Option, - /// Whether pre/post script hooks are enabled (from `enablePrePostScripts` in workspace root config). pre_post_scripts_enabled: bool, } @@ -320,7 +317,6 @@ impl IndexedTaskGraph { } let resolved_global_cache = ResolvedGlobalCacheConfig::resolve_from(root_cache.as_ref()); - let remote_cache = root_cache.and_then(config::user::UserGlobalCacheConfig::into_remote); let mut top_level_cache_fields = TopLevelCacheFieldsCollector::default(); @@ -438,7 +434,6 @@ impl IndexedTaskGraph { node_indices_by_task_id, task_ids_by_node_index, resolved_global_cache, - remote_cache, pre_post_scripts_enabled: root_pre_post_scripts_enabled.unwrap_or(true), }; @@ -605,12 +600,6 @@ impl IndexedTaskGraph { &self.resolved_global_cache } - /// Remote cache settings from the workspace root config. - #[must_use] - pub const fn remote_cache_config(&self) -> Option<&config::user::UserRemoteCacheConfig> { - self.remote_cache.as_ref() - } - /// Whether pre/post script hooks are enabled workspace-wide. #[must_use] pub const fn pre_post_scripts_enabled(&self) -> bool { diff --git a/crates/vt_plan/Cargo.toml b/crates/vt_plan/Cargo.toml index b19c276de..1c23e81b3 100644 --- a/crates/vt_plan/Cargo.toml +++ b/crates/vt_plan/Cargo.toml @@ -19,7 +19,7 @@ futures-util = { workspace = true } pathdiff = { workspace = true } petgraph = { workspace = true } rustc-hash = { workspace = true } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true, features = ["derive", "rc"] } sha2 = { workspace = true } shell-escape = { workspace = true } thiserror = { workspace = true } diff --git a/crates/vt_plan/src/context.rs b/crates/vt_plan/src/context.rs index b69462fee..dd20cf185 100644 --- a/crates/vt_plan/src/context.rs +++ b/crates/vt_plan/src/context.rs @@ -146,7 +146,7 @@ impl<'a> PlanContext<'a> { &self.resolved_global_cache } - pub const fn set_resolved_global_cache(&mut self, config: ResolvedGlobalCacheConfig) { + pub fn set_resolved_global_cache(&mut self, config: ResolvedGlobalCacheConfig) { self.resolved_global_cache = config; } @@ -173,7 +173,7 @@ impl<'a> PlanContext<'a> { task_call_stack: self.task_call_stack.clone(), indexed_task_graph: self.indexed_task_graph, extra_args: Arc::clone(&self.extra_args), - resolved_global_cache: self.resolved_global_cache, + resolved_global_cache: self.resolved_global_cache.clone(), parent_query: Arc::clone(&self.parent_query), } } diff --git a/crates/vt_plan/src/lib.rs b/crates/vt_plan/src/lib.rs index 277896583..e58884c94 100644 --- a/crates/vt_plan/src/lib.rs +++ b/crates/vt_plan/src/lib.rs @@ -209,7 +209,7 @@ pub async fn plan_query( ) -> Result { let indexed_task_graph = task_graph_loader.load_task_graph().await?; - let resolved_global_cache = *indexed_task_graph.global_cache_config(); + let resolved_global_cache = indexed_task_graph.global_cache_config().clone(); let QueryPlanRequest { query, plan_options } = query_plan_request; let query = Arc::new(query); @@ -225,17 +225,21 @@ pub async fn plan_query( plan_query_request(query, plan_options, context).await } -const fn resolve_cache_with_override( +fn resolve_cache_with_override( graph_cache: vt_graph::config::ResolvedGlobalCacheConfig, cache_override: CacheOverride, ) -> vt_graph::config::ResolvedGlobalCacheConfig { match cache_override { - CacheOverride::ForceEnabled => { - vt_graph::config::ResolvedGlobalCacheConfig { scripts: true, tasks: true } - } - CacheOverride::ForceDisabled => { - vt_graph::config::ResolvedGlobalCacheConfig { scripts: false, tasks: false } - } + CacheOverride::ForceEnabled => vt_graph::config::ResolvedGlobalCacheConfig { + scripts: true, + tasks: true, + ..graph_cache + }, + CacheOverride::ForceDisabled => vt_graph::config::ResolvedGlobalCacheConfig { + scripts: false, + tasks: false, + ..graph_cache + }, CacheOverride::None => graph_cache, } } diff --git a/crates/vt_plan/src/plan.rs b/crates/vt_plan/src/plan.rs index 8ea07c326..d44f43eb9 100644 --- a/crates/vt_plan/src/plan.rs +++ b/crates/vt_plan/src/plan.rs @@ -73,7 +73,7 @@ fn which( fn effective_cache_config( task_cache_config: Option<&CacheConfig>, source: TaskSource, - resolved_global_cache: ResolvedGlobalCacheConfig, + resolved_global_cache: &ResolvedGlobalCacheConfig, ) -> Option { let enabled = match source { TaskSource::PackageJsonScript => resolved_global_cache.scripts, @@ -293,7 +293,7 @@ async fn plan_task_as_execution_node( let task_effective_cache = effective_cache_config( task_node.resolved_config.resolved_options.cache_config.as_ref(), task_node.source, - *context.resolved_global_cache(), + context.resolved_global_cache(), ); let parent_cache_config = task_effective_cache .as_ref() @@ -331,7 +331,7 @@ async fn plan_task_as_execution_node( cache_config: effective_cache_config( task_node.resolved_config.resolved_options.cache_config.as_ref(), task_node.source, - *context.resolved_global_cache(), + context.resolved_global_cache(), ), }; let spawn_execution = plan_spawn_execution( @@ -389,7 +389,7 @@ async fn plan_task_as_execution_node( cache_config: effective_cache_config( task_node.resolved_config.resolved_options.cache_config.as_ref(), task_node.source, - *context.resolved_global_cache(), + context.resolved_global_cache(), ), }; let spawn_execution = plan_spawn_execution( @@ -763,7 +763,7 @@ pub async fn plan_query_request( // runs `vp run --cache inner` re-enables caching from the workspace // defaults, rather than from the parent's disabled state. let final_cache = resolve_cache_with_override( - *context.indexed_task_graph().global_cache_config(), + context.indexed_task_graph().global_cache_config().clone(), cache_override, ); context.set_resolved_global_cache(final_cache); @@ -774,7 +774,7 @@ pub async fn plan_query_request( context.add_envs(std::iter::once((remote_cache::MODE_ENV, mode.as_str()))); } let remote_cache = - remote_cache::resolve(context.indexed_task_graph().remote_cache_config(), context.envs())?; + remote_cache::resolve(context.resolved_global_cache().remote_url.as_ref(), context.envs())?; // Resolve effective concurrency for this level. // diff --git a/crates/vt_plan/src/remote_cache.rs b/crates/vt_plan/src/remote_cache.rs index 1f9604bf5..62835bfa1 100644 --- a/crates/vt_plan/src/remote_cache.rs +++ b/crates/vt_plan/src/remote_cache.rs @@ -5,7 +5,6 @@ use std::{ffi::OsStr, str::FromStr, sync::Arc}; use rustc_hash::FxHashMap; use serde::Serialize; use vt_casefold::EnvName; -use vt_graph::config::user::UserRemoteCacheConfig; use vt_str::Str; pub(crate) const MODE_ENV: &str = "VP_REMOTE_CACHE"; @@ -48,7 +47,7 @@ impl FromStr for RemoteCacheMode { pub struct RemoteCacheConfig { pub mode: RemoteCacheAccess, /// Endpoint as configured. It is validated when the remote cache is used. - pub url: Str, + pub url: Arc, } /// Access permitted when remote caching is enabled. @@ -105,14 +104,14 @@ fn env_value<'a>( /// Resolve against this invocation's environment, including inherited overrides. pub(crate) fn resolve( - configured: Option<&UserRemoteCacheConfig>, + configured_url: Option<&Arc>, envs: &FxHashMap>, Arc>, ) -> Result, RemoteCacheConfigError> { let mode = env_value(envs, MODE_ENV)?.map(str::parse).transpose()?; - let url = env_value(envs, URL_ENV)? - .or_else(|| configured.map(|config| config.url.as_str())) - .filter(|url| !url.is_empty()) - .map(Str::from); + let url: Option> = env_value(envs, URL_ENV)? + .map(Arc::from) + .or_else(|| configured_url.cloned()) + .filter(|url| !url.is_empty()); match (mode, url) { (Some(RemoteCacheMode::Off), _) | (None, None) => Ok(None), @@ -156,7 +155,7 @@ mod tests { if cfg!(windows) { let resolved = resolved.unwrap(); assert_eq!(resolved.mode, RemoteCacheAccess::ReadWrite); - assert_eq!(resolved.url.as_str(), "https://cache.example"); + assert_eq!(&*resolved.url, "https://cache.example"); } else { assert!(resolved.is_none()); } From a3350ba53893fc134836bba83f46502782c8afcf Mon Sep 17 00:00:00 2001 From: wan9chi Date: Thu, 24 Sep 2026 17:17:39 +0800 Subject: [PATCH 08/14] refactor(cache): simplify remote cache resolution - Report invalid remote cache envs as plan errors, like `VP_RUN_CONCURRENCY_LIMIT`, instead of through a separate error type. - Keep the invocation's remote cache config in `PlanContext` next to the resolved global cache config, instead of passing it through task planning. - Serve runner-aware env queries the same envs as before remote caching, without copying the env map for each spawn to hide the controls. Co-authored-by: Claude Opus 5.5 --- crates/vt_plan/src/context.rs | 16 +++- crates/vt_plan/src/error.rs | 12 ++- crates/vt_plan/src/plan.rs | 22 ++--- crates/vt_plan/src/remote_cache.rs | 80 ++++++------------- .../snapshots/query_invalid_env_mode.snap | 2 +- 5 files changed, 58 insertions(+), 74 deletions(-) diff --git a/crates/vt_plan/src/context.rs b/crates/vt_plan/src/context.rs index dd20cf185..cf36a067e 100644 --- a/crates/vt_plan/src/context.rs +++ b/crates/vt_plan/src/context.rs @@ -8,7 +8,7 @@ use vt_graph::{ use vt_path::AbsolutePath; use vt_str::Str; -use crate::{PlanRequestParser, path_env::prepend_path_env}; +use crate::{PlanRequestParser, path_env::prepend_path_env, remote_cache::RemoteCacheConfig}; #[derive(Debug, thiserror::Error)] #[error( @@ -52,6 +52,10 @@ pub struct PlanContext<'a> { /// Final resolved global cache config, combining the graph's config with any CLI override. resolved_global_cache: ResolvedGlobalCacheConfig, + /// Remote cache access for this invocation, resolved by `plan_query_request` + /// from the global cache config and the invocation's envs. + remote_cache: Option, + /// The query that caused the current expansion. /// Used by the skip rule to detect and skip duplicate nested expansions. parent_query: Arc, @@ -76,6 +80,7 @@ impl<'a> PlanContext<'a> { indexed_task_graph, extra_args: Arc::default(), resolved_global_cache, + remote_cache: None, parent_query, } } @@ -150,6 +155,14 @@ impl<'a> PlanContext<'a> { self.resolved_global_cache = config; } + pub const fn remote_cache(&self) -> Option<&RemoteCacheConfig> { + self.remote_cache.as_ref() + } + + pub fn set_remote_cache(&mut self, remote_cache: Option) { + self.remote_cache = remote_cache; + } + pub fn parent_query(&self) -> &TaskQuery { &self.parent_query } @@ -174,6 +187,7 @@ impl<'a> PlanContext<'a> { indexed_task_graph: self.indexed_task_graph, extra_args: Arc::clone(&self.extra_args), resolved_global_cache: self.resolved_global_cache.clone(), + remote_cache: self.remote_cache.clone(), parent_query: Arc::clone(&self.parent_query), } } diff --git a/crates/vt_plan/src/error.rs b/crates/vt_plan/src/error.rs index 03d2b367a..39c5f87fe 100644 --- a/crates/vt_plan/src/error.rs +++ b/crates/vt_plan/src/error.rs @@ -172,12 +172,18 @@ pub enum Error { )] NoPackagesMatched { sources: Vec }, - #[error(transparent)] - RemoteCache(#[from] crate::remote_cache::RemoteCacheConfigError), - #[error("Invalid value for VP_RUN_CONCURRENCY_LIMIT: {0:?}")] InvalidConcurrencyLimitEnv(Arc), + #[error("Invalid value for VP_REMOTE_CACHE: {0:?}, expected off, read, or read-write")] + InvalidRemoteCacheModeEnv(Arc), + + #[error("Invalid value for VP_REMOTE_CACHE_URL: {0:?}")] + InvalidRemoteCacheUrlEnv(Arc), + + #[error("Remote caching requires cache.remote.url or VP_REMOTE_CACHE_URL")] + MissingRemoteCacheEndpoint, + /// A cycle was detected in the task dependency graph during planning. /// /// This is caught by `AcyclicGraph::try_from_graph`, which validates that the diff --git a/crates/vt_plan/src/plan.rs b/crates/vt_plan/src/plan.rs index d44f43eb9..99f59e47b 100644 --- a/crates/vt_plan/src/plan.rs +++ b/crates/vt_plan/src/plan.rs @@ -89,7 +89,6 @@ fn effective_cache_config( async fn plan_task_as_execution_node( task_node_index: TaskNodeIndex, mut context: PlanContext<'_>, - remote_cache: Option<&RemoteCacheConfig>, with_hooks: bool, ) -> Result { // Check for recursions in the task call stack. @@ -122,8 +121,7 @@ async fn plan_task_as_execution_node( // Extra args (e.g. `vt run test --coverage`) must not be forwarded to hooks. pre_context.set_extra_args(Arc::new([])); let pre_execution = - Box::pin(plan_task_as_execution_node(pre_hook_idx, pre_context, remote_cache, false)) - .await?; + Box::pin(plan_task_as_execution_node(pre_hook_idx, pre_context, false)).await?; items.extend(pre_execution.items); } @@ -308,7 +306,7 @@ async fn plan_task_as_execution_node( &cwd, package_path, parent_cache_config, - remote_cache, + context.remote_cache(), )?; ExecutionItemKind::Leaf(LeafExecutionKind::Spawn(spawn_execution)) } @@ -339,7 +337,7 @@ async fn plan_task_as_execution_node( Some(task_execution_cache_key), &and_item.envs, &resolved_options, - remote_cache, + context.remote_cache(), &script_command.envs, program_path, spawn_args, @@ -407,7 +405,7 @@ async fn plan_task_as_execution_node( }), &BTreeMap::new(), &resolved_options, - remote_cache, + context.remote_cache(), context.envs(), Arc::clone(&*SHELL_PROGRAM_PATH), SHELL_ARGS.iter().map(|s| Str::from(*s)).chain(std::iter::once(script)).collect(), @@ -430,8 +428,7 @@ async fn plan_task_as_execution_node( // Extra args must not be forwarded to hooks. post_context.set_extra_args(Arc::new([])); let post_execution = - Box::pin(plan_task_as_execution_node(post_hook_idx, post_context, remote_cache, false)) - .await?; + Box::pin(plan_task_as_execution_node(post_hook_idx, post_context, false)).await?; items.extend(post_execution.items); } @@ -698,9 +695,7 @@ fn plan_spawn_execution( input_config: cache_config.input_config.clone(), output_config: cache_config.output_config.clone(), remote_cache: if cache_config.remote_cache { remote_cache.cloned() } else { None }, - // Runner-aware env queries must not record the controls in the - // post-run fingerprint either. - unfiltered_envs: remote_cache::without_control_envs(envs), + unfiltered_envs: Arc::clone(envs), }); } } @@ -775,6 +770,7 @@ pub async fn plan_query_request( } let remote_cache = remote_cache::resolve(context.resolved_global_cache().remote_url.as_ref(), context.envs())?; + context.set_remote_cache(remote_cache); // Resolve effective concurrency for this level. // @@ -863,9 +859,7 @@ pub async fn plan_query_request( task_context.set_extra_args(Arc::clone(&empty_extra_args)); } let task_execution = - plan_task_as_execution_node(task_index, task_context, remote_cache.as_ref(), true) - .boxed_local() - .await?; + plan_task_as_execution_node(task_index, task_context, true).boxed_local().await?; execution_node_indices_by_task_index .insert(task_index, inner_graph.add_node(task_execution)); } diff --git a/crates/vt_plan/src/remote_cache.rs b/crates/vt_plan/src/remote_cache.rs index 62835bfa1..35c487f18 100644 --- a/crates/vt_plan/src/remote_cache.rs +++ b/crates/vt_plan/src/remote_cache.rs @@ -1,11 +1,12 @@ //! Remote cache settings resolved for each invocation during planning. -use std::{ffi::OsStr, str::FromStr, sync::Arc}; +use std::{ffi::OsStr, sync::Arc}; use rustc_hash::FxHashMap; use serde::Serialize; use vt_casefold::EnvName; -use vt_str::Str; + +use crate::Error; pub(crate) const MODE_ENV: &str = "VP_REMOTE_CACHE"; const URL_ENV: &str = "VP_REMOTE_CACHE_URL"; @@ -29,19 +30,6 @@ impl RemoteCacheMode { } } -impl FromStr for RemoteCacheMode { - type Err = RemoteCacheConfigError; - - fn from_str(value: &str) -> Result { - match value { - "off" => Ok(Self::Off), - "read" => Ok(Self::Read), - "read-write" => Ok(Self::ReadWrite), - _ => Err(RemoteCacheConfigError::InvalidMode(value.into())), - } - } -} - /// Remote endpoint and access mode for a cacheable execution. #[derive(Debug, Clone, Serialize)] pub struct RemoteCacheConfig { @@ -58,60 +46,42 @@ pub enum RemoteCacheAccess { ReadWrite, } -#[derive(Debug, thiserror::Error)] -pub enum RemoteCacheConfigError { - #[error("Invalid remote cache mode {0:?}: expected off, read, or read-write")] - InvalidMode(Str), - #[error("{0} must be valid Unicode")] - InvalidEnv(&'static str), - #[error("Remote caching requires cache.remote.url or VP_REMOTE_CACHE_URL")] - MissingEndpoint, -} - /// Whether `name` is one of the env vars that select remote cache access. -/// They pass through to tasks like other `VP_*` variables, but never enter a -/// cache fingerprint, so runs with different remote access share entries. +/// They pass through to tasks like other `VP_*` variables, but stay out of +/// fingerprinted envs, so runs with different remote access share entries. pub(crate) fn is_control_env + ?Sized>(name: &EnvName) -> bool { [MODE_ENV, URL_ENV].into_iter().any(|control| name == EnvName::from_ref(OsStr::new(control))) } -/// `envs` without the remote cache controls. -pub(crate) fn without_control_envs( - envs: &Arc>, Arc>>, -) -> Arc>, Arc>> { - if !envs.keys().any(is_control_env) { - return Arc::clone(envs); - } - Arc::new( - envs.iter() - .filter(|(name, _)| !is_control_env(name)) - .map(|(name, value)| (name.clone(), Arc::clone(value))) - .collect(), - ) -} - /// Reads a control env. An empty value counts as unset, like a CI secret that /// isn't available to the job. fn env_value<'a>( envs: &'a FxHashMap>, Arc>, - name: &'static str, -) -> Result, RemoteCacheConfigError> { - envs.get(EnvName::from_ref(OsStr::new(name))) - .filter(|value| !value.is_empty()) - .map(|value| value.to_str().ok_or(RemoteCacheConfigError::InvalidEnv(name))) - .transpose() + name: &str, +) -> Option<&'a Arc> { + envs.get(EnvName::from_ref(OsStr::new(name))).filter(|value| !value.is_empty()) } /// Resolve against this invocation's environment, including inherited overrides. pub(crate) fn resolve( configured_url: Option<&Arc>, envs: &FxHashMap>, Arc>, -) -> Result, RemoteCacheConfigError> { - let mode = env_value(envs, MODE_ENV)?.map(str::parse).transpose()?; - let url: Option> = env_value(envs, URL_ENV)? - .map(Arc::from) - .or_else(|| configured_url.cloned()) - .filter(|url| !url.is_empty()); +) -> Result, Error> { + let mode = match env_value(envs, MODE_ENV) { + None => None, + Some(value) => Some(match value.to_str() { + Some("off") => RemoteCacheMode::Off, + Some("read") => RemoteCacheMode::Read, + Some("read-write") => RemoteCacheMode::ReadWrite, + _ => return Err(Error::InvalidRemoteCacheModeEnv(Arc::clone(value))), + }), + }; + let url = match env_value(envs, URL_ENV) { + Some(value) => Some(Arc::::from( + value.to_str().ok_or_else(|| Error::InvalidRemoteCacheUrlEnv(Arc::clone(value)))?, + )), + None => configured_url.filter(|url| !url.is_empty()).cloned(), + }; match (mode, url) { (Some(RemoteCacheMode::Off), _) | (None, None) => Ok(None), @@ -122,7 +92,7 @@ pub(crate) fn resolve( Ok(Some(RemoteCacheConfig { url, mode: RemoteCacheAccess::ReadWrite })) } (Some(RemoteCacheMode::Read | RemoteCacheMode::ReadWrite), None) => { - Err(RemoteCacheConfigError::MissingEndpoint) + Err(Error::MissingRemoteCacheEndpoint) } } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_env_mode.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_env_mode.snap index 0a397532c..2dc74e0af 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_env_mode.snap +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_env_mode.snap @@ -1 +1 @@ -Invalid remote cache mode "invalid": expected off, read, or read-write \ No newline at end of file +Invalid value for VP_REMOTE_CACHE: "invalid", expected off, read, or read-write \ No newline at end of file From 4abfe0dc81d47d8eeaff816cd277c898c3e71a8a Mon Sep 17 00:00:00 2001 From: wan9chi Date: Fri, 25 Sep 2026 09:27:12 +0800 Subject: [PATCH 09/14] refactor(graph): clone the root cache config instead of taking it Leave each package's loaded config intact. Co-authored-by: Claude Opus 5.5 --- crates/vt_graph/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/vt_graph/src/lib.rs b/crates/vt_graph/src/lib.rs index 22a235ccb..7169a95b0 100644 --- a/crates/vt_graph/src/lib.rs +++ b/crates/vt_graph/src/lib.rs @@ -284,7 +284,7 @@ impl IndexedTaskGraph { let package_dir: Arc = workspace_root.path.join(&package.path).into(); let is_workspace_root = package.path.as_str().is_empty(); - let mut user_config = config_loader + let user_config = config_loader .load_user_config_file(&package_dir) .await .map_err(|error| TaskGraphLoadError::ConfigLoadError { @@ -293,9 +293,9 @@ impl IndexedTaskGraph { })? .unwrap_or_default(); - if let Some(cache) = user_config.cache.take() { + if let Some(cache) = &user_config.cache { if is_workspace_root { - root_cache = Some(cache); + root_cache = Some(cache.clone()); } else { return Err(TaskGraphLoadError::CacheInNonRootPackage { package_path: package_dir.clone(), From 26b8d6c9d8ed4e8cd0132b5d257e419296175b4e Mon Sep 17 00:00:00 2001 From: wan9chi Date: Fri, 25 Sep 2026 09:28:30 +0800 Subject: [PATCH 10/14] docs(config): list the other conditions for a task's remote cache Co-authored-by: Claude Opus 5.5 --- crates/vt_graph/run-config.ts | 7 +++++++ crates/vt_graph/src/config/user.rs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/crates/vt_graph/run-config.ts b/crates/vt_graph/run-config.ts index 2845c4bc0..b1d68ee16 100644 --- a/crates/vt_graph/run-config.ts +++ b/crates/vt_graph/run-config.ts @@ -96,6 +96,13 @@ input?: Array, output?: Array, /** * Whether this task can use the remote cache. Defaults to `true`. + * + * The remote cache is used only when these also hold: + * - Caching isn't turned off by `--no-cache` or the workspace root's `cache` setting. + * - An endpoint is set with `cache.remote.url` in the workspace root config or with + * `VP_REMOTE_CACHE_URL`. + * - Remote access isn't set to `off` with `--remote-cache` or `VP_REMOTE_CACHE`. It + * defaults to `read`, which downloads cached results without uploading new ones. */ remote?: boolean, }; diff --git a/crates/vt_graph/src/config/user.rs b/crates/vt_graph/src/config/user.rs index a7c8f8db5..a85d90ccc 100644 --- a/crates/vt_graph/src/config/user.rs +++ b/crates/vt_graph/src/config/user.rs @@ -233,6 +233,13 @@ pub struct EnabledCacheConfig { pub output: Option>, /// Whether this task can use the remote cache. Defaults to `true`. + /// + /// The remote cache is used only when these also hold: + /// - Caching isn't turned off by `--no-cache` or the workspace root's `cache` setting. + /// - An endpoint is set with `cache.remote.url` in the workspace root config or with + /// `VP_REMOTE_CACHE_URL`. + /// - Remote access isn't set to `off` with `--remote-cache` or `VP_REMOTE_CACHE`. It + /// defaults to `read`, which downloads cached results without uploading new ones. pub remote: Option, } From ee6319d3f30a6217d7d98300068589f12d539a33 Mon Sep 17 00:00:00 2001 From: wan9chi Date: Fri, 25 Sep 2026 09:41:26 +0800 Subject: [PATCH 11/14] docs(plan): explain how remote cache settings flow between `vp run` levels Co-authored-by: Claude Opus 5.5 --- crates/vt_plan/src/context.rs | 15 +++++++++++++-- crates/vt_plan/src/plan.rs | 6 ++++-- crates/vt_plan/src/remote_cache.rs | 3 ++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/crates/vt_plan/src/context.rs b/crates/vt_plan/src/context.rs index cf36a067e..83837fcee 100644 --- a/crates/vt_plan/src/context.rs +++ b/crates/vt_plan/src/context.rs @@ -52,8 +52,19 @@ pub struct PlanContext<'a> { /// Final resolved global cache config, combining the graph's config with any CLI override. resolved_global_cache: ResolvedGlobalCacheConfig, - /// Remote cache access for this invocation, resolved by `plan_query_request` - /// from the global cache config and the invocation's envs. + /// Remote cache access for the commands planned at this `vp run` level. + /// + /// `plan_query_request` resolves it at the start of each level from + /// `cache.remote.url` and the envs visible at that level, after writing the + /// level's `--remote-cache` flag to `VP_REMOTE_CACHE`. Those envs include the + /// process env, outer levels' flags, and prefixes on the command that + /// started the level, like `VP_REMOTE_CACHE=off vp run build`. Prefixes on + /// the level's own commands are added afterwards, so they reach the task + /// processes but don't change this value. + /// + /// Settings pass between levels only through envs. A nested level gets a + /// copy of this value through [`duplicate`](Self::duplicate), but replaces + /// it before any reads. remote_cache: Option, /// The query that caused the current expansion. diff --git a/crates/vt_plan/src/plan.rs b/crates/vt_plan/src/plan.rs index 99f59e47b..dc2216acd 100644 --- a/crates/vt_plan/src/plan.rs +++ b/crates/vt_plan/src/plan.rs @@ -763,8 +763,10 @@ pub async fn plan_query_request( ); context.set_resolved_global_cache(final_cache); } - // Inherit explicit choices through the environment. Leave defaults unset so - // each invocation can choose its default using the endpoint available to it. + // Resolve `context.remote_cache` for this level (see its doc for the data + // flow). Write this level's `--remote-cache` flag to `VP_REMOTE_CACHE` first, + // so it overrides inherited values and nested levels inherit it. Leave the + // default unset so each level picks its own from the endpoint it sees. if let Some(mode) = plan_options.remote_cache { context.add_envs(std::iter::once((remote_cache::MODE_ENV, mode.as_str()))); } diff --git a/crates/vt_plan/src/remote_cache.rs b/crates/vt_plan/src/remote_cache.rs index 35c487f18..31447c801 100644 --- a/crates/vt_plan/src/remote_cache.rs +++ b/crates/vt_plan/src/remote_cache.rs @@ -62,7 +62,8 @@ fn env_value<'a>( envs.get(EnvName::from_ref(OsStr::new(name))).filter(|value| !value.is_empty()) } -/// Resolve against this invocation's environment, including inherited overrides. +/// Resolves remote cache access for one `vp run` level from the envs visible at +/// that level. See `PlanContext::remote_cache` for what they include. pub(crate) fn resolve( configured_url: Option<&Arc>, envs: &FxHashMap>, Arc>, From 20df2f1074dff16d50e9fc3ccec71a4c97727179 Mon Sep 17 00:00:00 2001 From: wan9chi Date: Fri, 25 Sep 2026 09:45:42 +0800 Subject: [PATCH 12/14] fix(cache): fingerprint remote cache controls like other envs `VP_REMOTE_CACHE` and `VP_REMOTE_CACHE_URL` follow the task's `env` and `untrackedEnv` settings, and command prefixes, like any other variable. By default they pass through untracked with other `VP_*` variables, so runs with different remote access still share cache entries. Co-authored-by: Claude Opus 5.5 --- crates/vt_plan/src/envs.rs | 31 +------------------ crates/vt_plan/src/plan.rs | 3 -- crates/vt_plan/src/remote_cache.rs | 17 +--------- .../remote_cache_config/snapshots.toml | 4 +-- ...query_controls_in_env_fingerprinted.jsonc} | 7 +++-- ...query_prefix_controls_fingerprinted.jsonc} | 5 ++- .../snapshots/task_graph.md | 7 +---- .../remote_cache_config/vite-task.json | 8 ++--- 8 files changed, 15 insertions(+), 67 deletions(-) rename crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/{query_controls_untracked.jsonc => query_controls_in_env_fingerprinted.jsonc} (77%) rename crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/{query_prefix_controls_untracked.jsonc => query_prefix_controls_fingerprinted.jsonc} (76%) diff --git a/crates/vt_plan/src/envs.rs b/crates/vt_plan/src/envs.rs index 2a47ec17e..336540d3a 100644 --- a/crates/vt_plan/src/envs.rs +++ b/crates/vt_plan/src/envs.rs @@ -134,10 +134,7 @@ impl EnvFingerprints { let Some(name) = name.inner().to_str() else { continue; }; - // Matching controls still reach the task, just untracked. - if !fingerprinted_env_patterns.is_match(name) - || crate::remote_cache::is_control_env(EnvName::from_ref(name)) - { + if !fingerprinted_env_patterns.is_match(name) { continue; } let Some(value) = value.to_str() else { @@ -286,32 +283,6 @@ mod tests { } } - #[test] - fn test_remote_cache_controls_are_not_fingerprinted() { - // Controls pass through when a pattern matches them, but never enter - // the fingerprint. On Windows the lowercase spellings are the same - // variables. - let mut envs = create_test_envs(vec![ - ("VP_REMOTE_CACHE", "read-write"), - ("vp_remote_cache_url", "https://cache.example"), - ("OTHER", "value"), - ]); - let env_config = create_env_config(&["*"], &[]); - - let result = EnvFingerprints::resolve(&mut envs, &env_config).unwrap(); - - assert!(envs.contains_key(EnvName::from_ref(OsStr::new("VP_REMOTE_CACHE")))); - assert!(envs.contains_key(EnvName::from_ref(OsStr::new("vp_remote_cache_url")))); - let mut fingerprinted: Vec<&str> = - result.fingerprinted_envs.keys().map(Str::as_str).collect(); - fingerprinted.sort_unstable(); - if cfg!(windows) { - assert_eq!(fingerprinted, ["FORCE_COLOR", "OTHER"]); - } else { - assert_eq!(fingerprinted, ["FORCE_COLOR", "OTHER", "vp_remote_cache_url"]); - } - } - #[test] fn test_force_color_fallback_fingerprinted_when_opted_in_but_parent_absent() { // User opts in to `FORCE_COLOR` as fingerprinted, but parent has no diff --git a/crates/vt_plan/src/plan.rs b/crates/vt_plan/src/plan.rs index dc2216acd..2a8f52f24 100644 --- a/crates/vt_plan/src/plan.rs +++ b/crates/vt_plan/src/plan.rs @@ -640,9 +640,6 @@ fn plan_spawn_execution( // differently, like `foo` for `Foo=1` on Windows. let fingerprinted_envs = &mut env_fingerprints.fingerprinted_envs; for (name, value) in prefix_envs { - if remote_cache::is_control_env(name) { - continue; - } fingerprinted_envs.retain(|existing, _| EnvName::from_ref(existing) != name); fingerprinted_envs.insert(name.inner().clone(), EnvValueHash::new(value.as_str())); } diff --git a/crates/vt_plan/src/remote_cache.rs b/crates/vt_plan/src/remote_cache.rs index 31447c801..4940dcb61 100644 --- a/crates/vt_plan/src/remote_cache.rs +++ b/crates/vt_plan/src/remote_cache.rs @@ -46,13 +46,6 @@ pub enum RemoteCacheAccess { ReadWrite, } -/// Whether `name` is one of the env vars that select remote cache access. -/// They pass through to tasks like other `VP_*` variables, but stay out of -/// fingerprinted envs, so runs with different remote access share entries. -pub(crate) fn is_control_env + ?Sized>(name: &EnvName) -> bool { - [MODE_ENV, URL_ENV].into_iter().any(|control| name == EnvName::from_ref(OsStr::new(control))) -} - /// Reads a control env. An empty value counts as unset, like a CI secret that /// isn't available to the job. fn env_value<'a>( @@ -103,15 +96,7 @@ mod tests { use super::*; #[test] - fn controls_match_env_names_by_platform_rules() { - for name in ["VP_REMOTE_CACHE", "VP_REMOTE_CACHE_URL"] { - assert!(is_control_env(EnvName::from_ref(name))); - } - for name in ["vp_remote_cache", "Vp_Remote_Cache_Url"] { - assert_eq!(is_control_env(EnvName::from_ref(name)), cfg!(windows), "{name}"); - } - assert!(!is_control_env(EnvName::from_ref("VP_REMOTE_CACHE_TOKEN"))); - + fn reads_envs_by_platform_name_rules() { let envs = [("vp_remote_cache", "read-write"), ("vp_remote_cache_url", "https://cache.example")] .into_iter() diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml index 35ee330d4..bf023f6b1 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml @@ -41,12 +41,12 @@ args = ["run", "build"] env = { "VP_REMOTE_CACHE_URL" = "" } [[plan]] -name = "controls_untracked" +name = "controls_in_env_fingerprinted" args = ["run", "tracked-controls"] env = { "VP_REMOTE_CACHE" = "read-write", "VP_REMOTE_CACHE_URL" = "https://other.example/projects/test" } [[plan]] -name = "prefix_controls_untracked" +name = "prefix_controls_fingerprinted" args = ["run", "prefix"] [[plan]] diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_untracked.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_in_env_fingerprinted.jsonc similarity index 77% rename from crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_untracked.jsonc rename to crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_in_env_fingerprinted.jsonc index ccdebb77a..0bc9b3b20 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_untracked.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_in_env_fingerprinted.jsonc @@ -15,10 +15,11 @@ "cache_metadata": { "spawn_fingerprint": { "env_fingerprints": { - "fingerprinted_envs": {}, + "fingerprinted_envs": { + "VP_REMOTE_CACHE": "sha256:e12ba4f30a4148691508e0280768a94d1885322da87a394e6768e7809dd7ec95", + "VP_REMOTE_CACHE_URL": "sha256:80df658e142dadcbb87d5e16ed4733a5391f6e540c6ed00b7f64623af0c5bc4a" + }, "untracked_env_config": [ - "VP_REMOTE_CACHE", - "VP_REMOTE_CACHE_URL", "" ] } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_untracked.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_fingerprinted.jsonc similarity index 76% rename from crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_untracked.jsonc rename to crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_fingerprinted.jsonc index a1d35524c..2e05021d7 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_untracked.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_fingerprinted.jsonc @@ -15,7 +15,10 @@ "cache_metadata": { "spawn_fingerprint": { "env_fingerprints": { - "fingerprinted_envs": {}, + "fingerprinted_envs": { + "VP_REMOTE_CACHE": "sha256:b4dc66dde806261bdda8607d8707aa727d308cd80272381a5583f63899918467", + "VP_REMOTE_CACHE_URL": "sha256:eb8aeaa7d6dcc18abb2804c93fb01cd25864d4d5a62cff2bd38f95232a68928c" + }, "untracked_env_config": [ "" ] diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md index 208ad0750..4233b944b 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md @@ -32,10 +32,7 @@ flowchart TD "cache_config": { "remote_cache": true, "env_config": { - "fingerprinted_envs": [ - "!PATH", - "*" - ], + "fingerprinted_envs": [], "untracked_env": [ "" ] @@ -400,8 +397,6 @@ flowchart TD "VP_REMOTE_CACHE_URL" ], "untracked_env": [ - "VP_REMOTE_CACHE", - "VP_REMOTE_CACHE_URL", "" ] }, diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json index 98410afeb..150a0c9d8 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/vite-task.json @@ -8,10 +8,7 @@ "tasks": { "build": { "command": "vtt print-file package.json", - "cache": { - "env": ["*", "!PATH"], - "remote": true - } + "cache": { "remote": true } }, "local-only": { "command": "vtt print-file package.json", @@ -24,8 +21,7 @@ "tracked-controls": { "command": "vtt print-file package.json", "cache": { - "env": ["VP_REMOTE_CACHE", "VP_REMOTE_CACHE_URL"], - "untrackedEnv": ["VP_REMOTE_CACHE", "VP_REMOTE_CACHE_URL"] + "env": ["VP_REMOTE_CACHE", "VP_REMOTE_CACHE_URL"] } } } From c2aa08435bed3b2b8c7aa4e3294ebe46b9a400a4 Mon Sep 17 00:00:00 2001 From: wan9chi Date: Fri, 25 Sep 2026 09:52:37 +0800 Subject: [PATCH 13/14] refactor(cache): name remote cache values by where they come from - `PlanOptions.remote_cache_mode`: the `--remote-cache` flag. - `ResolvedRemoteCacheConfig` with `access`: resolved for a `vp run` level. - `PlanContext::resolved_remote_cache`: the level's resolved value. - `CacheConfig.remote_cache_allowed`: the task's `cache.remote`. Co-authored-by: Claude Opus 5.5 --- crates/vt/src/cli/mod.rs | 4 +- crates/vt/src/session/mod.rs | 2 +- crates/vt_graph/src/config/mod.rs | 7 +-- crates/vt_graph/src/config/user.rs | 3 +- crates/vt_plan/src/cache_metadata.rs | 7 +-- crates/vt_plan/src/context.rs | 18 ++++---- crates/vt_plan/src/plan.rs | 41 +++++++++-------- crates/vt_plan/src/plan_request.rs | 5 +- crates/vt_plan/src/remote_cache.rs | 25 +++++----- .../additional_env/snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 8 ++-- .../snapshots/task_graph.md | 8 ++-- .../cache_keys/snapshots/task_graph.md | 8 ++-- .../snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 6 +-- .../cache_sharing/snapshots/task_graph.md | 6 +-- .../cache_subcommand/snapshots/task_graph.md | 2 +- .../snapshots/task_graph.md | 6 +-- .../snapshots/task_graph.md | 4 +- .../cd_in_scripts/snapshots/task_graph.md | 6 +-- .../snapshots/task_graph.md | 46 +++++++++---------- .../conflict_test/snapshots/task_graph.md | 6 +-- .../cycle_dependency/snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 16 +++---- .../snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 20 ++++---- .../snapshots/task_graph.md | 4 +- .../filter_workspace/snapshots/task_graph.md | 26 +++++------ .../snapshots/task_graph.md | 2 +- .../snapshots/task_graph.md | 2 +- .../snapshots/task_graph.md | 8 ++-- .../nested_tasks/snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 6 +-- .../snapshots/task_graph.md | 20 ++++---- .../snapshots/task_graph.md | 2 +- .../snapshots/task_graph.md | 10 ++-- .../snapshots/task_graph.md | 2 +- .../snapshots/task_graph.md | 2 +- .../snapshots/task_graph.md | 16 +++---- .../query_cli_overrides_invalid_env.jsonc | 2 +- .../query_controls_in_env_fingerprinted.jsonc | 2 +- .../snapshots/query_default_read.jsonc | 2 +- ...query_empty_env_endpoint_uses_config.jsonc | 2 +- .../query_nested_cli_overrides_env.jsonc | 2 +- .../query_prefix_controls_fingerprinted.jsonc | 2 +- .../query_sibling_endpoint_isolation.jsonc | 4 +- .../query_sibling_mode_isolation.jsonc | 2 +- .../snapshots/task_graph.md | 20 ++++---- .../query_endpoint_not_validated.jsonc | 2 +- .../query_nested_endpoint_enables_read.jsonc | 2 +- .../snapshots/task_graph.md | 4 +- .../script_hooks/snapshots/task_graph.md | 12 ++--- .../snapshots/task_graph.md | 6 +-- .../snapshots/task_graph.md | 8 ++-- .../snapshots/task_graph.md | 4 +- .../shell_fallback/snapshots/task_graph.md | 2 +- .../snapshots/task_graph.md | 10 ++-- .../snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 14 +++--- .../snapshots/task_graph.md | 6 +-- .../vpr_shorthand/snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 8 ++-- .../snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 8 ++-- .../snapshots/task_graph.md | 4 +- .../snapshots/task_graph.md | 6 +-- crates/vt_plan/tests/snapshot_fields.rs | 2 +- 71 files changed, 276 insertions(+), 262 deletions(-) diff --git a/crates/vt/src/cli/mod.rs b/crates/vt/src/cli/mod.rs index 2d07fa1c7..6e050f964 100644 --- a/crates/vt/src/cli/mod.rs +++ b/crates/vt/src/cli/mod.rs @@ -19,7 +19,7 @@ pub enum LogMode { Grouped, } -/// Remote cache access selected on the command line. +/// Remote cache mode selected with `--remote-cache`. #[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)] pub enum RemoteCacheMode { /// Remote caching is disabled. @@ -261,7 +261,7 @@ impl ResolvedRunCommand { plan_options: PlanOptions { extra_args: self.additional_args.into(), cache_override, - remote_cache: self.flags.remote_cache.map(Into::into), + remote_cache_mode: self.flags.remote_cache.map(Into::into), concurrency_limit, parallel, fail_if_no_match, diff --git a/crates/vt/src/session/mod.rs b/crates/vt/src/session/mod.rs index 23b63305b..6ec70e3e3 100644 --- a/crates/vt/src/session/mod.rs +++ b/crates/vt/src/session/mod.rs @@ -582,7 +582,7 @@ impl<'a> Session<'a> { plan_options: PlanOptions { extra_args: run_command.additional_args.clone().into(), cache_override: run_command.flags.cache_override(), - remote_cache: run_command.flags.remote_cache.map(Into::into), + remote_cache_mode: run_command.flags.remote_cache.map(Into::into), concurrency_limit: None, parallel: false, // The selector path runs whatever the user picked interactively; diff --git a/crates/vt_graph/src/config/mod.rs b/crates/vt_graph/src/config/mod.rs index 640d30f9b..967ef82a1 100644 --- a/crates/vt_graph/src/config/mod.rs +++ b/crates/vt_graph/src/config/mod.rs @@ -82,7 +82,7 @@ impl ResolvedTaskOptions { )?; Some(CacheConfig { - remote_cache: enabled_cache_config.remote.unwrap_or(true), + remote_cache_allowed: enabled_cache_config.remote.unwrap_or(true), env_config: EnvConfig { fingerprinted_envs: enabled_cache_config .env @@ -101,8 +101,9 @@ impl ResolvedTaskOptions { #[derive(Debug, Clone, Serialize)] pub struct CacheConfig { - /// Whether this task permits remote caching when local caching is enabled. - pub remote_cache: bool, + /// Whether the task's `cache.remote` allows remote caching. An execution uses + /// the remote cache only if its `vp run` level also resolves one. + pub remote_cache_allowed: bool, pub env_config: EnvConfig, pub input_config: ResolvedGlobConfig, pub output_config: ResolvedGlobConfig, diff --git a/crates/vt_graph/src/config/user.rs b/crates/vt_graph/src/config/user.rs index a85d90ccc..0564a97eb 100644 --- a/crates/vt_graph/src/config/user.rs +++ b/crates/vt_graph/src/config/user.rs @@ -377,7 +377,8 @@ pub enum UserGlobalCacheConfig { pub struct ResolvedGlobalCacheConfig { pub scripts: bool, pub tasks: bool, - /// Remote cache endpoint from `cache.remote.url`, if configured. + /// Remote cache endpoint from `cache.remote.url`, if configured. Planning + /// uses `VP_REMOTE_CACHE_URL` instead when it's set. pub remote_url: Option>, } diff --git a/crates/vt_plan/src/cache_metadata.rs b/crates/vt_plan/src/cache_metadata.rs index 0071ed595..d544e78f1 100644 --- a/crates/vt_plan/src/cache_metadata.rs +++ b/crates/vt_plan/src/cache_metadata.rs @@ -9,7 +9,7 @@ use vt_str::{self, Str}; use wincode::{SchemaRead, SchemaWrite}; pub use crate::envs::EnvValueHash; -use crate::{envs::EnvFingerprints, remote_cache::RemoteCacheConfig}; +use crate::{envs::EnvFingerprints, remote_cache::ResolvedRemoteCacheConfig}; /// Key to identify an execution across sessions. #[derive(Debug, SchemaWrite, SchemaRead, Serialize)] @@ -55,8 +55,9 @@ pub struct CacheMetadata { /// Used at execution time to determine what output files to archive. pub output_config: ResolvedGlobConfig, - /// Remote cache access. `None` means local caching only. - pub remote_cache: Option, + /// Remote cache for this execution: the one resolved for its `vp run` level, + /// unless the task sets `cache.remote: false`. `None` means local caching only. + pub remote_cache: Option, /// The unfiltered env context for runner-aware APIs. This is the planning /// context's envs before spawn-env filtering, including command prefix envs diff --git a/crates/vt_plan/src/context.rs b/crates/vt_plan/src/context.rs index 83837fcee..f6c4526eb 100644 --- a/crates/vt_plan/src/context.rs +++ b/crates/vt_plan/src/context.rs @@ -8,7 +8,9 @@ use vt_graph::{ use vt_path::AbsolutePath; use vt_str::Str; -use crate::{PlanRequestParser, path_env::prepend_path_env, remote_cache::RemoteCacheConfig}; +use crate::{ + PlanRequestParser, path_env::prepend_path_env, remote_cache::ResolvedRemoteCacheConfig, +}; #[derive(Debug, thiserror::Error)] #[error( @@ -65,7 +67,7 @@ pub struct PlanContext<'a> { /// Settings pass between levels only through envs. A nested level gets a /// copy of this value through [`duplicate`](Self::duplicate), but replaces /// it before any reads. - remote_cache: Option, + resolved_remote_cache: Option, /// The query that caused the current expansion. /// Used by the skip rule to detect and skip duplicate nested expansions. @@ -91,7 +93,7 @@ impl<'a> PlanContext<'a> { indexed_task_graph, extra_args: Arc::default(), resolved_global_cache, - remote_cache: None, + resolved_remote_cache: None, parent_query, } } @@ -166,12 +168,12 @@ impl<'a> PlanContext<'a> { self.resolved_global_cache = config; } - pub const fn remote_cache(&self) -> Option<&RemoteCacheConfig> { - self.remote_cache.as_ref() + pub const fn resolved_remote_cache(&self) -> Option<&ResolvedRemoteCacheConfig> { + self.resolved_remote_cache.as_ref() } - pub fn set_remote_cache(&mut self, remote_cache: Option) { - self.remote_cache = remote_cache; + pub fn set_resolved_remote_cache(&mut self, config: Option) { + self.resolved_remote_cache = config; } pub fn parent_query(&self) -> &TaskQuery { @@ -198,7 +200,7 @@ impl<'a> PlanContext<'a> { indexed_task_graph: self.indexed_task_graph, extra_args: Arc::clone(&self.extra_args), resolved_global_cache: self.resolved_global_cache.clone(), - remote_cache: self.remote_cache.clone(), + resolved_remote_cache: self.resolved_remote_cache.clone(), parent_query: Arc::clone(&self.parent_query), } } diff --git a/crates/vt_plan/src/plan.rs b/crates/vt_plan/src/plan.rs index 2a8f52f24..c76ba93f8 100644 --- a/crates/vt_plan/src/plan.rs +++ b/crates/vt_plan/src/plan.rs @@ -41,7 +41,7 @@ use crate::{ CacheOverride, PlanOptions, PlanRequest, QueryPlanRequest, ScriptCommand, SyntheticPlanRequest, }, - remote_cache::{self, RemoteCacheConfig}, + remote_cache::{self, ResolvedRemoteCacheConfig}, resolve_cache_with_override, }; @@ -306,7 +306,7 @@ async fn plan_task_as_execution_node( &cwd, package_path, parent_cache_config, - context.remote_cache(), + context.resolved_remote_cache(), )?; ExecutionItemKind::Leaf(LeafExecutionKind::Spawn(spawn_execution)) } @@ -337,7 +337,7 @@ async fn plan_task_as_execution_node( Some(task_execution_cache_key), &and_item.envs, &resolved_options, - context.remote_cache(), + context.resolved_remote_cache(), &script_command.envs, program_path, spawn_args, @@ -405,7 +405,7 @@ async fn plan_task_as_execution_node( }), &BTreeMap::new(), &resolved_options, - context.remote_cache(), + context.resolved_remote_cache(), context.envs(), Arc::clone(&*SHELL_PROGRAM_PATH), SHELL_ARGS.iter().map(|s| Str::from(*s)).chain(std::iter::once(script)).collect(), @@ -496,7 +496,7 @@ fn resolve_synthetic_cache_config( Some(enabled_cache_config) => { let EnabledCacheConfig { env, untracked_env, input, output, remote } = enabled_cache_config; - parent_config.remote_cache &= remote.unwrap_or(true); + parent_config.remote_cache_allowed &= remote.unwrap_or(true); parent_config.env_config.fingerprinted_envs.extend(env.unwrap_or_default()); parent_config .env_config @@ -559,7 +559,7 @@ pub fn plan_synthetic_request( cwd: &Arc, package_dir: &AbsolutePath, parent_cache_config: ParentCacheConfig, - remote_cache: Option<&RemoteCacheConfig>, + resolved_remote_cache: Option<&ResolvedRemoteCacheConfig>, ) -> Result { let SyntheticPlanRequest { program, args, cache_config, envs } = synthetic_plan_request; @@ -580,7 +580,7 @@ pub fn plan_synthetic_request( execution_cache_key, prefix_envs, &resolved_options, - remote_cache, + resolved_remote_cache, &envs, program_path, args, @@ -617,7 +617,7 @@ fn plan_spawn_execution( execution_cache_key: Option, prefix_envs: &BTreeMap, Str>, resolved_task_options: &ResolvedTaskOptions, - remote_cache: Option<&RemoteCacheConfig>, + resolved_remote_cache: Option<&ResolvedRemoteCacheConfig>, envs: &Arc>, Arc>>, program_path: Arc, args: Arc<[Str]>, @@ -691,7 +691,11 @@ fn plan_spawn_execution( execution_cache_key, input_config: cache_config.input_config.clone(), output_config: cache_config.output_config.clone(), - remote_cache: if cache_config.remote_cache { remote_cache.cloned() } else { None }, + remote_cache: if cache_config.remote_cache_allowed { + resolved_remote_cache.cloned() + } else { + None + }, unfiltered_envs: Arc::clone(envs), }); } @@ -760,16 +764,17 @@ pub async fn plan_query_request( ); context.set_resolved_global_cache(final_cache); } - // Resolve `context.remote_cache` for this level (see its doc for the data - // flow). Write this level's `--remote-cache` flag to `VP_REMOTE_CACHE` first, - // so it overrides inherited values and nested levels inherit it. Leave the - // default unset so each level picks its own from the endpoint it sees. - if let Some(mode) = plan_options.remote_cache { + // Resolve `context.resolved_remote_cache` for this level (see its doc for + // the data flow). Write this level's `--remote-cache` flag to + // `VP_REMOTE_CACHE` first, so it overrides inherited values and nested + // levels inherit it. Leave the default unset so each level picks its own + // from the endpoint it sees. + if let Some(mode) = plan_options.remote_cache_mode { context.add_envs(std::iter::once((remote_cache::MODE_ENV, mode.as_str()))); } - let remote_cache = + let resolved_remote_cache = remote_cache::resolve(context.resolved_global_cache().remote_url.as_ref(), context.envs())?; - context.set_remote_cache(remote_cache); + context.set_resolved_remote_cache(resolved_remote_cache); // Resolve effective concurrency for this level. // @@ -974,7 +979,7 @@ mod tests { fn parent_config(includes_auto: bool, positive_globs: &[&str]) -> CacheConfig { CacheConfig { - remote_cache: true, + remote_cache_allowed: true, env_config: EnvConfig { fingerprinted_envs: FxHashSet::default(), untracked_env: FxHashSet::default(), @@ -1175,7 +1180,7 @@ mod tests { ) .unwrap() .unwrap(); - assert!(!result.remote_cache); + assert!(!result.remote_cache_allowed); } #[test] diff --git a/crates/vt_plan/src/plan_request.rs b/crates/vt_plan/src/plan_request.rs index ed5060c1c..dd876555d 100644 --- a/crates/vt_plan/src/plan_request.rs +++ b/crates/vt_plan/src/plan_request.rs @@ -50,8 +50,9 @@ pub enum CacheOverride { pub struct PlanOptions { pub extra_args: Arc<[Str]>, pub cache_override: CacheOverride, - /// Remote mode for this invocation. None inherits the planning environment. - pub remote_cache: Option, + /// This level's `--remote-cache` flag. `None` when the flag isn't passed, + /// leaving `VP_REMOTE_CACHE` from the envs to select the mode. + pub remote_cache_mode: Option, /// Per-level concurrency limit. `None` means inherit from the parent level /// (or default to [`crate::DEFAULT_CONCURRENCY_LIMIT`] at the root). pub concurrency_limit: Option, diff --git a/crates/vt_plan/src/remote_cache.rs b/crates/vt_plan/src/remote_cache.rs index 4940dcb61..d02a78808 100644 --- a/crates/vt_plan/src/remote_cache.rs +++ b/crates/vt_plan/src/remote_cache.rs @@ -1,4 +1,5 @@ -//! Remote cache settings resolved for each invocation during planning. +//! Remote cache settings: the mode requested with `--remote-cache` or +//! `VP_REMOTE_CACHE`, and the access resolved from it for each `vp run` level. use std::{ffi::OsStr, sync::Arc}; @@ -11,7 +12,8 @@ use crate::Error; pub(crate) const MODE_ENV: &str = "VP_REMOTE_CACHE"; const URL_ENV: &str = "VP_REMOTE_CACHE_URL"; -/// Remote access requested by an invocation. Local cache policy is independent. +/// Remote cache mode requested with `--remote-cache` or `VP_REMOTE_CACHE`. +/// `resolve` combines it with the endpoint into a [`ResolvedRemoteCacheConfig`]. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] #[serde(rename_all = "kebab-case")] pub enum RemoteCacheMode { @@ -30,15 +32,16 @@ impl RemoteCacheMode { } } -/// Remote endpoint and access mode for a cacheable execution. +/// Remote cache access and endpoint resolved for a `vp run` level from the +/// requested mode, `VP_REMOTE_CACHE_URL`, and `cache.remote.url`. #[derive(Debug, Clone, Serialize)] -pub struct RemoteCacheConfig { - pub mode: RemoteCacheAccess, +pub struct ResolvedRemoteCacheConfig { + pub access: RemoteCacheAccess, /// Endpoint as configured. It is validated when the remote cache is used. pub url: Arc, } -/// Access permitted when remote caching is enabled. +/// Remote cache access after resolution. `off` resolves to no remote cache. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] #[serde(rename_all = "kebab-case")] pub enum RemoteCacheAccess { @@ -56,11 +59,11 @@ fn env_value<'a>( } /// Resolves remote cache access for one `vp run` level from the envs visible at -/// that level. See `PlanContext::remote_cache` for what they include. +/// that level. See `PlanContext::resolved_remote_cache` for what they include. pub(crate) fn resolve( configured_url: Option<&Arc>, envs: &FxHashMap>, Arc>, -) -> Result, Error> { +) -> Result, Error> { let mode = match env_value(envs, MODE_ENV) { None => None, Some(value) => Some(match value.to_str() { @@ -80,10 +83,10 @@ pub(crate) fn resolve( match (mode, url) { (Some(RemoteCacheMode::Off), _) | (None, None) => Ok(None), (Some(RemoteCacheMode::Read) | None, Some(url)) => { - Ok(Some(RemoteCacheConfig { url, mode: RemoteCacheAccess::Read })) + Ok(Some(ResolvedRemoteCacheConfig { access: RemoteCacheAccess::Read, url })) } (Some(RemoteCacheMode::ReadWrite), Some(url)) => { - Ok(Some(RemoteCacheConfig { url, mode: RemoteCacheAccess::ReadWrite })) + Ok(Some(ResolvedRemoteCacheConfig { access: RemoteCacheAccess::ReadWrite, url })) } (Some(RemoteCacheMode::Read | RemoteCacheMode::ReadWrite), None) => { Err(Error::MissingRemoteCacheEndpoint) @@ -110,7 +113,7 @@ mod tests { let resolved = resolve(None, &envs).unwrap(); if cfg!(windows) { let resolved = resolved.unwrap(); - assert_eq!(resolved.mode, RemoteCacheAccess::ReadWrite); + assert_eq!(resolved.access, RemoteCacheAccess::ReadWrite); assert_eq!(&*resolved.url, "https://cache.example"); } else { assert!(resolved.is_none()); diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/additional_env/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/additional_env/snapshots/task_graph.md index dd1de35d9..4ecb373ed 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/additional_env/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/additional_env/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_cli_override/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_cli_override/snapshots/task_graph.md index 134cbbe5f..512da2f2f 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_cli_override/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_cli_override/snapshots/task_graph.md @@ -25,7 +25,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -65,7 +65,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -127,7 +127,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -167,7 +167,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_config_forms/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_config_forms/snapshots/task_graph.md index 370898cf0..f132ba7e7 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_config_forms/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_config_forms/snapshots/task_graph.md @@ -25,7 +25,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -87,7 +87,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [ "MY_ENV" @@ -136,7 +136,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -176,7 +176,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_keys/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_keys/snapshots/task_graph.md index 75291a957..80bae33ee 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_keys/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_keys/snapshots/task_graph.md @@ -24,7 +24,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -64,7 +64,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -104,7 +104,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -144,7 +144,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_default/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_default/snapshots/task_graph.md index fbee1e5a6..6410e19de 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_default/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_default/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_enabled/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_enabled/snapshots/task_graph.md index 3b34d3411..7a97e8f48 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_enabled/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_enabled/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_task_override/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_task_override/snapshots/task_graph.md index bd4680125..b78448b99 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_task_override/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_scripts_task_override/snapshots/task_graph.md @@ -23,7 +23,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -63,7 +63,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -103,7 +103,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_sharing/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_sharing/snapshots/task_graph.md index 3fd3c274a..05e680687 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_sharing/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_sharing/snapshots/task_graph.md @@ -23,7 +23,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -63,7 +63,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -103,7 +103,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_subcommand/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_subcommand/snapshots/task_graph.md index 3e4bddb7a..276653f1f 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_subcommand/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_subcommand/snapshots/task_graph.md @@ -21,7 +21,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_tasks_disabled/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_tasks_disabled/snapshots/task_graph.md index 03706fff6..fb449cc1e 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_tasks_disabled/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_tasks_disabled/snapshots/task_graph.md @@ -23,7 +23,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -63,7 +63,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -103,7 +103,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_true_no_force_enable/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_true_no_force_enable/snapshots/task_graph.md index e6b4c1061..013228324 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cache_true_no_force_enable/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cache_true_no_force_enable/snapshots/task_graph.md @@ -45,7 +45,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -85,7 +85,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cd_in_scripts/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cd_in_scripts/snapshots/task_graph.md index 79c3c2eeb..38a31e0aa 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cd_in_scripts/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cd_in_scripts/snapshots/task_graph.md @@ -23,7 +23,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -63,7 +63,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -103,7 +103,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/comprehensive_task_graph/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/comprehensive_task_graph/snapshots/task_graph.md index e918344da..bd77a19c1 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/comprehensive_task_graph/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/comprehensive_task_graph/snapshots/task_graph.md @@ -43,7 +43,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/api", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -83,7 +83,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/api", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -123,7 +123,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/api", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -163,7 +163,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/api", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -203,7 +203,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -243,7 +243,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -283,7 +283,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -323,7 +323,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -363,7 +363,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -403,7 +403,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/config", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -443,7 +443,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/config", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -483,7 +483,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/pkg#special", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -523,7 +523,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/pkg#special", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -563,7 +563,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/shared", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -603,7 +603,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/shared", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -643,7 +643,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/shared", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -683,7 +683,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/shared", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -723,7 +723,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/tools", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -763,7 +763,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/tools", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -803,7 +803,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/ui", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -843,7 +843,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/ui", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -883,7 +883,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/ui", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -923,7 +923,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/ui", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/conflict_test/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/conflict_test/snapshots/task_graph.md index 438080f2e..ae8c28f1e 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/conflict_test/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/conflict_test/snapshots/task_graph.md @@ -24,7 +24,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/scope-a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -64,7 +64,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/scope-a-b", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -104,7 +104,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/test-package", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/cycle_dependency/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/cycle_dependency/snapshots/task_graph.md index 663563d0c..8a1963a7b 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/cycle_dependency/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/cycle_dependency/snapshots/task_graph.md @@ -24,7 +24,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -64,7 +64,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/dependency_both_topo_and_explicit/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/dependency_both_topo_and_explicit/snapshots/task_graph.md index ce5aa047b..3d286a163 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/dependency_both_topo_and_explicit/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/dependency_both_topo_and_explicit/snapshots/task_graph.md @@ -23,7 +23,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -63,7 +63,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/b", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/duplicate_package_names/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/duplicate_package_names/snapshots/task_graph.md index 6ce5942d4..b1fac46d5 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/duplicate_package_names/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/duplicate_package_names/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/pkg-a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/pkg-b", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/empty_package_test/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/empty_package_test/snapshots/task_graph.md index 9ea4b56af..7439fe3de 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/empty_package_test/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/empty_package_test/snapshots/task_graph.md @@ -34,7 +34,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/another-empty", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -96,7 +96,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/another-empty", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -136,7 +136,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/another-empty", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -176,7 +176,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/empty-name", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -216,7 +216,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/empty-name", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -256,7 +256,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/empty-name", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -296,7 +296,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/normal-package", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -336,7 +336,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/normal-package", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/env_name_overrides_unix/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/env_name_overrides_unix/snapshots/task_graph.md index b5f77d7a6..476b79597 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/env_name_overrides_unix/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/env_name_overrides_unix/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [ "foo", @@ -66,7 +66,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/explicit_deps_workspace/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/explicit_deps_workspace/snapshots/task_graph.md index 2cfb33a46..0088fa12e 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/explicit_deps_workspace/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/explicit_deps_workspace/snapshots/task_graph.md @@ -37,7 +37,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -99,7 +99,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -139,7 +139,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -179,7 +179,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/core", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -219,7 +219,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/core", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -259,7 +259,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/core", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -299,7 +299,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/core", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -339,7 +339,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/utils", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -379,7 +379,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/utils", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -419,7 +419,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/utils", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/extra_args_not_forwarded_to_depends_on/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/extra_args_not_forwarded_to_depends_on/snapshots/task_graph.md index 05e6f657d..bce2a45b1 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/extra_args_not_forwarded_to_depends_on/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/extra_args_not_forwarded_to_depends_on/snapshots/task_graph.md @@ -23,7 +23,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -63,7 +63,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/filter_workspace/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/filter_workspace/snapshots/task_graph.md index bf7308fe6..e40e075f9 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/filter_workspace/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/filter_workspace/snapshots/task_graph.md @@ -33,7 +33,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -73,7 +73,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -113,7 +113,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -153,7 +153,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -193,7 +193,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -233,7 +233,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/cli", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -273,7 +273,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/cli", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -313,7 +313,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/core", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -353,7 +353,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/core", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -393,7 +393,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/core", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -433,7 +433,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/lib", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -473,7 +473,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/lib", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -513,7 +513,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/utils", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/input_trailing_slash/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/input_trailing_slash/snapshots/task_graph.md index e8ba0e819..c57055a81 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/input_trailing_slash/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/input_trailing_slash/snapshots/task_graph.md @@ -21,7 +21,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/input_workspace_base/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/input_workspace_base/snapshots/task_graph.md index 75ef90e4f..395f58b32 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/input_workspace_base/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/input_workspace_base/snapshots/task_graph.md @@ -21,7 +21,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/nested_cache_override/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/nested_cache_override/snapshots/task_graph.md index 3ee435e0e..f9faff974 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/nested_cache_override/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/nested_cache_override/snapshots/task_graph.md @@ -24,7 +24,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -64,7 +64,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -104,7 +104,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -144,7 +144,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/nested_tasks/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/nested_tasks/snapshots/task_graph.md index ce3539cb6..09d1d40a0 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/nested_tasks/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/nested_tasks/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/object_depends_on_duplicate_fields/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/object_depends_on_duplicate_fields/snapshots/task_graph.md index 47d8d55f6..83ccf1218 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/object_depends_on_duplicate_fields/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/object_depends_on_duplicate_fields/snapshots/task_graph.md @@ -25,7 +25,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -65,7 +65,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -105,7 +105,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/b", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/object_depends_on_global_graph/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/object_depends_on_global_graph/snapshots/task_graph.md index bde6cc9c6..8f9a28c40 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/object_depends_on_global_graph/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/object_depends_on_global_graph/snapshots/task_graph.md @@ -36,7 +36,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -76,7 +76,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -116,7 +116,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -156,7 +156,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -196,7 +196,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/dev-a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -236,7 +236,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/dev-a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -276,7 +276,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/peer-a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -316,7 +316,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/prod-a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -356,7 +356,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/prod-missing-task", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -396,7 +396,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/shared", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/package_self_dependency/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/package_self_dependency/snapshots/task_graph.md index c33cbfa38..037b1f2d0 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/package_self_dependency/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/package_self_dependency/snapshots/task_graph.md @@ -21,7 +21,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/self-dep", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/parallel_and_concurrency/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/parallel_and_concurrency/snapshots/task_graph.md index 7f5c8193b..92d6d98fa 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/parallel_and_concurrency/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/parallel_and_concurrency/snapshots/task_graph.md @@ -25,7 +25,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -65,7 +65,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -105,7 +105,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -145,7 +145,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/b", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -185,7 +185,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/c", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/pnpm_workspace_packages_optional/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/pnpm_workspace_packages_optional/snapshots/task_graph.md index 49605f895..2a86e92dc 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/pnpm_workspace_packages_optional/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/pnpm_workspace_packages_optional/snapshots/task_graph.md @@ -21,7 +21,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/prefix_env_path_lookup/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/prefix_env_path_lookup/snapshots/task_graph.md index a698b3dff..0c3cfab7b 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/prefix_env_path_lookup/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/prefix_env_path_lookup/snapshots/task_graph.md @@ -21,7 +21,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/recursive_topological_workspace/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/recursive_topological_workspace/snapshots/task_graph.md index 492cc6234..173248f97 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/recursive_topological_workspace/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/recursive_topological_workspace/snapshots/task_graph.md @@ -28,7 +28,7 @@ flowchart TD "resolved_options": { "cwd": "/apps/web", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -68,7 +68,7 @@ flowchart TD "resolved_options": { "cwd": "/apps/web", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -108,7 +108,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -148,7 +148,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/app", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -188,7 +188,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/core", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -228,7 +228,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/core", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -268,7 +268,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/utils", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -308,7 +308,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/utils", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc index 3b09c6a52..52053f1c5 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_invalid_env.jsonc @@ -22,7 +22,7 @@ } }, "remote_cache": { - "mode": "read-write", + "access": "read-write", "url": "https://cache.example/projects/test" } }, diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_in_env_fingerprinted.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_in_env_fingerprinted.jsonc index 0bc9b3b20..4d9a5ef95 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_in_env_fingerprinted.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_controls_in_env_fingerprinted.jsonc @@ -25,7 +25,7 @@ } }, "remote_cache": { - "mode": "read-write", + "access": "read-write", "url": "https://other.example/projects/test" } }, diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc index dbdf0c433..4e74f8cde 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_default_read.jsonc @@ -22,7 +22,7 @@ } }, "remote_cache": { - "mode": "read", + "access": "read", "url": "https://cache.example/projects/test" } }, diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc index aab70db34..e5e06b568 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_empty_env_endpoint_uses_config.jsonc @@ -22,7 +22,7 @@ } }, "remote_cache": { - "mode": "read", + "access": "read", "url": "https://cache.example/projects/test" } }, diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc index cec1ed55c..c4507f82a 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cli_overrides_env.jsonc @@ -33,7 +33,7 @@ } }, "remote_cache": { - "mode": "read", + "access": "read", "url": "https://cache.example/projects/test" } }, diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_fingerprinted.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_fingerprinted.jsonc index 2e05021d7..c01626269 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_fingerprinted.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_prefix_controls_fingerprinted.jsonc @@ -25,7 +25,7 @@ } }, "remote_cache": { - "mode": "read", + "access": "read", "url": "https://cache.example/projects/test" } }, diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc index ed3a8ef20..2d495235c 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_endpoint_isolation.jsonc @@ -33,7 +33,7 @@ } }, "remote_cache": { - "mode": "read", + "access": "read", "url": "https://other.example/projects/nested" } }, @@ -78,7 +78,7 @@ } }, "remote_cache": { - "mode": "read", + "access": "read", "url": "https://cache.example/projects/test" } }, diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc index 6ae096b98..34b06f5f9 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc @@ -75,7 +75,7 @@ } }, "remote_cache": { - "mode": "read", + "access": "read", "url": "https://cache.example/projects/test" } }, diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md index 4233b944b..093fbdb8c 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md @@ -30,7 +30,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -70,7 +70,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -110,7 +110,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -150,7 +150,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -190,7 +190,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -230,7 +230,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": false, + "remote_cache_allowed": false, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -270,7 +270,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -310,7 +310,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -350,7 +350,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": false, + "remote_cache_allowed": false, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -390,7 +390,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [ "VP_REMOTE_CACHE", diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_endpoint_not_validated.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_endpoint_not_validated.jsonc index 305cf9bab..9331bbe09 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_endpoint_not_validated.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_endpoint_not_validated.jsonc @@ -14,7 +14,7 @@ "Spawn": { "cache_metadata": { "remote_cache": { - "mode": "read", + "access": "read", "url": "cache.example/projects/test" } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc index 6f0c21fd1..b95a400c9 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_nested_endpoint_enables_read.jsonc @@ -25,7 +25,7 @@ "Spawn": { "cache_metadata": { "remote_cache": { - "mode": "read", + "access": "read", "url": "https://cache.example/projects/inner" } } diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/task_graph.md index 37a53dc21..2bc564422 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks/snapshots/task_graph.md index 20b089ac3..54dd61816 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks/snapshots/task_graph.md @@ -26,7 +26,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -66,7 +66,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -106,7 +106,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -146,7 +146,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -186,7 +186,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -226,7 +226,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_disabled/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_disabled/snapshots/task_graph.md index 5c96c5b5f..88c6e57c0 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_disabled/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_disabled/snapshots/task_graph.md @@ -23,7 +23,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -63,7 +63,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -103,7 +103,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_nested_run/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_nested_run/snapshots/task_graph.md index dbe7186ae..74e5b0cbf 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_nested_run/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_nested_run/snapshots/task_graph.md @@ -24,7 +24,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -64,7 +64,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -104,7 +104,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -144,7 +144,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_task_no_hook/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_task_no_hook/snapshots/task_graph.md index 8ab47e34f..ba2702aa0 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_task_no_hook/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/script_hooks_task_no_hook/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/shell_fallback/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/shell_fallback/snapshots/task_graph.md index a8cc9ca3f..8d7eb3d75 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/shell_fallback/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/shell_fallback/snapshots/task_graph.md @@ -21,7 +21,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/synthetic_cache_disabled/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/synthetic_cache_disabled/snapshots/task_graph.md index 4bc59e0aa..3c64bb07b 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/synthetic_cache_disabled/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/synthetic_cache_disabled/snapshots/task_graph.md @@ -27,7 +27,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -67,7 +67,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -129,7 +129,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -169,7 +169,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -210,7 +210,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/synthetic_in_subpackage/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/synthetic_in_subpackage/snapshots/task_graph.md index f7a4de54b..90cd4887b 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/synthetic_in_subpackage/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/synthetic_in_subpackage/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/task_command_shorthands/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/task_command_shorthands/snapshots/task_graph.md index a3cf83e08..3cea5db77 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/task_command_shorthands/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/task_command_shorthands/snapshots/task_graph.md @@ -30,7 +30,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -72,7 +72,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -113,7 +113,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -154,7 +154,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -195,7 +195,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -237,7 +237,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -277,7 +277,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/transitive_skip_intermediate/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/transitive_skip_intermediate/snapshots/task_graph.md index fdf507294..e8b514a98 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/transitive_skip_intermediate/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/transitive_skip_intermediate/snapshots/task_graph.md @@ -23,7 +23,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/bottom", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -63,7 +63,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/middle", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -103,7 +103,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/top", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/vpr_shorthand/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/vpr_shorthand/snapshots/task_graph.md index b09baa301..ee2e7efa8 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/vpr_shorthand/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/vpr_shorthand/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_cd_no_skip/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_cd_no_skip/snapshots/task_graph.md index 2225c45b6..8a7401ecf 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_cd_no_skip/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_cd_no_skip/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_depends_on_passthrough/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_depends_on_passthrough/snapshots/task_graph.md index feb67f2cb..9d04d7938 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_depends_on_passthrough/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_depends_on_passthrough/snapshots/task_graph.md @@ -25,7 +25,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -65,7 +65,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -105,7 +105,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -145,7 +145,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_multi_command/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_multi_command/snapshots/task_graph.md index e4fe94379..bef663384 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_multi_command/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_multi_command/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_mutual_recursion/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_mutual_recursion/snapshots/task_graph.md index af5e1bc2f..9587811fc 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_mutual_recursion/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_mutual_recursion/snapshots/task_graph.md @@ -24,7 +24,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -64,7 +64,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -104,7 +104,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -144,7 +144,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_no_package_json/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_no_package_json/snapshots/task_graph.md index f41c76b3d..04bbae8a2 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_no_package_json/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_no_package_json/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -62,7 +62,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/pkg-a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_self_reference/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_self_reference/snapshots/task_graph.md index e2cd85536..0ddad5eeb 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_self_reference/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/workspace_root_self_reference/snapshots/task_graph.md @@ -23,7 +23,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -63,7 +63,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/a", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ @@ -103,7 +103,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/b", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/snapshot_fields.rs b/crates/vt_plan/tests/snapshot_fields.rs index 37654685d..a36998ff6 100644 --- a/crates/vt_plan/tests/snapshot_fields.rs +++ b/crates/vt_plan/tests/snapshot_fields.rs @@ -25,7 +25,7 @@ fn finds_fields_in_nested_plans_without_leaking_unrelated_fields() { "key": ["workspace", "inner"], "Spawn": {"cache_metadata": { "execution_cache_key": {"task": "inner", "extra_args": []}, - "remote_cache": {"mode": "off"} + "remote_cache": {"access": "read"} }}, "neighbors": [] }], "concurrency_limit": 4}}], From d5acd103e998d195210771c53df2d901677c6611 Mon Sep 17 00:00:00 2001 From: wan9chi Date: Fri, 25 Sep 2026 10:06:55 +0800 Subject: [PATCH 14/14] test(plan): update Windows-only snapshots for `remote_cache_allowed` Co-authored-by: Claude Opus 5.5 --- .../env_name_overrides_windows/snapshots/task_graph.md | 4 ++-- .../fixtures/windows_cmd_shim_rewrite/snapshots/task_graph.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/env_name_overrides_windows/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/env_name_overrides_windows/snapshots/task_graph.md index b5f77d7a6..476b79597 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/env_name_overrides_windows/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/env_name_overrides_windows/snapshots/task_graph.md @@ -22,7 +22,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [ "foo", @@ -66,7 +66,7 @@ flowchart TD "resolved_options": { "cwd": "/", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [ diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/windows_cmd_shim_rewrite/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/windows_cmd_shim_rewrite/snapshots/task_graph.md index db410f30b..bfa4d9c63 100644 --- a/crates/vt_plan/tests/plan_snapshots/fixtures/windows_cmd_shim_rewrite/snapshots/task_graph.md +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/windows_cmd_shim_rewrite/snapshots/task_graph.md @@ -21,7 +21,7 @@ flowchart TD "resolved_options": { "cwd": "/packages/foo", "cache_config": { - "remote_cache": true, + "remote_cache_allowed": true, "env_config": { "fingerprinted_envs": [], "untracked_env": [