diff --git a/CHANGELOG.md b/CHANGELOG.md index a0d93dcf2..bd92f7cb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Changelog +- **Added** Remote cache configuration and mode validation during task planning, including nested command overrides. Remote transfers are not yet implemented ([#727](https://github.com/voidzero-dev/vite-task/pull/727)). - **Fixed** `vp run` no longer hangs or fails when a task leaves a process running behind it, such as a dev server or a background helper, or when one of a task's processes is killed. The run finishes as soon as the task itself does, and the files the task used are still recorded ([#544](https://github.com/voidzero-dev/vite-task/issues/544), [#675](https://github.com/voidzero-dev/vite-task/pull/675)). - **Fixed** A task that reads or writes an unusually large number of files now runs to the end instead of being killed partway through. Vite+ reports the run as not cached, because it could not record every file the task used ([#533](https://github.com/voidzero-dev/vite-task/issues/533), [#675](https://github.com/voidzero-dev/vite-task/pull/675)). - **Fixed** Vite+ diagnostics now display individual paths and working directories without Rust debug formatting such as quoted paths or escaped Windows backslashes ([#534](https://github.com/voidzero-dev/vite-task/pull/534)). diff --git a/Cargo.lock b/Cargo.lock index 14cfa6dfe..c03d36ba5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1018,6 +1018,17 @@ 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" @@ -1221,6 +1232,15 @@ 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" @@ -1709,6 +1729,89 @@ 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" @@ -1721,6 +1824,27 @@ 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" @@ -2014,6 +2138,12 @@ 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" @@ -2638,6 +2768,12 @@ 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" @@ -2843,6 +2979,15 @@ 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" @@ -3592,6 +3737,12 @@ 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" @@ -3697,6 +3848,28 @@ 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" @@ -3901,6 +4074,16 @@ 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" @@ -4180,6 +4363,19 @@ 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" @@ -4189,6 +4385,12 @@ 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" @@ -4444,6 +4646,7 @@ dependencies = [ "tokio", "toml", "tracing", + "url", "vt", "vt_bin", "vt_glob", @@ -5075,6 +5278,12 @@ 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" @@ -5097,6 +5306,29 @@ 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" @@ -5117,6 +5349,60 @@ 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 fee91cf29..615d33c99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,6 +57,7 @@ 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/src/cli/mod.rs b/crates/vt/src/cli/mod.rs index f2724163d..c925fd42b 100644 --- a/crates/vt/src/cli/mod.rs +++ b/crates/vt/src/cli/mod.rs @@ -48,6 +48,10 @@ pub struct RunFlags { #[clap(long, conflicts_with = "cache")] pub no_cache: bool, + /// Remote cache mode (planning only; remote transfers are not yet implemented). + #[clap(long, value_name = "off|read|read-write")] + pub remote_cache: Option, + /// How task output is displayed. #[clap(long, default_value = "interleaved")] pub log: LogMode, @@ -233,6 +237,7 @@ impl ResolvedRunCommand { plan_options: PlanOptions { extra_args: self.additional_args.into(), cache_override, + remote_cache: self.flags.remote_cache, concurrency_limit, parallel, fail_if_no_match, diff --git a/crates/vt/src/session/mod.rs b/crates/vt/src/session/mod.rs index b59cb17ea..605b8dc79 100644 --- a/crates/vt/src/session/mod.rs +++ b/crates/vt/src/session/mod.rs @@ -579,6 +579,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, concurrency_limit: None, parallel: false, // The selector path runs whatever the user picked interactively; diff --git a/crates/vt/src/session/reporter/mod.rs b/crates/vt/src/session/reporter/mod.rs index 4a8522664..e1e6a07e0 100644 --- a/crates/vt/src/session/reporter/mod.rs +++ b/crates/vt/src/session/reporter/mod.rs @@ -477,6 +477,7 @@ pub mod test_fixtures { execution_item_display: test_display(name), kind: ExecutionItemKind::Leaf(LeafExecutionKind::Spawn(SpawnExecution { cache_metadata: None, + remote_cache: None, spawn_command: SpawnCommand { program_path: test_path(), args: Arc::from([]), diff --git a/crates/vt_graph/run-config.ts b/crates/vt_graph/run-config.ts index cd780fce5..ed7e2b448 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. @@ -45,7 +51,11 @@ cwd?: string, * `{ "task": "build", "from": "dependencies" }` runs `build` in each * direct workspace dependency that defines a `build` task. */ -dependsOn?: Array, } & ({ +dependsOn?: Array, +/** + * Disable remote caching for this task while retaining local caching. + */ +remoteCache?: false, } & ({ /** * Whether to cache the task */ @@ -126,6 +136,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 ef39165b6..1f3b8ede9 100644 --- a/crates/vt_graph/src/config/mod.rs +++ b/crates/vt_graph/src/config/mod.rs @@ -83,6 +83,7 @@ impl ResolvedTaskOptions { )?; Some(CacheConfig { + remote_cache: user_options.remote_cache.is_none(), env_config: EnvConfig { fingerprinted_envs: enabled_cache_config .env @@ -100,16 +101,20 @@ impl ResolvedTaskOptions { } #[derive(Debug, Clone, Serialize)] -#[expect( - clippy::struct_field_names, - reason = "env_config, input_config, output_config are distinct config categories, not a naming smell" -)] pub struct CacheConfig { + /// Whether this task permits remote caching when local caching is enabled. + #[serde(skip_serializing_if = "remote_cache_enabled")] + pub remote_cache: bool, pub env_config: EnvConfig, pub input_config: ResolvedGlobConfig, pub output_config: ResolvedGlobConfig, } +#[expect(clippy::trivially_copy_pass_by_ref, reason = "serde passes a field reference")] +const fn remote_cache_enabled(enabled: &bool) -> bool { + *enabled +} + /// Resolved input configuration for cache fingerprinting. /// /// This is the normalized form after parsing user config. diff --git a/crates/vt_graph/src/config/user.rs b/crates/vt_graph/src/config/user.rs index 0afea4679..59a7e2585 100644 --- a/crates/vt_graph/src/config/user.rs +++ b/crates/vt_graph/src/config/user.rs @@ -243,6 +243,10 @@ pub struct UserTaskOptions { /// direct workspace dependency that defines a `build` task. pub depends_on: Option>, + /// Disable remote caching for this task while retaining local caching. + #[cfg_attr(all(test, not(clippy)), ts(type = "false", optional))] + pub remote_cache: Option, + /// Cache-related fields #[serde(flatten)] pub cache_config: UserCacheConfig, @@ -256,6 +260,7 @@ impl Default for UserTaskOptions { cwd_relative_to_package: None, // No dependencies depends_on: None, + remote_cache: None, // Caching enabled with no fingerprinted env cache_config: UserCacheConfig::Enabled { cache: None, @@ -369,6 +374,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 @@ -381,6 +395,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>, diff --git a/crates/vt_graph/src/lib.rs b/crates/vt_graph/src/lib.rs index e721b5f90..a7b097751 100644 --- a/crates/vt_graph/src/lib.rs +++ b/crates/vt_graph/src/lib.rs @@ -124,6 +124,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}" )] @@ -232,6 +237,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, } @@ -271,6 +279,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()); @@ -299,6 +308,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); @@ -416,6 +434,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), }; @@ -582,6 +601,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/Cargo.toml b/crates/vt_plan/Cargo.toml index 79ee3753f..77d802f48 100644 --- a/crates/vt_plan/Cargo.toml +++ b/crates/vt_plan/Cargo.toml @@ -24,6 +24,7 @@ sha2 = { workspace = true } shell-escape = { workspace = true } thiserror = { workspace = true } tracing = { workspace = true } +url = { workspace = true, features = ["serde"] } vt_glob = { workspace = true } vt_graph_ser = { workspace = true } vt_path = { workspace = true } diff --git a/crates/vt_plan/src/context.rs b/crates/vt_plan/src/context.rs index f40263d4f..a3d571ec4 100644 --- a/crates/vt_plan/src/context.rs +++ b/crates/vt_plan/src/context.rs @@ -51,6 +51,8 @@ pub struct PlanContext<'a> { /// Final resolved global cache config, combining the graph's config with any CLI override. resolved_global_cache: ResolvedGlobalCacheConfig, + 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, @@ -75,6 +77,7 @@ impl<'a> PlanContext<'a> { indexed_task_graph, extra_args: Arc::default(), resolved_global_cache, + remote_cache: None, parent_query, } } @@ -129,6 +132,11 @@ impl<'a> PlanContext<'a> { } let envs = Arc::make_mut(&mut self.envs); for (key, value) in new_envs { + // Windows env names are case-insensitive. Remove a differently + // cased inherited control before inserting the explicit override. + if cfg!(windows) && crate::remote_cache::is_control_env(key.as_ref()) { + envs.retain(|name, _| !name.eq_ignore_ascii_case(key.as_ref())); + } envs.insert(Arc::from(key.as_ref()), Arc::from(value.as_ref())); } } @@ -149,6 +157,28 @@ impl<'a> PlanContext<'a> { self.resolved_global_cache = config; } + pub fn resolve_remote_cache( + &mut self, + mode: Option, + ) -> Result<(), crate::Error> { + self.remote_cache = crate::remote_cache::resolve( + self.indexed_task_graph.remote_cache_config(), + &self.envs, + mode, + )?; + // Make the explicit CLI choice the inherited environment value. + // A nested prefix assignment can then override it, even when that + // assignment repeats the original process environment's value. + if let Some(mode) = mode { + self.add_envs(std::iter::once((crate::remote_cache::MODE_ENV, mode.as_str()))); + } + Ok(()) + } + + pub const fn remote_cache(&self) -> Option<&crate::remote_cache::RemoteCacheConfig> { + self.remote_cache.as_ref() + } + pub fn parent_query(&self) -> &TaskQuery { &self.parent_query } @@ -173,6 +203,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, + remote_cache: self.remote_cache.clone(), parent_query: Arc::clone(&self.parent_query), } } diff --git a/crates/vt_plan/src/envs.rs b/crates/vt_plan/src/envs.rs index 735ce5b45..c00a286b6 100644 --- a/crates/vt_plan/src/envs.rs +++ b/crates/vt_plan/src/envs.rs @@ -150,7 +150,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(OsStr::new(name.as_str()))) + .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 281efe5ab..625fc5c9b 100644 --- a/crates/vt_plan/src/lib.rs +++ b/crates/vt_plan/src/lib.rs @@ -8,6 +8,7 @@ mod path_env; mod plan; pub mod plan_request; mod ps1_shim; +pub mod remote_cache; use std::{collections::BTreeMap, ffi::OsStr, fmt::Debug, sync::Arc}; @@ -34,6 +35,10 @@ pub struct SpawnExecution { /// Cache metadata for this execution. `None` means caching is disabled. pub cache_metadata: Option, + /// Remote access resolved during planning, separate from cache identity. + #[serde(skip_serializing_if = "Option::is_none")] + pub remote_cache: Option, + /// All information about a command to be spawned pub spawn_command: SpawnCommand, } @@ -206,10 +211,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); @@ -264,5 +266,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 06860b8fd..6b8e8b40f 100644 --- a/crates/vt_plan/src/plan.rs +++ b/crates/vt_plan/src/plan.rs @@ -304,6 +304,7 @@ async fn plan_task_as_execution_node( &cwd, package_path, parent_cache_config, + context.remote_cache(), )?; ExecutionItemKind::Leaf(LeafExecutionKind::Spawn(spawn_execution)) } @@ -334,6 +335,7 @@ async fn plan_task_as_execution_node( Some(task_execution_cache_key), &and_item.envs, &resolved_options, + context.remote_cache(), &script_command.envs, program_path, spawn_args, @@ -401,6 +403,7 @@ async fn plan_task_as_execution_node( }), &BTreeMap::new(), &resolved_options, + context.remote_cache(), context.envs(), Arc::clone(&*SHELL_PROGRAM_PATH), SHELL_ARGS.iter().map(|s| Str::from(*s)).chain(std::iter::once(script)).collect(), @@ -475,6 +478,7 @@ fn resolve_synthetic_cache_config( cache_config: synthetic_cache_config, cwd_relative_to_package: None, depends_on: None, + remote_cache: None, }, &package_dir.into(), workspace_path, @@ -541,6 +545,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, @@ -549,6 +557,7 @@ pub fn plan_synthetic_request( cwd: &Arc, package_dir: &AbsolutePath, parent_cache_config: ParentCacheConfig, + remote_cache: Option<&crate::remote_cache::RemoteCacheConfig>, ) -> Result { let SyntheticPlanRequest { program, args, cache_config, envs } = synthetic_plan_request; @@ -569,6 +578,7 @@ pub fn plan_synthetic_request( execution_cache_key, prefix_envs, &resolved_options, + remote_cache, &envs, program_path, args, @@ -596,19 +606,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, resolved_task_options: &ResolvedTaskOptions, + remote_cache: Option<&crate::remote_cache::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)| (Arc::clone(name), 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; @@ -622,6 +646,7 @@ fn plan_spawn_execution( env_fingerprints.fingerprinted_envs.extend( prefix_envs .iter() + .filter(|(name, _)| !crate::remote_cache::is_control_env(OsStr::new(name.as_str()))) .map(|(name, value)| (name.clone(), EnvValueHash::new(value.as_str()))), ); @@ -672,7 +697,7 @@ fn plan_spawn_execution( execution_cache_key, input_config: cache_config.input_config.clone(), output_config: cache_config.output_config.clone(), - unfiltered_envs: Arc::clone(envs), + unfiltered_envs: Arc::clone(&envs), }); } } @@ -685,9 +710,14 @@ fn plan_spawn_execution( spawn_envs.insert(OsStr::new(MARKER_ENV_NAME).into(), OsStr::new("1").into()); // Add prefix envs to spawn envs. - spawn_envs.extend(prefix_envs.iter().map(|(name, value)| { - (OsStr::new(name.as_str()).into(), OsStr::new(value.as_str()).into()) - })); + spawn_envs.extend( + prefix_envs + .iter() + .filter(|(name, _)| !crate::remote_cache::is_control_env(OsStr::new(name.as_str()))) + .map(|(name, value)| { + (OsStr::new(name.as_str()).into(), OsStr::new(value.as_str()).into()) + }), + ); Ok(SpawnExecution { spawn_command: SpawnCommand { @@ -696,6 +726,15 @@ fn plan_spawn_execution( cwd, spawn_envs: Arc::new(spawn_envs.into_iter().collect()), }, + remote_cache: remote_cache + .filter(|_| { + resolved_cache_metadata.is_some() + && resolved_task_options + .cache_config + .as_ref() + .is_some_and(|config| config.remote_cache) + }) + .cloned(), cache_metadata: resolved_cache_metadata, }) } @@ -736,6 +775,8 @@ pub async fn plan_query_request( ); context.set_resolved_global_cache(final_cache); } + context.resolve_remote_cache(plan_options.remote_cache)?; + // Resolve effective concurrency for this level. // // Priority (highest to lowest): @@ -939,6 +980,7 @@ mod tests { fn parent_config(includes_auto: bool, positive_globs: &[&str]) -> CacheConfig { CacheConfig { + remote_cache: true, env_config: EnvConfig { fingerprinted_envs: FxHashSet::default(), untracked_env: FxHashSet::default(), diff --git a/crates/vt_plan/src/plan_request.rs b/crates/vt_plan/src/plan_request.rs index 795546ccb..2446e17e8 100644 --- a/crates/vt_plan/src/plan_request.rs +++ b/crates/vt_plan/src/plan_request.rs @@ -49,6 +49,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 new file mode 100644 index 000000000..1419b81bc --- /dev/null +++ b/crates/vt_plan/src/remote_cache.rs @@ -0,0 +1,121 @@ +//! Remote cache settings resolved for each invocation during planning. + +use std::{ffi::OsStr, fmt, str::FromStr, sync::Arc}; + +use rustc_hash::FxHashMap; +use serde::Serialize; +use url::Url; +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)] +#[serde(rename_all = "kebab-case")] +pub enum RemoteCacheMode { + Off, + Read, + 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 fmt::Display for RemoteCacheMode { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.as_str()) + } +} + +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())), + } + } +} + +/// Validated remote endpoint and access mode for a cacheable execution. +#[derive(Debug, Clone, Serialize)] +pub struct RemoteCacheConfig { + pub url: Arc, + pub mode: RemoteCacheMode, +} + +#[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 cache mode {0} requires remoteCache.url or VP_REMOTE_CACHE_URL")] + MissingEndpoint(RemoteCacheMode), + #[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 env_name_matches(name: &OsStr, expected: &str) -> bool { + if cfg!(windows) { name.eq_ignore_ascii_case(expected) } else { name == expected } +} + +pub(crate) fn is_control_env(name: &OsStr) -> bool { + env_name_matches(name, MODE_ENV) || env_name_matches(name, URL_ENV) +} + +fn env_value<'a>( + envs: &'a FxHashMap, Arc>, + name: &'static str, +) -> Result, RemoteCacheConfigError> { + envs.iter() + .find(|(key, _)| env_name_matches(key, 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>, + mode_override: Option, +) -> Result, RemoteCacheConfigError> { + let mode = match mode_override { + Some(mode) => Some(mode), + None => 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 mode = mode.unwrap_or_else(|| { + if url.is_some() { RemoteCacheMode::Read } else { RemoteCacheMode::Off } + }); + if mode == RemoteCacheMode::Off { + return Ok(None); + } + let url = url.ok_or(RemoteCacheConfigError::MissingEndpoint(mode))?; + Ok(Some(RemoteCacheConfig { url, mode })) +} 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..94a287d57 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/package.json @@ -0,0 +1,15 @@ +{ + "name": "@test/remote-cache-config", + "scripts": { + "inherit": "vt run build", + "deep": "vt run inherit", + "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", + "cache-on": "vt run --cache build", + "cache-off": "vt run --no-cache build", + "invalid-nested": "VP_REMOTE_CACHE=invalid 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..4fa494209 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots.toml @@ -0,0 +1,97 @@ +[[plan]] +name = "default_read" +args = ["run", "build"] + +[[plan]] +name = "ci_default_read" +args = ["run", "build"] +env = { "CI" = "true" } + +[[plan]] +name = "env_read_write" +args = ["run", "build"] +env = { "VP_REMOTE_CACHE" = "read-write" } + +[[plan]] +name = "cli_overrides_env" +args = ["run", "--remote-cache=off", "build"] +env = { "VP_REMOTE_CACHE" = "read-write" } + +[[plan]] +name = "cli_read_write" +args = ["run", "--remote-cache=read-write", "build"] +env = { "VP_REMOTE_CACHE" = "off" } + +[[plan]] +name = "cli_overrides_invalid_env" +args = ["run", "--remote-cache=read", "build"] +env = { "VP_REMOTE_CACHE" = "invalid" } + +[[plan]] +name = "endpoint_env_override" +args = ["run", "build"] +env = { "VP_REMOTE_CACHE_URL" = "http://127.0.0.1:1234/projects/test" } + +[[plan]] +name = "task_local_only" +args = ["run", "--remote-cache=read-write", "local-only"] + +[[plan]] +name = "task_uncached" +args = ["run", "uncached"] + +[[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 = "deep_inherits_cli" +args = ["run", "--remote-cache=read-write", "deep"] + +[[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"] + +[[plan]] +name = "nested_cache_reenabled" +args = ["run", "--no-cache", "cache-on"] + +[[plan]] +name = "nested_cache_disabled" +args = ["run", "cache-off"] + +[[plan]] +name = "invalid_nested_env" +args = ["run", "invalid-nested"] + diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_ci_default_read.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_ci_default_read.jsonc new file mode 100644 index 000000000..1f06e78b1 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_ci_default_read.jsonc @@ -0,0 +1,100 @@ +// 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": { + "CI": "sha256:b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b", + "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": { + "url": "https://cache.example/projects/test", + "mode": "read" + }, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "spawn_envs": { + "CI": "true", + "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_cli_overrides_env.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_env.jsonc new file mode 100644 index 000000000..773a5d253 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_overrides_env.jsonc @@ -0,0 +1,94 @@ +// run --remote-cache=off 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": [] + } + }, + "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_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..38fd9a3fb --- /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 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": { + "url": "https://cache.example/projects/test", + "mode": "read" + }, + "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_cli_read_write.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_read_write.jsonc new file mode 100644 index 000000000..0b33787d1 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_cli_read_write.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": { + "url": "https://cache.example/projects/test", + "mode": "read-write" + }, + "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..12dfa392f --- /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": { + "url": "https://other.example/projects/test", + "mode": "read-write" + }, + "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_deep_inherits_cli.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_deep_inherits_cli.jsonc new file mode 100644 index 000000000..d0e1747db --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_deep_inherits_cli.jsonc @@ -0,0 +1,166 @@ +// run --remote-cache=read-write deep +{ + "graph": [ + { + "key": [ + "/", + "deep" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "deep", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "deep", + "package_path": "/" + }, + "command": "vt run inherit", + "cwd": "/" + }, + "kind": { + "Expanded": { + "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": { + "url": "https://cache.example/projects/test", + "mode": "read-write" + }, + "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 + } + } + } + ] + }, + "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..cba2347c3 --- /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": { + "url": "https://cache.example/projects/test", + "mode": "read" + }, + "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_endpoint_env_override.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_endpoint_env_override.jsonc new file mode 100644 index 000000000..752184330 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_endpoint_env_override.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": { + "url": "http://127.0.0.1:1234/projects/test", + "mode": "read" + }, + "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_env_read_write.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_env_read_write.jsonc new file mode 100644 index 000000000..a7b94e8fb --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_env_read_write.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": { + "url": "https://cache.example/projects/test", + "mode": "read-write" + }, + "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_invalid_nested_env.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_invalid_nested_env.snap new file mode 100644 index 000000000..a7ac41883 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_invalid_nested_env.snap @@ -0,0 +1 @@ +Failed to plan tasks from `VP_REMOTE_CACHE=invalid vt run build` in task @test/remote-cache-config#invalid-nested: 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_config/snapshots/query_nested_cache_disabled.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cache_disabled.jsonc new file mode 100644 index 000000000..d8b1573a6 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cache_disabled.jsonc @@ -0,0 +1,87 @@ +// run cache-off +{ + "graph": [ + { + "key": [ + "/", + "cache-off" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "cache-off", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "cache-off", + "package_path": "/" + }, + "command": "vt run --no-cache 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": 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 + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 4 +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cache_reenabled.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cache_reenabled.jsonc new file mode 100644 index 000000000..5e910a997 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_cache_reenabled.jsonc @@ -0,0 +1,132 @@ +// run --no-cache cache-on +{ + "graph": [ + { + "key": [ + "/", + "cache-on" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "cache-on", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "cache-on", + "package_path": "/" + }, + "command": "vt run --cache 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": { + "url": "https://cache.example/projects/test", + "mode": "read" + }, + "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_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..51865ef8e --- /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": { + "url": "https://cache.example/projects/test", + "mode": "read" + }, + "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..a44064608 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_env_override.jsonc @@ -0,0 +1,128 @@ +// 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": [] + } + }, + "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..258abbe08 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_nested_inherits_cli.jsonc @@ -0,0 +1,128 @@ +// 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": [] + } + }, + "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..49ba3240b --- /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": { + "url": "https://cache.example/projects/test", + "mode": "read" + }, + "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..e5bce8996 --- /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": { + "url": "https://other.example/projects/nested", + "mode": "read" + }, + "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": { + "url": "https://cache.example/projects/test", + "mode": "read" + }, + "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..3358c2d1c --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_sibling_mode_isolation.jsonc @@ -0,0 +1,238 @@ +// 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": [] + } + }, + "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": { + "url": "https://cache.example/projects/test", + "mode": "read" + }, + "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..c0dacf344 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_synthetic_local_only.jsonc @@ -0,0 +1,91 @@ +// 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": [] + } + }, + "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..e4604611e --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_local_only.jsonc @@ -0,0 +1,91 @@ +// 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": [] + } + }, + "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_uncached.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_uncached.jsonc new file mode 100644 index 000000000..1baa4093f --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/query_task_uncached.jsonc @@ -0,0 +1,53 @@ +// run uncached +{ + "graph": [ + { + "key": [ + "/", + "uncached" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "uncached", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "uncached", + "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/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md new file mode 100644 index 000000000..ad1b1a66e --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_config/snapshots/task_graph.md @@ -0,0 +1,599 @@ +# task graph + +```mermaid +flowchart TD + task_0["/#build"] + task_1["/#cache-off"] + task_2["/#cache-on"] + task_3["/#cli-read"] + task_4["/#deep"] + task_5["/#endpoints"] + task_6["/#env-off"] + task_7["/#inherit"] + task_8["/#invalid-nested"] + task_9["/#local-only"] + task_10["/#prefix"] + task_11["/#siblings"] + task_12["/#synthetic"] + task_13["/#tracked-controls"] + task_14["/#uncached"] +``` + +## `/#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": { + "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" +} +``` + +## `/#cache-off` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "cache-off", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vt run --no-cache build" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "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" +} +``` + +## `/#cache-on` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "cache-on", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vt run --cache build" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "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" +} +``` + +## `/#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": { + "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" +} +``` + +## `/#deep` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "deep", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vt run inherit" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "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": { + "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": { + "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": { + "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" +} +``` + +## `/#invalid-nested` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "invalid-nested", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "VP_REMOTE_CACHE=invalid vt run build" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "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": { + "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": { + "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": { + "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" +} +``` + +## `/#uncached` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-config", + "task_name": "uncached", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vtt print-file package.json" + ], + "resolved_options": { + "cwd": "/", + "cache_config": null + } + }, + "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..3aba8ca2c --- /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", + "env": ["*", "!PATH"] + }, + "local-only": { + "command": "vtt print-file package.json", + "remoteCache": false + }, + "uncached": { + "command": "vtt print-file package.json", + "cache": false, + "remoteCache": false + }, + "synthetic": { + "command": "vt tool print-file package.json", + "remoteCache": false + }, + "tracked-controls": { + "command": "vtt print-file package.json", + "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_invalid_task/package.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_invalid_task/package.json new file mode 100644 index 000000000..9f0adb6ed --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_invalid_task/package.json @@ -0,0 +1,4 @@ +{ + "name": "@test/remote-cache-invalid-task", + "scripts": {} +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_invalid_task/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_invalid_task/snapshots.toml new file mode 100644 index 000000000..e69de29bb diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_invalid_task/snapshots/task_graph_load_error.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_invalid_task/snapshots/task_graph_load_error.snap new file mode 100644 index 000000000..2425be942 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_invalid_task/snapshots/task_graph_load_error.snap @@ -0,0 +1 @@ +Failed to load task config file for package at / \ No newline at end of file diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_invalid_task/vite-task.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_invalid_task/vite-task.json new file mode 100644 index 000000000..1b5262c65 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_invalid_task/vite-task.json @@ -0,0 +1,8 @@ +{ + "tasks": { + "build": { + "command": "vtt print-file package.json", + "remoteCache": true + } + } +} 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_windows_env/package.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/package.json new file mode 100644 index 000000000..a9f385756 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/package.json @@ -0,0 +1,8 @@ +{ + "name": "@test/remote-cache-windows-env", + "scripts": { + "build": "vtt print-file package.json", + "outer": "vp_remote_cache=off vt run build", + "inherit": "vt run build" + } +} diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots.toml b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots.toml new file mode 100644 index 000000000..f8b9d7ebc --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots.toml @@ -0,0 +1,16 @@ +platform = "windows" + +[[plan]] +name = "case_insensitive_controls" +args = ["run", "build"] +env = { "vp_remote_cache" = "read-write", "vp_remote_cache_url" = "https://other.example/projects/test" } + +[[plan]] +name = "prefix_overrides_cli" +args = ["run", "--remote-cache=read", "outer"] + +[[plan]] +name = "cli_overrides_inherited_case" +args = ["run", "--remote-cache=off", "inherit"] +env = { "vp_remote_cache" = "read-write" } + diff --git a/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots/query_case_insensitive_controls.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots/query_case_insensitive_controls.jsonc new file mode 100644 index 000000000..14817fc2c --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots/query_case_insensitive_controls.jsonc @@ -0,0 +1,95 @@ +// run build +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "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": { + "url": "https://other.example/projects/test", + "mode": "read-write" + }, + "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_windows_env/snapshots/query_cli_overrides_inherited_case.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots/query_cli_overrides_inherited_case.jsonc new file mode 100644 index 000000000..1f60c7d2f --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots/query_cli_overrides_inherited_case.jsonc @@ -0,0 +1,125 @@ +// run --remote-cache=off inherit +{ + "graph": [ + { + "key": [ + "/", + "inherit" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "task_name": "inherit", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "task_name": "inherit", + "package_path": "/" + }, + "command": "vt run build", + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "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": [] + } + }, + "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_windows_env/snapshots/query_prefix_overrides_cli.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots/query_prefix_overrides_cli.jsonc new file mode 100644 index 000000000..35f7225c5 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots/query_prefix_overrides_cli.jsonc @@ -0,0 +1,125 @@ +// run --remote-cache=read outer +{ + "graph": [ + { + "key": [ + "/", + "outer" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "task_name": "outer", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "task_name": "outer", + "package_path": "/" + }, + "command": "vp_remote_cache=off vt run build", + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "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": [] + } + }, + "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_windows_env/snapshots/task_graph.md b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots/task_graph.md new file mode 100644 index 000000000..fa1c88d7b --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/snapshots/task_graph.md @@ -0,0 +1,126 @@ +# task graph + +```mermaid +flowchart TD + task_0["/#build"] + task_1["/#inherit"] + task_2["/#outer"] +``` + +## `/#build` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "task_name": "build", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vtt print-file package.json" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "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-windows-env", + "task_name": "inherit", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vt run build" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "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" +} +``` + +## `/#outer` + +```json +{ + "task_display": { + "package_name": "@test/remote-cache-windows-env", + "task_name": "outer", + "package_path": "/" + }, + "resolved_config": { + "commands": [ + "vp_remote_cache=off vt run build" + ], + "resolved_options": { + "cwd": "/", + "cache_config": { + "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_windows_env/vite-task.json b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/vite-task.json new file mode 100644 index 000000000..dcbb4615b --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_windows_env/vite-task.json @@ -0,0 +1,6 @@ +{ + "cache": true, + "remoteCache": { + "url": "https://cache.example/projects/test" + } +} 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..5ff063812 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots.toml @@ -0,0 +1,50 @@ +[[plan]] +name = "default_off" +args = ["run", "build"] + +[[plan]] +name = "explicit_off" +args = ["run", "--remote-cache=off", "build"] + +[[plan]] +name = "env_endpoint_enables_read" +args = ["run", "build"] +env = { "VP_REMOTE_CACHE_URL" = "https://cache.example/projects/test" } + +[[plan]] +name = "nested_endpoint_enables_read" +args = ["run", "with-url"] + +[[plan]] +name = "missing_cli_endpoint" +args = ["run", "--remote-cache=read", "build"] + +[[plan]] +name = "missing_env_endpoint" +args = ["run", "build"] +env = { "VP_REMOTE_CACHE" = "read-write" } + +[[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" } + +[[plan]] +name = "empty_endpoint" +args = ["run", "build"] +env = { "VP_REMOTE_CACHE_URL" = "" } + 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..152d4366e --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_default_off.jsonc @@ -0,0 +1,91 @@ +// 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": [] + } + }, + "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_empty_endpoint.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_empty_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_empty_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_env_endpoint_enables_read.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_env_endpoint_enables_read.jsonc new file mode 100644 index 000000000..f2d1b3e8c --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_env_endpoint_enables_read.jsonc @@ -0,0 +1,95 @@ +// 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": { + "url": "https://cache.example/projects/test", + "mode": "read" + }, + "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_explicit_off.jsonc b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_explicit_off.jsonc new file mode 100644 index 000000000..44b46415e --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_explicit_off.jsonc @@ -0,0 +1,91 @@ +// run --remote-cache=off 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": [] + } + }, + "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..49cce85d1 --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_invalid_cli_mode.snap @@ -0,0 +1,3 @@ +error: invalid value 'invalid' for '--remote-cache ': Invalid remote cache mode "invalid": expected off, read, or 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..d0464cc2c --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_missing_cli_endpoint.snap @@ -0,0 +1 @@ +Remote cache mode read 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_missing_env_endpoint.snap b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_missing_env_endpoint.snap new file mode 100644 index 000000000..748911e2d --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/query_missing_env_endpoint.snap @@ -0,0 +1 @@ +Remote cache mode read-write 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..7dea37163 --- /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": { + "url": "https://cache.example/projects/inner", + "mode": "read" + }, + "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..2f806c84e --- /dev/null +++ b/crates/vt_plan/tests/plan_snapshots/fixtures/remote_cache_without_endpoint/snapshots/task_graph.md @@ -0,0 +1,86 @@ +# 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": { + "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": { + "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 +}