From ec3bcfbbfdb28e3193315e6a1fd8fe86d797cc30 Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 17:45:44 +0800 Subject: [PATCH 01/21] feat: add --concurrency and --parallel flags Add `--concurrency` to limit the number of concurrent tasks per execution graph level (supports numbers and percentages like `50%`), and `--parallel` to discard dependency edges and run tasks independently. Both flags are per-level: nested `vp run` inherits the parent's concurrency unless it specifies its own `--concurrency`. When `--parallel` is used without `--concurrency`, concurrency is unlimited. Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 2 + crates/vite_task/src/cli/mod.rs | 38 +++ crates/vite_task/src/session/execute/mod.rs | 16 +- crates/vite_task/src/session/mod.rs | 4 +- crates/vite_task_plan/src/context.rs | 16 ++ crates/vite_task_plan/src/execution_graph.rs | 35 ++- crates/vite_task_plan/src/lib.rs | 7 +- crates/vite_task_plan/src/plan.rs | 28 ++- crates/vite_task_plan/src/plan_request.rs | 7 + ...ry - tool synthetic task in user task.snap | 147 +++++------ ...oes not override per-task cache false.snap | 91 +++---- ...uery - --cache enables script caching.snap | 141 +++++------ ...aching even when cache.tasks is false.snap | 141 +++++------ ...h per-task cache true enables caching.snap | 141 +++++------ ...ry - --no-cache disables task caching.snap | 91 +++---- ...o-cache overrides per-task cache true.snap | 91 +++---- ... not cached when cache.tasks is false.snap | 91 +++---- ...query - echo and lint with extra args.snap | 189 ++++++++------- ...query - lint and echo with extra args.snap | 183 +++++++------- .../query - normal task with extra args.snap | 145 +++++------ ... synthetic task in user task with cwd.snap | 141 +++++------ .../query - synthetic task in user task.snap | 141 +++++------ ...tic task with extra args in user task.snap | 147 +++++------ .../query - script not cached by default.snap | 91 +++---- ...uery - another task cached by default.snap | 141 +++++------ .../query - script not cached by default.snap | 91 +++---- .../query - task cached by default.snap | 141 +++++------ .../query - cache clean in script.snap | 91 +++---- ...e still disabled by cache.tasks false.snap | 91 +++---- .../snapshots/query - script not cached.snap | 91 +++---- ... not cached when cache.tasks is false.snap | 91 +++---- ... script cached when global cache true.snap | 141 +++++------ ... - task cached when global cache true.snap | 141 +++++------ ... not cached despite global cache true.snap | 91 +++---- ...t should put synthetic task under cwd.snap | 141 +++++------ ...n should not affect expanded task cwd.snap | 210 ++++++++-------- ...ed --cache enables inner task caching.snap | 210 ++++++++-------- ...-no-cache disables inner task caching.snap | 154 ++++++------ ...n without flags inherits parent cache.snap | 154 ++++++------ ...ropagates to nested run without flags.snap | 210 ++++++++-------- ...oes not propagate into nested --cache.snap | 210 ++++++++-------- ...ropagates to nested run without flags.snap | 154 ++++++------ .../parallel-and-concurrency/package.json | 8 + .../packages/a/package.json | 10 + .../packages/b/package.json | 10 + .../packages/c/package.json | 7 + .../pnpm-workspace.yaml | 2 + .../parallel-and-concurrency/snapshots.toml | 42 ++++ .../query - baseline recursive build.snap | 20 ++ ...ery - concurrency with explicit value.snap | 171 +++++++++++++ ... - nested inherits parent concurrency.snap | 190 +++++++++++++++ ...- nested overrides parent concurrency.snap | 205 ++++++++++++++++ .../query - parallel discards edges.snap | 17 ++ ...- parallel only affects current level.snap | 26 ++ .../query - parallel with concurrency.snap | 162 +++++++++++++ .../query - parallel without concurrency.snap | 160 ++++++++++++ .../snapshots/task graph.snap | 177 ++++++++++++++ .../parallel-and-concurrency/vite-task.json | 3 + ...test runs without hooks when disabled.snap | 79 +++--- ...en scriptInHook is called from a hook.snap | 228 +++++++++--------- ...fig test does not expand pretest hook.snap | 79 +++--- ...query - build runs with pre hook only.snap | 121 +++++----- ...uery - extra args not passed to hooks.snap | 165 ++++++------- ...repretest but not when called as hook.snap | 121 +++++----- ...y - test runs with pre and post hooks.snap | 163 +++++++------ ...ery - shell fallback for pipe command.snap | 141 +++++------ ... does not affect expanded query tasks.snap | 210 ++++++++-------- ...s not affect expanded synthetic cache.snap | 210 ++++++++-------- ...ut cache.scripts defaults to no cache.snap | 91 +++---- ...k untrackedEnv inherited by synthetic.snap | 143 +++++------ ... cache false disables synthetic cache.snap | 91 +++---- ...th cache true enables synthetic cache.snap | 141 +++++------ .../query - synthetic-in-subpackage.snap | 210 ++++++++-------- .../tests/plan_snapshots/main.rs | 9 +- 74 files changed, 4795 insertions(+), 3294 deletions(-) create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/package.json create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/a/package.json create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/b/package.json create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/c/package.json create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/pnpm-workspace.yaml create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - baseline recursive build.snap create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - concurrency with explicit value.snap create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested overrides parent concurrency.snap create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel discards edges.snap create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel only affects current level.snap create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel with concurrency.snap create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel without concurrency.snap create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/task graph.snap create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/vite-task.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 90fa2668..6c893477 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +- **Added** `--concurrency` flag to limit the number of concurrent tasks per execution graph level, supporting both absolute values (e.g. `--concurrency 5`) and percentages of CPU cores (e.g. `--concurrency 50%`) +- **Added** `--parallel` flag to discard dependency edges between tasks, running them all independently with unlimited concurrency (unless `--concurrency` is also specified) - **Added** object form for `input` entries: `{ "pattern": "...", "base": "workspace" | "package" }` to resolve glob patterns relative to the workspace root instead of the package directory ([#295](https://github.com/voidzero-dev/vite-task/pull/295)) - **Fixed** arguments after the task name being consumed by `vp` instead of passed through to the task ([#286](https://github.com/voidzero-dev/vite-task/pull/286), [#290](https://github.com/voidzero-dev/vite-task/pull/290)) - **Changed** default untracked env patterns to align with Turborepo, covering more CI and platform-specific variables ([#262](https://github.com/voidzero-dev/vite-task/pull/262)) diff --git a/crates/vite_task/src/cli/mod.rs b/crates/vite_task/src/cli/mod.rs index 65cf6122..e517cc86 100644 --- a/crates/vite_task/src/cli/mod.rs +++ b/crates/vite_task/src/cli/mod.rs @@ -51,6 +51,16 @@ pub struct RunFlags { /// How task output is displayed. #[clap(long, default_value = "interleaved")] pub log: LogMode, + + /// Maximum number of tasks to run concurrently per execution graph level. + /// Accepts a number (e.g. `5`) or a percentage of available CPU cores (e.g. `50%`). + #[clap(long)] + pub concurrency: Option, + + /// Run tasks without dependency ordering. Sets concurrency to unlimited + /// unless `--concurrency` is also specified. + #[clap(long, default_value = "false")] + pub parallel: bool, } impl RunFlags { @@ -181,6 +191,27 @@ impl RunCommand { } } +#[derive(thiserror::Error, Debug)] +pub enum ConcurrencyParseError { + #[error("invalid concurrency value: {0}")] + InvalidValue(Str), +} + +/// Parse a `--concurrency` value: either a plain number or a percentage (e.g. `50%`). +/// The result is always clamped to at least 1. +fn parse_concurrency(raw: &str) -> Result { + if let Some(pct_str) = raw.strip_suffix('%') { + let pct: usize = + pct_str.parse().map_err(|_| ConcurrencyParseError::InvalidValue(Str::from(raw)))?; + let cpus = std::thread::available_parallelism().map_or(1, std::num::NonZero::get); + Ok((cpus * pct / 100).max(1)) + } else { + let n: usize = + raw.parse().map_err(|_| ConcurrencyParseError::InvalidValue(Str::from(raw)))?; + Ok(n.max(1)) + } +} + #[derive(thiserror::Error, Debug)] pub enum CLITaskQueryError { #[error("no task specifier provided")] @@ -188,6 +219,9 @@ pub enum CLITaskQueryError { #[error(transparent)] PackageQuery(#[from] PackageQueryError), + + #[error(transparent)] + Concurrency(#[from] ConcurrencyParseError), } impl ResolvedRunCommand { @@ -206,6 +240,8 @@ impl ResolvedRunCommand { let cache_override = self.flags.cache_override(); let include_explicit_deps = !self.flags.ignore_depends_on; + let concurrency = self.flags.concurrency.as_deref().map(parse_concurrency).transpose()?; + let parallel = self.flags.parallel; let (package_query, is_cwd_only) = self.flags.package_query.into_package_query(task_specifier.package_name, cwd)?; @@ -220,6 +256,8 @@ impl ResolvedRunCommand { plan_options: PlanOptions { extra_args: self.additional_args.into(), cache_override, + concurrency, + parallel, }, }, is_cwd_only, diff --git a/crates/vite_task/src/session/execute/mod.rs b/crates/vite_task/src/session/execute/mod.rs index 9fec69b1..8aba7f5b 100644 --- a/crates/vite_task/src/session/execute/mod.rs +++ b/crates/vite_task/src/session/execute/mod.rs @@ -50,10 +50,6 @@ pub enum SpawnOutcome { Failed, } -/// Maximum number of tasks that can execute concurrently within a single -/// execution graph level. -const CONCURRENCY_LIMIT: usize = 10; - /// Holds shared references needed during graph execution. /// /// The `reporter` field is wrapped in `RefCell` because concurrent futures @@ -88,17 +84,17 @@ impl ExecutionContext<'_> { /// closes the semaphore, drains remaining futures, and returns. #[tracing::instrument(level = "debug", skip_all)] async fn execute_expanded_graph(&self, graph: &ExecutionGraph) { - if graph.node_count() == 0 { + if graph.graph.node_count() == 0 { return; } - let semaphore = Arc::new(Semaphore::new(CONCURRENCY_LIMIT)); + let semaphore = Arc::new(Semaphore::new(graph.concurrency_limit)); // Compute dependency count for each node. // Edge A→B means "A depends on B", so A's dependency count = outgoing edge count. let mut dep_count: FxHashMap = FxHashMap::default(); - for node_ix in graph.node_indices() { - dep_count.insert(node_ix, graph.neighbors(node_ix).count()); + for node_ix in graph.graph.node_indices() { + dep_count.insert(node_ix, graph.graph.neighbors(node_ix).count()); } let mut futures = FuturesUnordered::new(); @@ -123,7 +119,7 @@ impl ExecutionContext<'_> { // Find dependents of the completed node (nodes that depend on it). // Edge X→completed means "X depends on completed", so X is a predecessor // in graph direction = neighbor in Incoming direction. - for dependent in graph.neighbors_directed(completed_ix, Direction::Incoming) { + for dependent in graph.graph.neighbors_directed(completed_ix, Direction::Incoming) { let count = dep_count.get_mut(&dependent).expect("all nodes are in dep_count"); *count -= 1; if *count == 0 { @@ -162,7 +158,7 @@ impl ExecutionContext<'_> { /// in order; if any item fails, `execute_leaf` cancels the `CancellationToken` /// and remaining items are skipped (preserving `&&` semantics). async fn execute_node(&self, graph: &ExecutionGraph, node_ix: ExecutionNodeIndex) { - let task_execution = &graph[node_ix]; + let task_execution = &graph.graph[node_ix]; for item in &task_execution.items { if self.cancellation_token.is_cancelled() { diff --git a/crates/vite_task/src/session/mod.rs b/crates/vite_task/src/session/mod.rs index add1633a..66697392 100644 --- a/crates/vite_task/src/session/mod.rs +++ b/crates/vite_task/src/session/mod.rs @@ -273,7 +273,7 @@ impl<'a> Session<'a> { let (graph, is_cwd_only) = self.plan_from_cli_run_resolved(cwd, run_command.clone()).await?; - if graph.node_count() == 0 { + if graph.graph.node_count() == 0 { // No tasks matched. With is_cwd_only (no scope flags) the // task name is a typo — show the selector. Otherwise error. if is_cwd_only { @@ -508,6 +508,8 @@ impl<'a> Session<'a> { plan_options: PlanOptions { extra_args: run_command.additional_args.clone().into(), cache_override: run_command.flags.cache_override(), + concurrency: None, + parallel: false, }, }) } diff --git a/crates/vite_task_plan/src/context.rs b/crates/vite_task_plan/src/context.rs index 119d68af..accb5351 100644 --- a/crates/vite_task_plan/src/context.rs +++ b/crates/vite_task_plan/src/context.rs @@ -45,12 +45,17 @@ pub struct PlanContext<'a> { /// Final resolved global cache config, combining the graph's config with any CLI override. resolved_global_cache: ResolvedGlobalCacheConfig, + /// Resolved concurrency limit inherited from the parent level. + /// At the root level this defaults to [`crate::DEFAULT_CONCURRENCY_LIMIT`]. + resolved_concurrency: usize, + /// The query that caused the current expansion. /// Used by the skip rule to detect and skip duplicate nested expansions. parent_query: Arc, } impl<'a> PlanContext<'a> { + #[expect(clippy::too_many_arguments, reason = "context initialization requires all fields")] pub fn new( workspace_path: &'a Arc, cwd: Arc, @@ -58,6 +63,7 @@ impl<'a> PlanContext<'a> { callbacks: &'a mut (dyn PlanRequestParser + 'a), indexed_task_graph: &'a IndexedTaskGraph, resolved_global_cache: ResolvedGlobalCacheConfig, + resolved_concurrency: usize, parent_query: Arc, ) -> Self { Self { @@ -69,6 +75,7 @@ impl<'a> PlanContext<'a> { indexed_task_graph, extra_args: Arc::default(), resolved_global_cache, + resolved_concurrency, parent_query, } } @@ -136,6 +143,14 @@ impl<'a> PlanContext<'a> { self.resolved_global_cache = config; } + pub const fn resolved_concurrency(&self) -> usize { + self.resolved_concurrency + } + + pub const fn set_resolved_concurrency(&mut self, concurrency: usize) { + self.resolved_concurrency = concurrency; + } + pub fn parent_query(&self) -> &TaskQuery { &self.parent_query } @@ -160,6 +175,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, + resolved_concurrency: self.resolved_concurrency, parent_query: Arc::clone(&self.parent_query), } } diff --git a/crates/vite_task_plan/src/execution_graph.rs b/crates/vite_task_plan/src/execution_graph.rs index 5a884296..8abc7faa 100644 --- a/crates/vite_task_plan/src/execution_graph.rs +++ b/crates/vite_task_plan/src/execution_graph.rs @@ -155,15 +155,44 @@ impl Index> for AcyclicGraph { } } -/// The execution graph type alias, specialized for task execution. -pub type ExecutionGraph = AcyclicGraph; - impl Serialize for AcyclicGraph { fn serialize(&self, serializer: S) -> Result { vite_graph_ser::serialize_by_key(&self.graph, serializer) } } +/// The default concurrency limit for task execution within a single graph level. +pub const DEFAULT_CONCURRENCY_LIMIT: usize = 10; + +/// An execution graph with a per-level concurrency limit. +/// +/// Wraps an [`AcyclicGraph`] of task executions together with the maximum number +/// of tasks that may run concurrently within this graph level. Nested `Expanded` +/// graphs carry their own concurrency limit, enabling per-level control. +#[derive(Debug, Serialize)] +pub struct ExecutionGraph { + /// The underlying acyclic task execution graph. + pub graph: AcyclicGraph, + + /// Maximum number of tasks that can execute concurrently within this graph level. + pub concurrency_limit: usize, +} + +impl ExecutionGraph { + /// Validate that `graph` is acyclic and wrap it in an `ExecutionGraph` with + /// the given concurrency limit. + /// + /// # Errors + /// + /// Returns [`CycleError`] if the graph contains a cycle. + pub fn try_from_graph( + graph: InnerExecutionGraph, + concurrency_limit: usize, + ) -> Result> { + Ok(Self { graph: AcyclicGraph::try_from_graph(graph)?, concurrency_limit }) + } +} + /// Find a cycle in the directed graph, returning the cycle path if one exists. /// /// Uses a DFS with predecessor tracking. When a back edge `u → v` is detected diff --git a/crates/vite_task_plan/src/lib.rs b/crates/vite_task_plan/src/lib.rs index 1420cb75..0eac570e 100644 --- a/crates/vite_task_plan/src/lib.rs +++ b/crates/vite_task_plan/src/lib.rs @@ -12,7 +12,7 @@ use std::{collections::BTreeMap, ffi::OsStr, fmt::Debug, sync::Arc}; use context::PlanContext; pub use error::Error; -pub use execution_graph::ExecutionGraph; +pub use execution_graph::{DEFAULT_CONCURRENCY_LIMIT, ExecutionGraph}; pub use in_process::InProcessExecution; pub use path_env::{get_path_env, prepend_path_env}; use plan::{ParentCacheConfig, plan_query_request, plan_synthetic_request}; @@ -138,10 +138,6 @@ pub enum LeafExecutionKind { InProcess(InProcessExecution), } -/// Serialize an `ExecutionGraph` using `serialize_by_key`. -/// -/// `vite_graph_ser::serialize_by_key` expects `&DiGraph`, so we call `.inner()` -/// to get the underlying `DiGraph` reference. /// An execution item, from a split subcommand in a task's command (`item1 && item2 && ...`). #[derive(Debug, Serialize)] #[expect( @@ -213,6 +209,7 @@ pub async fn plan_query( plan_request_parser, indexed_task_graph, resolved_global_cache, + DEFAULT_CONCURRENCY_LIMIT, Arc::clone(&query), ); plan_query_request(query, plan_options, context).await diff --git a/crates/vite_task_plan/src/plan.rs b/crates/vite_task_plan/src/plan.rs index b39bc32f..7b9da5d3 100644 --- a/crates/vite_task_plan/src/plan.rs +++ b/crates/vite_task_plan/src/plan.rs @@ -255,7 +255,7 @@ async fn plan_task_as_execution_node( // An empty execution graph means no tasks matched the query. // At the top level the session shows the task selector UI, // but in a nested context there is no UI — propagate as an error. - if execution_graph.node_count() == 0 { + if execution_graph.graph.node_count() == 0 { return Err(Error::NestPlan { task_display: task_node.task_display.clone(), command: Str::from(&command_str[add_item_span]), @@ -675,6 +675,25 @@ pub async fn plan_query_request( ); context.set_resolved_global_cache(final_cache); } + // Resolve effective concurrency for this level. + // + // When `Some(n)`, use the explicit value. When `None`, inherit from the + // parent context — unless `--parallel` is set without `--concurrency`, + // in which case use unlimited concurrency. + let effective_concurrency = match plan_options.concurrency { + Some(n) => n, + None => { + if plan_options.parallel { + usize::MAX + } else { + context.resolved_concurrency() + } + } + }; + context.set_resolved_concurrency(effective_concurrency); + + let parallel = plan_options.parallel; + context.set_extra_args(plan_options.extra_args); context.set_parent_query(Arc::clone(&query)); @@ -751,10 +770,15 @@ pub async fn plan_query_request( } } + // If --parallel, discard all edges so tasks run independently. + if parallel { + inner_graph.clear_edges(); + } + // Validate the graph is acyclic. // `try_from_graph` performs a DFS; if a cycle is found, it returns // `CycleError` containing the full cycle path as node indices. - ExecutionGraph::try_from_graph(inner_graph).map_err(|cycle| { + ExecutionGraph::try_from_graph(inner_graph, effective_concurrency).map_err(|cycle| { // Map each execution node index in the cycle path to its human-readable TaskDisplay. // Every node in the cycle was added via `inner_graph.add_node()` above, // with a corresponding entry in `execution_node_indices_by_task_index`. diff --git a/crates/vite_task_plan/src/plan_request.rs b/crates/vite_task_plan/src/plan_request.rs index eb5716f5..5f9e622a 100644 --- a/crates/vite_task_plan/src/plan_request.rs +++ b/crates/vite_task_plan/src/plan_request.rs @@ -49,6 +49,13 @@ pub enum CacheOverride { pub struct PlanOptions { pub extra_args: Arc<[Str]>, pub cache_override: CacheOverride, + /// Per-level concurrency limit. `None` means inherit from the parent level + /// (or default to [`crate::DEFAULT_CONCURRENCY_LIMIT`] at the root). + pub concurrency: Option, + /// When `true`, discard dependency edges between tasks at this level, + /// running all tasks as independent. If `concurrency` is also `None`, + /// this sets the effective concurrency to `usize::MAX`. + pub parallel: bool, } #[derive(Debug)] diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/additional-env/snapshots/query - tool synthetic task in user task.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/additional-env/snapshots/query - tool synthetic task in user task.snap index e998b35c..f0430ac1 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/additional-env/snapshots/query - tool synthetic task in user task.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/additional-env/snapshots/query - tool synthetic task in user task.snap @@ -7,87 +7,90 @@ info: - env-test input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/additional-env --- -[ - { - "key": [ - "/", - "env-test" - ], - "node": { - "task_display": { - "package_name": "additional-envs", - "task_name": "env-test", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "additional-envs", - "task_name": "env-test", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "env-test" + ], + "node": { + "task_display": { + "package_name": "additional-envs", + "task_name": "env-test", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "additional-envs", + "task_name": "env-test", + "package_path": "/" + }, + "command": "TEST_VAR=hello_world vt tool print-env TEST_VAR", + "and_item_index": null, + "cwd": "/" }, - "command": "TEST_VAR=hello_world vt tool print-env TEST_VAR", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-env", + "TEST_VAR" + ], + "env_fingerprints": { + "fingerprinted_envs": { + "TEST_VAR": "hello_world" + }, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "env-test", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print-env", "TEST_VAR" ], - "env_fingerprints": { - "fingerprinted_envs": { - "TEST_VAR": "hello_world" - }, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "env-test", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:", + "TEST_VAR": "hello_world" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-env", - "TEST_VAR" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:", - "TEST_VAR": "hello_world" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache does not override per-task cache false.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache does not override per-task cache false.snap index 96229013..47a56b6d 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache does not override per-task cache false.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache does not override per-task cache false.snap @@ -8,52 +8,55 @@ info: - deploy input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override --- -[ - { - "key": [ - "/", - "deploy" - ], - "node": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "deploy", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "deploy", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "deploy" + ], + "node": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "deploy", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "deploy", + "package_path": "/" + }, + "command": "vtt print-file vite-task.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file vite-task.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "vite-task.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "vite-task.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables script caching.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables script caching.snap index a86068f2..482c1a6e 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables script caching.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables script caching.snap @@ -8,84 +8,87 @@ info: - test input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override --- -[ - { - "key": [ - "/", - "test" - ], - "node": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "test", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "test", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "test" + ], + "node": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "test", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "test", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "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": "test", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print-file", "package.json" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "test", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables task caching even when cache.tasks is false.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables task caching even when cache.tasks is false.snap index 43d87f5d..11d183e0 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables task caching even when cache.tasks is false.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables task caching even when cache.tasks is false.snap @@ -8,84 +8,87 @@ info: - build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override --- -[ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "build", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "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", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print-file", "package.json" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache on task with per-task cache true enables caching.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache on task with per-task cache true enables caching.snap index c468954c..98b9b587 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache on task with per-task cache true enables caching.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache on task with per-task cache true enables caching.snap @@ -8,84 +8,87 @@ info: - check input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override --- -[ - { - "key": [ - "/", - "check" - ], - "node": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "check", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "check", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "check" + ], + "node": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "check", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "check", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "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": "check", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print-file", "package.json" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "check", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache disables task caching.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache disables task caching.snap index 54847471..5740231e 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache disables task caching.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache disables task caching.snap @@ -8,52 +8,55 @@ info: - build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override --- -[ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "build", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache overrides per-task cache true.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache overrides per-task cache true.snap index 80e8a5d3..ca4288be 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache overrides per-task cache true.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache overrides per-task cache true.snap @@ -8,52 +8,55 @@ info: - check input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override --- -[ - { - "key": [ - "/", - "check" - ], - "node": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "check", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "check", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "check" + ], + "node": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "check", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "check", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - baseline - tasks not cached when cache.tasks is false.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - baseline - tasks not cached when cache.tasks is false.snap index aeeb3a97..a3e01aaf 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - baseline - tasks not cached when cache.tasks is false.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - baseline - tasks not cached when cache.tasks is false.snap @@ -7,52 +7,55 @@ info: - build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override --- -[ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-cli-override", - "task_name": "build", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-cli-override", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - echo and lint with extra args.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - echo and lint with extra args.snap index 369af88a..cea88ef6 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - echo and lint with extra args.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - echo and lint with extra args.snap @@ -8,114 +8,117 @@ info: - "--fix" input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys --- -[ - { - "key": [ - "/", - "echo-and-lint" - ], - "node": { - "task_display": { - "package_name": "", - "task_name": "echo-and-lint", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "echo-and-lint", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "echo-and-lint" + ], + "node": { + "task_display": { + "package_name": "", + "task_name": "echo-and-lint", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "echo-and-lint", + "package_path": "/" + }, + "command": "echo Linting", + "and_item_index": 0, + "cwd": "/" }, - "command": "echo Linting", - "and_item_index": 0, - "cwd": "/" - }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "Linting" - ], - "trailing_newline": true + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "Linting" + ], + "trailing_newline": true + } } } } } - } - }, - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "echo-and-lint", - "package_path": "/" - }, - "command": "vt tool print lint --fix", - "and_item_index": 1, - "cwd": "/" }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "echo-and-lint", + "package_path": "/" + }, + "command": "vt tool print lint --fix", + "and_item_index": 1, + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print", + "lint", + "--fix" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] } }, + "execution_cache_key": { + "UserTask": { + "task_name": "echo-and-lint", + "and_item_index": 1, + "extra_args": [ + "--fix" + ], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print", "lint", "--fix" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "echo-and-lint", - "and_item_index": 1, - "extra_args": [ - "--fix" - ], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint", - "--fix" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - lint and echo with extra args.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - lint and echo with extra args.snap index 47c93c91..6e024c4d 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - lint and echo with extra args.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - lint and echo with extra args.snap @@ -8,110 +8,113 @@ info: - Linting complete input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys --- -[ - { - "key": [ - "/", - "lint-and-echo" - ], - "node": { - "task_display": { - "package_name": "", - "task_name": "lint-and-echo", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "lint-and-echo", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "lint-and-echo" + ], + "node": { + "task_display": { + "package_name": "", + "task_name": "lint-and-echo", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "lint-and-echo", + "package_path": "/" + }, + "command": "vt tool print lint", + "and_item_index": 0, + "cwd": "/" }, - "command": "vt tool print lint", - "and_item_index": 0, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print", + "lint" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "lint-and-echo", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print", "lint" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "lint-and-echo", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } - } - }, - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "lint-and-echo", - "package_path": "/" - }, - "command": "echo 'Linting complete'", - "and_item_index": 1, - "cwd": "/" }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "Linting complete" - ], - "trailing_newline": true + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "lint-and-echo", + "package_path": "/" + }, + "command": "echo 'Linting complete'", + "and_item_index": 1, + "cwd": "/" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "Linting complete" + ], + "trailing_newline": true + } } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - normal task with extra args.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - normal task with extra args.snap index 32b9abdd..2d559adb 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - normal task with extra args.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - normal task with extra args.snap @@ -8,86 +8,89 @@ info: - a.txt input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys --- -[ - { - "key": [ - "/", - "hello" - ], - "node": { - "task_display": { - "package_name": "", - "task_name": "hello", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "hello", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "hello" + ], + "node": { + "task_display": { + "package_name": "", + "task_name": "hello", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "hello", + "package_path": "/" + }, + "command": "vtt print-file a.txt", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file a.txt", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print-file", + "a.txt" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "hello", + "and_item_index": 0, + "extra_args": [ + "a.txt" + ], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print-file", "a.txt" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "hello", - "and_item_index": 0, - "extra_args": [ - "a.txt" - ], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "a.txt" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task with cwd.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task with cwd.snap index 0f6f310b..0f22972f 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task with cwd.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task with cwd.snap @@ -8,84 +8,87 @@ info: cwd: subdir input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys --- -[ - { - "key": [ - "/", - "lint" - ], - "node": { - "task_display": { - "package_name": "", - "task_name": "lint", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "lint", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "lint" + ], + "node": { + "task_display": { + "package_name": "", + "task_name": "lint", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "lint", + "package_path": "/" + }, + "command": "vt tool print lint", + "and_item_index": null, + "cwd": "/" }, - "command": "vt tool print lint", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print", + "lint" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "lint", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print", "lint" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "lint", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task.snap index 13da929a..26c8fdc2 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task.snap @@ -7,84 +7,87 @@ info: - lint input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys --- -[ - { - "key": [ - "/", - "lint" - ], - "node": { - "task_display": { - "package_name": "", - "task_name": "lint", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "lint", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "lint" + ], + "node": { + "task_display": { + "package_name": "", + "task_name": "lint", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "lint", + "package_path": "/" + }, + "command": "vt tool print lint", + "and_item_index": null, + "cwd": "/" }, - "command": "vt tool print lint", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print", + "lint" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "lint", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print", "lint" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "lint", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task with extra args in user task.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task with extra args in user task.snap index 1ad6b8d8..4ad41409 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task with extra args in user task.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task with extra args in user task.snap @@ -8,88 +8,91 @@ info: - "--fix" input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys --- -[ - { - "key": [ - "/", - "lint" - ], - "node": { - "task_display": { - "package_name": "", - "task_name": "lint", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "lint", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "lint" + ], + "node": { + "task_display": { + "package_name": "", + "task_name": "lint", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "lint", + "package_path": "/" + }, + "command": "vt tool print lint --fix", + "and_item_index": null, + "cwd": "/" }, - "command": "vt tool print lint --fix", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print", + "lint", + "--fix" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "lint", + "and_item_index": 0, + "extra_args": [ + "--fix" + ], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print", "lint", "--fix" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "lint", - "and_item_index": 0, - "extra_args": [ - "--fix" - ], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint", - "--fix" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-default/snapshots/query - script not cached by default.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-default/snapshots/query - script not cached by default.snap index 91936614..d1425825 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-default/snapshots/query - script not cached by default.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-default/snapshots/query - script not cached by default.snap @@ -7,52 +7,55 @@ info: - build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-default --- -[ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/cache-scripts-default", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-scripts-default", - "task_name": "build", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/cache-scripts-default", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-scripts-default", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - another task cached by default.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - another task cached by default.snap index 63557fe5..c630f7fc 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - another task cached by default.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - another task cached by default.snap @@ -7,84 +7,87 @@ info: - deploy input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override --- -[ - { - "key": [ - "/", - "deploy" - ], - "node": { - "task_display": { - "package_name": "@test/cache-scripts-task-override", - "task_name": "deploy", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-scripts-task-override", - "task_name": "deploy", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "deploy" + ], + "node": { + "task_display": { + "package_name": "@test/cache-scripts-task-override", + "task_name": "deploy", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-scripts-task-override", + "task_name": "deploy", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "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": "deploy", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print-file", "package.json" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "deploy", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - script not cached by default.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - script not cached by default.snap index bb7aaffb..b925313d 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - script not cached by default.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - script not cached by default.snap @@ -7,52 +7,55 @@ info: - test input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override --- -[ - { - "key": [ - "/", - "test" - ], - "node": { - "task_display": { - "package_name": "@test/cache-scripts-task-override", - "task_name": "test", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-scripts-task-override", - "task_name": "test", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "test" + ], + "node": { + "task_display": { + "package_name": "@test/cache-scripts-task-override", + "task_name": "test", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-scripts-task-override", + "task_name": "test", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - task cached by default.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - task cached by default.snap index 54467767..c6e0df57 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - task cached by default.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - task cached by default.snap @@ -7,84 +7,87 @@ info: - build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override --- -[ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/cache-scripts-task-override", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-scripts-task-override", - "task_name": "build", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/cache-scripts-task-override", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-scripts-task-override", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "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", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print-file", "package.json" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-subcommand/snapshots/query - cache clean in script.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-subcommand/snapshots/query - cache clean in script.snap index 7594b7d3..0f665801 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-subcommand/snapshots/query - cache clean in script.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-subcommand/snapshots/query - cache clean in script.snap @@ -7,52 +7,55 @@ info: - clean-cache input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-subcommand --- -[ - { - "key": [ - "/", - "clean-cache" - ], - "node": { - "task_display": { - "package_name": "@test/cache-subcommand", - "task_name": "clean-cache", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-subcommand", - "task_name": "clean-cache", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "clean-cache" + ], + "node": { + "task_display": { + "package_name": "@test/cache-subcommand", + "task_name": "clean-cache", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-subcommand", + "task_name": "clean-cache", + "package_path": "/" + }, + "command": "vt cache clean", + "and_item_index": null, + "cwd": "/" }, - "command": "vt cache clean", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/node_modules/.bin/vt", - "args": [ - "cache", - "clean" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/node_modules/.bin/vt", + "args": [ + "cache", + "clean" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - per-task cache true still disabled by cache.tasks false.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - per-task cache true still disabled by cache.tasks false.snap index 6a53eb9f..8ce39c16 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - per-task cache true still disabled by cache.tasks false.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - per-task cache true still disabled by cache.tasks false.snap @@ -7,52 +7,55 @@ info: - deploy input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled --- -[ - { - "key": [ - "/", - "deploy" - ], - "node": { - "task_display": { - "package_name": "@test/cache-tasks-disabled", - "task_name": "deploy", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-tasks-disabled", - "task_name": "deploy", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "deploy" + ], + "node": { + "task_display": { + "package_name": "@test/cache-tasks-disabled", + "task_name": "deploy", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-tasks-disabled", + "task_name": "deploy", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - script not cached.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - script not cached.snap index 796d0c9e..2a22104d 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - script not cached.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - script not cached.snap @@ -7,52 +7,55 @@ info: - test input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled --- -[ - { - "key": [ - "/", - "test" - ], - "node": { - "task_display": { - "package_name": "@test/cache-tasks-disabled", - "task_name": "test", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-tasks-disabled", - "task_name": "test", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "test" + ], + "node": { + "task_display": { + "package_name": "@test/cache-tasks-disabled", + "task_name": "test", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-tasks-disabled", + "task_name": "test", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - task not cached when cache.tasks is false.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - task not cached when cache.tasks is false.snap index 99ede03b..0e8ad817 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - task not cached when cache.tasks is false.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - task not cached when cache.tasks is false.snap @@ -7,52 +7,55 @@ info: - build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled --- -[ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/cache-tasks-disabled", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-tasks-disabled", - "task_name": "build", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/cache-tasks-disabled", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-tasks-disabled", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - script cached when global cache true.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - script cached when global cache true.snap index 33282150..870886ab 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - script cached when global cache true.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - script cached when global cache true.snap @@ -7,84 +7,87 @@ info: - test input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable --- -[ - { - "key": [ - "/", - "test" - ], - "node": { - "task_display": { - "package_name": "@test/cache-true-no-force-enable", - "task_name": "test", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-true-no-force-enable", - "task_name": "test", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "test" + ], + "node": { + "task_display": { + "package_name": "@test/cache-true-no-force-enable", + "task_name": "test", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-true-no-force-enable", + "task_name": "test", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "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": "test", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print-file", "package.json" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "test", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task cached when global cache true.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task cached when global cache true.snap index feb7b2ee..981f8be5 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task cached when global cache true.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task cached when global cache true.snap @@ -7,84 +7,87 @@ info: - deploy input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable --- -[ - { - "key": [ - "/", - "deploy" - ], - "node": { - "task_display": { - "package_name": "@test/cache-true-no-force-enable", - "task_name": "deploy", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-true-no-force-enable", - "task_name": "deploy", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "deploy" + ], + "node": { + "task_display": { + "package_name": "@test/cache-true-no-force-enable", + "task_name": "deploy", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-true-no-force-enable", + "task_name": "deploy", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "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": "deploy", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print-file", "package.json" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "deploy", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task with cache false not cached despite global cache true.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task with cache false not cached despite global cache true.snap index d87eb446..390b5919 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task with cache false not cached despite global cache true.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task with cache false not cached despite global cache true.snap @@ -7,52 +7,55 @@ info: - build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable --- -[ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/cache-true-no-force-enable", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/cache-true-no-force-enable", - "task_name": "build", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/cache-true-no-force-enable", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/cache-true-no-force-enable", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt lint should put synthetic task under cwd.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt lint should put synthetic task under cwd.snap index 10b37328..d9cfb50d 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt lint should put synthetic task under cwd.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt lint should put synthetic task under cwd.snap @@ -7,84 +7,87 @@ info: - cd-lint input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts --- -[ - { - "key": [ - "/", - "cd-lint" - ], - "node": { - "task_display": { - "package_name": "", - "task_name": "cd-lint", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "cd-lint", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "cd-lint" + ], + "node": { + "task_display": { + "package_name": "", + "task_name": "cd-lint", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "cd-lint", + "package_path": "/" + }, + "command": "vt tool print lint", + "and_item_index": 1, + "cwd": "/src" }, - "command": "vt tool print lint", - "and_item_index": 1, - "cwd": "/src" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "src", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "src", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print", + "lint" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "cd-lint", + "and_item_index": 1, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print", "lint" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "cd-lint", - "and_item_index": 1, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/src" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/src" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt run should not affect expanded task cwd.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt run should not affect expanded task cwd.snap index 90a78acb..ef5d64bd 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt run should not affect expanded task cwd.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt run should not affect expanded task cwd.snap @@ -7,116 +7,122 @@ info: - cd-build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts --- -[ - { - "key": [ - "/", - "cd-build" - ], - "node": { - "task_display": { - "package_name": "", - "task_name": "cd-build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "cd-build", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "cd-build" + ], + "node": { + "task_display": { + "package_name": "", + "task_name": "cd-build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "cd-build", + "package_path": "/" + }, + "command": "vt run build", + "and_item_index": 1, + "cwd": "/src" }, - "command": "vt run build", - "and_item_index": 1, - "cwd": "/src" - }, - "kind": { - "Expanded": [ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "build", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "", + "task_name": "build", + "package_path": "/" }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "build", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "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", + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] } }, - "args": [ - "print-file", - "package.json" - ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "and_item_index": 0, - "extra_args": [], - "package_path": "" + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } - } - } - ] - }, - "neighbors": [] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 } - ] + } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --cache enables inner task caching.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --cache enables inner task caching.snap index 6009b4ad..31733753 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --cache enables inner task caching.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --cache enables inner task caching.snap @@ -7,116 +7,122 @@ info: - outer-cache input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override --- -[ - { - "key": [ - "/", - "outer-cache" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-cache", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-cache", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "outer-cache" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-cache", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-cache", + "package_path": "/" + }, + "command": "vt run --cache inner", + "and_item_index": null, + "cwd": "/" }, - "command": "vt run --cache inner", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Expanded": [ - { - "key": [ - "/", - "inner" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "inner" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "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": "inner", + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] } }, - "args": [ - "print-file", - "package.json" - ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "inner", - "and_item_index": 0, - "extra_args": [], - "package_path": "" + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } - } - } - ] - }, - "neighbors": [] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 } - ] + } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --no-cache disables inner task caching.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --no-cache disables inner task caching.snap index 7c79d052..84fbcb7c 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --no-cache disables inner task caching.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --no-cache disables inner task caching.snap @@ -7,84 +7,90 @@ info: - outer-no-cache input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override --- -[ - { - "key": [ - "/", - "outer-no-cache" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-no-cache", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-no-cache", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "outer-no-cache" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-no-cache", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-no-cache", + "package_path": "/" + }, + "command": "vt run --no-cache inner", + "and_item_index": null, + "cwd": "/" }, - "command": "vt run --no-cache inner", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Expanded": [ - { - "key": [ - "/", - "inner" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "inner" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } + } } } } - } - } - ] - }, - "neighbors": [] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 } - ] + } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested run without flags inherits parent cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested run without flags inherits parent cache.snap index e645edb2..162a2be6 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested run without flags inherits parent cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested run without flags inherits parent cache.snap @@ -7,84 +7,90 @@ info: - outer-inherit input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override --- -[ - { - "key": [ - "/", - "outer-inherit" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-inherit", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-inherit", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "outer-inherit" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-inherit", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-inherit", + "package_path": "/" + }, + "command": "vt run inner", + "and_item_index": null, + "cwd": "/" }, - "command": "vt run inner", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Expanded": [ - { - "key": [ - "/", - "inner" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "inner" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } + } } } } - } - } - ] - }, - "neighbors": [] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 } - ] + } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --cache propagates to nested run without flags.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --cache propagates to nested run without flags.snap index f16cc13a..65933b80 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --cache propagates to nested run without flags.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --cache propagates to nested run without flags.snap @@ -8,116 +8,122 @@ info: - outer-inherit input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override --- -[ - { - "key": [ - "/", - "outer-inherit" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-inherit", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-inherit", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "outer-inherit" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-inherit", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-inherit", + "package_path": "/" + }, + "command": "vt run inner", + "and_item_index": null, + "cwd": "/" }, - "command": "vt run inner", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Expanded": [ - { - "key": [ - "/", - "inner" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "inner" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "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": "inner", + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] } }, - "args": [ - "print-file", - "package.json" - ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "inner", - "and_item_index": 0, - "extra_args": [], - "package_path": "" + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } - } - } - ] - }, - "neighbors": [] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 } - ] + } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache does not propagate into nested --cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache does not propagate into nested --cache.snap index fb6b11cd..a0e47054 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache does not propagate into nested --cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache does not propagate into nested --cache.snap @@ -8,116 +8,122 @@ info: - outer-cache input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override --- -[ - { - "key": [ - "/", - "outer-cache" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-cache", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-cache", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "outer-cache" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-cache", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-cache", + "package_path": "/" + }, + "command": "vt run --cache inner", + "and_item_index": null, + "cwd": "/" }, - "command": "vt run --cache inner", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Expanded": [ - { - "key": [ - "/", - "inner" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "inner" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "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": "inner", + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] } }, - "args": [ - "print-file", - "package.json" - ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "inner", - "and_item_index": 0, - "extra_args": [], - "package_path": "" + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } - } - } - ] - }, - "neighbors": [] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 } - ] + } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache propagates to nested run without flags.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache propagates to nested run without flags.snap index 5e754c41..255457ce 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache propagates to nested run without flags.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache propagates to nested run without flags.snap @@ -8,84 +8,90 @@ info: - outer-inherit input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override --- -[ - { - "key": [ - "/", - "outer-inherit" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-inherit", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "outer-inherit", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "outer-inherit" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-inherit", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "outer-inherit", + "package_path": "/" + }, + "command": "vt run inner", + "and_item_index": null, + "cwd": "/" }, - "command": "vt run inner", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Expanded": [ - { - "key": [ - "/", - "inner" - ], - "node": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/nested-cache-override", - "task_name": "inner", - "package_path": "/" - }, - "command": "vtt print-file package.json", - "and_item_index": null, - "cwd": "/" + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "inner" + ], + "node": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print-file", - "package.json" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/nested-cache-override", + "task_name": "inner", + "package_path": "/" + }, + "command": "vtt print-file package.json", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print-file", + "package.json" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } + } } } } - } - } - ] - }, - "neighbors": [] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 } - ] + } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/package.json b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/package.json new file mode 100644 index 00000000..56cd9c6a --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-workspace", + "private": true, + "scripts": { + "build": "vt run -r build", + "build-with-concurrency": "vt run -r --concurrency 5 build" + } +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/a/package.json b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/a/package.json new file mode 100644 index 00000000..e429c6e0 --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/a/package.json @@ -0,0 +1,10 @@ +{ + "name": "@test/a", + "version": "1.0.0", + "scripts": { + "build": "echo building a" + }, + "dependencies": { + "@test/b": "workspace:*" + } +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/b/package.json b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/b/package.json new file mode 100644 index 00000000..47183f5a --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/b/package.json @@ -0,0 +1,10 @@ +{ + "name": "@test/b", + "version": "1.0.0", + "scripts": { + "build": "echo building b" + }, + "dependencies": { + "@test/c": "workspace:*" + } +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/c/package.json b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/c/package.json new file mode 100644 index 00000000..fb2d4b42 --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/packages/c/package.json @@ -0,0 +1,7 @@ +{ + "name": "@test/c", + "version": "1.0.0", + "scripts": { + "build": "echo building c" + } +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/pnpm-workspace.yaml b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/pnpm-workspace.yaml new file mode 100644 index 00000000..18ec407e --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - 'packages/*' diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml new file mode 100644 index 00000000..455238a7 --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml @@ -0,0 +1,42 @@ +# Baseline: normal recursive build preserves topo edges +[[plan]] +name = "baseline recursive build" +args = ["run", "-r", "build"] +compact = true + +# --parallel discards all edges at this level +[[plan]] +name = "parallel discards edges" +args = ["run", "-r", "--parallel", "build"] +compact = true + +# --parallel only affects the current level; nested Expanded graph preserves edges +[[plan]] +name = "parallel only affects current level" +args = ["run", "--parallel", "build"] +compact = true + +# --concurrency with explicit value +[[plan]] +name = "concurrency with explicit value" +args = ["run", "-r", "--concurrency", "5", "build"] + +# --parallel without --concurrency sets concurrency to max +[[plan]] +name = "parallel without concurrency" +args = ["run", "-r", "--parallel", "build"] + +# --parallel with --concurrency uses explicit concurrency, not max +[[plan]] +name = "parallel with concurrency" +args = ["run", "-r", "--parallel", "--concurrency", "3", "build"] + +# Nested vt run inherits parent concurrency +[[plan]] +name = "nested inherits parent concurrency" +args = ["run", "--concurrency", "2", "build"] + +# Nested vt run with explicit --concurrency overrides parent +[[plan]] +name = "nested overrides parent concurrency" +args = ["run", "--concurrency", "2", "build-with-concurrency"] diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - baseline recursive build.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - baseline recursive build.snap new file mode 100644 index 00000000..70c370c3 --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - baseline recursive build.snap @@ -0,0 +1,20 @@ +--- +source: crates/vite_task_plan/tests/plan_snapshots/main.rs +expression: "&compact_plan" +info: + args: + - run + - "-r" + - build +input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency +--- +{ + "#build": [], + "packages/a#build": [ + "packages/b#build" + ], + "packages/b#build": [ + "packages/c#build" + ], + "packages/c#build": [] +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - concurrency with explicit value.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - concurrency with explicit value.snap new file mode 100644 index 00000000..1fbf2214 --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - concurrency with explicit value.snap @@ -0,0 +1,171 @@ +--- +source: crates/vite_task_plan/tests/plan_snapshots/main.rs +expression: "&plan_json" +info: + args: + - run + - "-r" + - "--concurrency" + - "5" + - build +input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency +--- +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build", + "package_path": "/" + }, + "items": [] + }, + "neighbors": [] + }, + { + "key": [ + "/packages/a", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "command": "echo building a", + "and_item_index": null, + "cwd": "/packages/a" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "a" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [ + [ + "/packages/b", + "build" + ] + ] + }, + { + "key": [ + "/packages/b", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "command": "echo building b", + "and_item_index": null, + "cwd": "/packages/b" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "b" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [ + [ + "/packages/c", + "build" + ] + ] + }, + { + "key": [ + "/packages/c", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "command": "echo building c", + "and_item_index": null, + "cwd": "/packages/c" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "c" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 5 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap new file mode 100644 index 00000000..e1f6a32e --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap @@ -0,0 +1,190 @@ +--- +source: crates/vite_task_plan/tests/plan_snapshots/main.rs +expression: "&plan_json" +info: + args: + - run + - "--concurrency" + - "2" + - build +input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency +--- +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build", + "package_path": "/" + }, + "command": "vt run -r build", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/packages/a", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "command": "echo building a", + "and_item_index": null, + "cwd": "/packages/a" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "a" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [ + [ + "/packages/b", + "build" + ] + ] + }, + { + "key": [ + "/packages/b", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "command": "echo building b", + "and_item_index": null, + "cwd": "/packages/b" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "b" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [ + [ + "/packages/c", + "build" + ] + ] + }, + { + "key": [ + "/packages/c", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "command": "echo building c", + "and_item_index": null, + "cwd": "/packages/c" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "c" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 2 + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 2 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested overrides parent concurrency.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested overrides parent concurrency.snap new file mode 100644 index 00000000..a8b8ee2a --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested overrides parent concurrency.snap @@ -0,0 +1,205 @@ +--- +source: crates/vite_task_plan/tests/plan_snapshots/main.rs +expression: "&plan_json" +info: + args: + - run + - "--concurrency" + - "2" + - build-with-concurrency +input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency +--- +{ + "graph": [ + { + "key": [ + "/", + "build-with-concurrency" + ], + "node": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build-with-concurrency", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build-with-concurrency", + "package_path": "/" + }, + "command": "vt run -r --concurrency 5 build", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build", + "package_path": "/" + }, + "items": [] + }, + "neighbors": [] + }, + { + "key": [ + "/packages/a", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "command": "echo building a", + "and_item_index": null, + "cwd": "/packages/a" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "a" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [ + [ + "/packages/b", + "build" + ] + ] + }, + { + "key": [ + "/packages/b", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "command": "echo building b", + "and_item_index": null, + "cwd": "/packages/b" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "b" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [ + [ + "/packages/c", + "build" + ] + ] + }, + { + "key": [ + "/packages/c", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "command": "echo building c", + "and_item_index": null, + "cwd": "/packages/c" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "c" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 5 + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 2 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel discards edges.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel discards edges.snap new file mode 100644 index 00000000..71abf02d --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel discards edges.snap @@ -0,0 +1,17 @@ +--- +source: crates/vite_task_plan/tests/plan_snapshots/main.rs +expression: "&compact_plan" +info: + args: + - run + - "-r" + - "--parallel" + - build +input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency +--- +{ + "#build": [], + "packages/a#build": [], + "packages/b#build": [], + "packages/c#build": [] +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel only affects current level.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel only affects current level.snap new file mode 100644 index 00000000..bb9d06db --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel only affects current level.snap @@ -0,0 +1,26 @@ +--- +source: crates/vite_task_plan/tests/plan_snapshots/main.rs +expression: "&compact_plan" +info: + args: + - run + - "--parallel" + - build +input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency +--- +{ + "#build": { + "items": [ + { + "packages/a#build": [ + "packages/b#build" + ], + "packages/b#build": [ + "packages/c#build" + ], + "packages/c#build": [] + } + ], + "neighbors": [] + } +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel with concurrency.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel with concurrency.snap new file mode 100644 index 00000000..dc9831f6 --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel with concurrency.snap @@ -0,0 +1,162 @@ +--- +source: crates/vite_task_plan/tests/plan_snapshots/main.rs +expression: "&plan_json" +info: + args: + - run + - "-r" + - "--parallel" + - "--concurrency" + - "3" + - build +input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency +--- +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build", + "package_path": "/" + }, + "items": [] + }, + "neighbors": [] + }, + { + "key": [ + "/packages/a", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "command": "echo building a", + "and_item_index": null, + "cwd": "/packages/a" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "a" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [] + }, + { + "key": [ + "/packages/b", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "command": "echo building b", + "and_item_index": null, + "cwd": "/packages/b" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "b" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [] + }, + { + "key": [ + "/packages/c", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "command": "echo building c", + "and_item_index": null, + "cwd": "/packages/c" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "c" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 3 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel without concurrency.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel without concurrency.snap new file mode 100644 index 00000000..55c94875 --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel without concurrency.snap @@ -0,0 +1,160 @@ +--- +source: crates/vite_task_plan/tests/plan_snapshots/main.rs +expression: "&plan_json" +info: + args: + - run + - "-r" + - "--parallel" + - build +input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency +--- +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build", + "package_path": "/" + }, + "items": [] + }, + "neighbors": [] + }, + { + "key": [ + "/packages/a", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "command": "echo building a", + "and_item_index": null, + "cwd": "/packages/a" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "a" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [] + }, + { + "key": [ + "/packages/b", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "command": "echo building b", + "and_item_index": null, + "cwd": "/packages/b" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "b" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [] + }, + { + "key": [ + "/packages/c", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "command": "echo building c", + "and_item_index": null, + "cwd": "/packages/c" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "c" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 18446744073709551615 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/task graph.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/task graph.snap new file mode 100644 index 00000000..6ef5ee97 --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/task graph.snap @@ -0,0 +1,177 @@ +--- +source: crates/vite_task_plan/tests/plan_snapshots/main.rs +expression: task_graph_json +input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency +--- +[ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build", + "package_path": "/" + }, + "resolved_config": { + "command": "vt run -r build", + "resolved_options": { + "cwd": "/", + "cache_config": { + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" + }, + "neighbors": [] + }, + { + "key": [ + "/", + "build-with-concurrency" + ], + "node": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build-with-concurrency", + "package_path": "/" + }, + "resolved_config": { + "command": "vt run -r --concurrency 5 build", + "resolved_options": { + "cwd": "/", + "cache_config": { + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" + }, + "neighbors": [] + }, + { + "key": [ + "/packages/a", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "resolved_config": { + "command": "echo building a", + "resolved_options": { + "cwd": "/packages/a", + "cache_config": { + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" + }, + "neighbors": [] + }, + { + "key": [ + "/packages/b", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "resolved_config": { + "command": "echo building b", + "resolved_options": { + "cwd": "/packages/b", + "cache_config": { + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" + }, + "neighbors": [] + }, + { + "key": [ + "/packages/c", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "resolved_config": { + "command": "echo building c", + "resolved_options": { + "cwd": "/packages/c", + "cache_config": { + "env_config": { + "fingerprinted_envs": [], + "untracked_env": [ + "" + ] + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + } + } + }, + "source": "PackageJsonScript" + }, + "neighbors": [] + } +] diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/vite-task.json b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/vite-task.json new file mode 100644 index 00000000..d548edfa --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/vite-task.json @@ -0,0 +1,3 @@ +{ + "cache": true +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-disabled/snapshots/query - test runs without hooks when disabled.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-disabled/snapshots/query - test runs without hooks when disabled.snap index ee7d6ecd..1cf2bc01 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-disabled/snapshots/query - test runs without hooks when disabled.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-disabled/snapshots/query - test runs without hooks when disabled.snap @@ -7,47 +7,50 @@ info: - test input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-disabled --- -[ - { - "key": [ - "/", - "test" - ], - "node": { - "task_display": { - "package_name": "@test/script-hooks-disabled", - "task_name": "test", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks-disabled", - "task_name": "test", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "test" + ], + "node": { + "task_display": { + "package_name": "@test/script-hooks-disabled", + "task_name": "test", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks-disabled", + "task_name": "test", + "package_path": "/" + }, + "command": "echo test", + "and_item_index": null, + "cwd": "/" }, - "command": "echo test", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "test" - ], - "trailing_newline": true + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "test" + ], + "trailing_newline": true + } } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-nested-run/snapshots/query - prescriptInHook runs when scriptInHook is called from a hook.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-nested-run/snapshots/query - prescriptInHook runs when scriptInHook is called from a hook.snap index 148cbdfd..3ba05e30 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-nested-run/snapshots/query - prescriptInHook runs when scriptInHook is called from a hook.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-nested-run/snapshots/query - prescriptInHook runs when scriptInHook is called from a hook.snap @@ -7,131 +7,137 @@ info: - test input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-nested-run --- -[ - { - "key": [ - "/", - "test" - ], - "node": { - "task_display": { - "package_name": "@test/script-hooks-nested-run", - "task_name": "test", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks-nested-run", - "task_name": "pretest", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "test" + ], + "node": { + "task_display": { + "package_name": "@test/script-hooks-nested-run", + "task_name": "test", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks-nested-run", + "task_name": "pretest", + "package_path": "/" + }, + "command": "vt run scriptInHook", + "and_item_index": null, + "cwd": "/" }, - "command": "vt run scriptInHook", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Expanded": [ - { - "key": [ - "/", - "scriptInHook" - ], - "node": { - "task_display": { - "package_name": "@test/script-hooks-nested-run", - "task_name": "scriptInHook", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks-nested-run", - "task_name": "prescriptInHook", - "package_path": "/" - }, - "command": "echo prescriptInHook", - "and_item_index": null, - "cwd": "/" + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "scriptInHook" + ], + "node": { + "task_display": { + "package_name": "@test/script-hooks-nested-run", + "task_name": "scriptInHook", + "package_path": "/" }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "prescriptInHook" - ], - "trailing_newline": true + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks-nested-run", + "task_name": "prescriptInHook", + "package_path": "/" + }, + "command": "echo prescriptInHook", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "prescriptInHook" + ], + "trailing_newline": true + } + } } } } - } - } - }, - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks-nested-run", - "task_name": "scriptInHook", - "package_path": "/" }, - "command": "echo scriptInHook", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "scriptInHook" - ], - "trailing_newline": true + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks-nested-run", + "task_name": "scriptInHook", + "package_path": "/" + }, + "command": "echo scriptInHook", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "scriptInHook" + ], + "trailing_newline": true + } + } } } } } - } - } - ] - }, - "neighbors": [] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 } - ] - } - }, - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks-nested-run", - "task_name": "test", - "package_path": "/" - }, - "command": "echo test", - "and_item_index": null, - "cwd": "/" + } }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "test" - ], - "trailing_newline": true + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks-nested-run", + "task_name": "test", + "package_path": "/" + }, + "command": "echo test", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "test" + ], + "trailing_newline": true + } } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-task-no-hook/snapshots/query - task config test does not expand pretest hook.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-task-no-hook/snapshots/query - task config test does not expand pretest hook.snap index 5e738dfb..c6d89dfc 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-task-no-hook/snapshots/query - task config test does not expand pretest hook.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-task-no-hook/snapshots/query - task config test does not expand pretest hook.snap @@ -7,47 +7,50 @@ info: - test input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-task-no-hook --- -[ - { - "key": [ - "/", - "test" - ], - "node": { - "task_display": { - "package_name": "@test/script-hooks-task-no-hook", - "task_name": "test", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks-task-no-hook", - "task_name": "test", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "test" + ], + "node": { + "task_display": { + "package_name": "@test/script-hooks-task-no-hook", + "task_name": "test", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks-task-no-hook", + "task_name": "test", + "package_path": "/" + }, + "command": "echo test-task", + "and_item_index": null, + "cwd": "/" }, - "command": "echo test-task", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "test-task" - ], - "trailing_newline": true + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "test-task" + ], + "trailing_newline": true + } } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - build runs with pre hook only.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - build runs with pre hook only.snap index 566371b4..fdff7407 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - build runs with pre hook only.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - build runs with pre hook only.snap @@ -7,73 +7,76 @@ info: - build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks --- -[ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "prebuild", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "build", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "prebuild", + "package_path": "/" + }, + "command": "echo prebuild", + "and_item_index": null, + "cwd": "/" }, - "command": "echo prebuild", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "prebuild" - ], - "trailing_newline": true + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "prebuild" + ], + "trailing_newline": true + } } } } } - } - }, - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "build", - "package_path": "/" - }, - "command": "echo build", - "and_item_index": null, - "cwd": "/" }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "build" - ], - "trailing_newline": true + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "build", + "package_path": "/" + }, + "command": "echo build", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "build" + ], + "trailing_newline": true + } } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - extra args not passed to hooks.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - extra args not passed to hooks.snap index d37b03f2..af150202 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - extra args not passed to hooks.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - extra args not passed to hooks.snap @@ -8,100 +8,103 @@ info: - "--coverage" input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks --- -[ - { - "key": [ - "/", - "test" - ], - "node": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "test", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "pretest", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "test" + ], + "node": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "test", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "pretest", + "package_path": "/" + }, + "command": "echo pretest", + "and_item_index": null, + "cwd": "/" }, - "command": "echo pretest", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "pretest" - ], - "trailing_newline": true + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "pretest" + ], + "trailing_newline": true + } } } } } - } - }, - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "test", - "package_path": "/" - }, - "command": "echo test --coverage", - "and_item_index": null, - "cwd": "/" }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "test", - "--coverage" - ], - "trailing_newline": true + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "test", + "package_path": "/" + }, + "command": "echo test --coverage", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "test", + "--coverage" + ], + "trailing_newline": true + } } } } } - } - }, - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "posttest", - "package_path": "/" - }, - "command": "echo posttest", - "and_item_index": null, - "cwd": "/" }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "posttest" - ], - "trailing_newline": true + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "posttest", + "package_path": "/" + }, + "command": "echo posttest", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "posttest" + ], + "trailing_newline": true + } } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - pretest directly expands prepretest but not when called as hook.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - pretest directly expands prepretest but not when called as hook.snap index 56765b7c..8b5f6924 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - pretest directly expands prepretest but not when called as hook.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - pretest directly expands prepretest but not when called as hook.snap @@ -7,73 +7,76 @@ info: - pretest input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks --- -[ - { - "key": [ - "/", - "pretest" - ], - "node": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "pretest", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "prepretest", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "pretest" + ], + "node": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "pretest", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "prepretest", + "package_path": "/" + }, + "command": "echo prepretest", + "and_item_index": null, + "cwd": "/" }, - "command": "echo prepretest", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "prepretest" - ], - "trailing_newline": true + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "prepretest" + ], + "trailing_newline": true + } } } } } - } - }, - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "pretest", - "package_path": "/" - }, - "command": "echo pretest", - "and_item_index": null, - "cwd": "/" }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "pretest" - ], - "trailing_newline": true + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "pretest", + "package_path": "/" + }, + "command": "echo pretest", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "pretest" + ], + "trailing_newline": true + } } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - test runs with pre and post hooks.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - test runs with pre and post hooks.snap index fdf34168..8085d110 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - test runs with pre and post hooks.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - test runs with pre and post hooks.snap @@ -7,99 +7,102 @@ info: - test input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks --- -[ - { - "key": [ - "/", - "test" - ], - "node": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "test", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "pretest", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "test" + ], + "node": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "test", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "pretest", + "package_path": "/" + }, + "command": "echo pretest", + "and_item_index": null, + "cwd": "/" }, - "command": "echo pretest", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "pretest" - ], - "trailing_newline": true + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "pretest" + ], + "trailing_newline": true + } } } } } - } - }, - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "test", - "package_path": "/" - }, - "command": "echo test", - "and_item_index": null, - "cwd": "/" }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "test" - ], - "trailing_newline": true + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "test", + "package_path": "/" + }, + "command": "echo test", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "test" + ], + "trailing_newline": true + } } } } } - } - }, - { - "execution_item_display": { - "task_display": { - "package_name": "@test/script-hooks", - "task_name": "posttest", - "package_path": "/" - }, - "command": "echo posttest", - "and_item_index": null, - "cwd": "/" }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "posttest" - ], - "trailing_newline": true + { + "execution_item_display": { + "task_display": { + "package_name": "@test/script-hooks", + "task_name": "posttest", + "package_path": "/" + }, + "command": "echo posttest", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "posttest" + ], + "trailing_newline": true + } } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/shell-fallback/snapshots/query - shell fallback for pipe command.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/shell-fallback/snapshots/query - shell fallback for pipe command.snap index db9b1c85..638f6d4e 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/shell-fallback/snapshots/query - shell fallback for pipe command.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/shell-fallback/snapshots/query - shell fallback for pipe command.snap @@ -7,84 +7,87 @@ info: - pipe-test input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/shell-fallback --- -[ - { - "key": [ - "/", - "pipe-test" - ], - "node": { - "task_display": { - "package_name": "", - "task_name": "pipe-test", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "pipe-test", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "pipe-test" + ], + "node": { + "task_display": { + "package_name": "", + "task_name": "pipe-test", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "pipe-test", + "package_path": "/" + }, + "command": "echo hello | node -e \"process.stdin.pipe(process.stdout)\"", + "and_item_index": null, + "cwd": "/" }, - "command": "echo hello | node -e \"process.stdin.pipe(process.stdout)\"", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "" + } + }, + "args": [ + "", + "echo hello | node -e \"process.stdin.pipe(process.stdout)\"" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "pipe-test", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "", "args": [ "", "echo hello | node -e \"process.stdin.pipe(process.stdout)\"" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "pipe-test", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "", - "args": [ - "", - "echo hello | node -e \"process.stdin.pipe(process.stdout)\"" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - parent cache false does not affect expanded query tasks.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - parent cache false does not affect expanded query tasks.snap index ddf0f97e..988890e1 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - parent cache false does not affect expanded query tasks.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - parent cache false does not affect expanded query tasks.snap @@ -7,116 +7,122 @@ info: - run-build-no-cache input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled --- -[ - { - "key": [ - "/", - "run-build-no-cache" - ], - "node": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "run-build-no-cache", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "run-build-no-cache", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "run-build-no-cache" + ], + "node": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "run-build-no-cache", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "run-build-no-cache", + "package_path": "/" + }, + "command": "vt run build", + "and_item_index": null, + "cwd": "/" }, - "command": "vt run build", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Expanded": [ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "build", - "package_path": "/" - }, - "command": "vt tool print lint", - "and_item_index": null, - "cwd": "/" + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "build", + "package_path": "/" }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "build", + "package_path": "/" + }, + "command": "vt tool print lint", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print", + "lint" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] } }, - "args": [ - "print", - "lint" - ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "and_item_index": 0, - "extra_args": [], - "package_path": "" + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print", + "lint" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } - } - } - ] - }, - "neighbors": [] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 } - ] + } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script cache false does not affect expanded synthetic cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script cache false does not affect expanded synthetic cache.snap index a917af98..72b6f01c 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script cache false does not affect expanded synthetic cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script cache false does not affect expanded synthetic cache.snap @@ -7,116 +7,122 @@ info: - run-build-cache-false input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled --- -[ - { - "key": [ - "/", - "run-build-cache-false" - ], - "node": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "run-build-cache-false", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "run-build-cache-false", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "run-build-cache-false" + ], + "node": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "run-build-cache-false", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "run-build-cache-false", + "package_path": "/" + }, + "command": "vt run build", + "and_item_index": null, + "cwd": "/" }, - "command": "vt run build", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Expanded": [ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "build", - "package_path": "/" - }, - "command": "vt tool print lint", - "and_item_index": null, - "cwd": "/" + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "build", + "package_path": "/" }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "build", + "package_path": "/" + }, + "command": "vt tool print lint", + "and_item_index": null, + "cwd": "/" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print", + "lint" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "build", + "and_item_index": 0, + "extra_args": [], + "package_path": "" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] } }, - "args": [ - "print", - "lint" - ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "build", - "and_item_index": 0, - "extra_args": [], - "package_path": "" + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print", + "lint" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } - } - } - ] - }, - "neighbors": [] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 } - ] + } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script without cache.scripts defaults to no cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script without cache.scripts defaults to no cache.snap index 10b9d818..af36aa2d 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script without cache.scripts defaults to no cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script without cache.scripts defaults to no cache.snap @@ -7,52 +7,55 @@ info: - lint input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled --- -[ - { - "key": [ - "/", - "lint" - ], - "node": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "lint", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "lint", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "lint" + ], + "node": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "lint", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "lint", + "package_path": "/" + }, + "command": "vt tool print lint", + "and_item_index": null, + "cwd": "/" }, - "command": "vt tool print lint", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print", + "lint" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task untrackedEnv inherited by synthetic.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task untrackedEnv inherited by synthetic.snap index 155fb3a9..f7d82879 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task untrackedEnv inherited by synthetic.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task untrackedEnv inherited by synthetic.snap @@ -7,85 +7,88 @@ info: - lint-with-untracked-env input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled --- -[ - { - "key": [ - "/", - "lint-with-untracked-env" - ], - "node": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "lint-with-untracked-env", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "lint-with-untracked-env", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "lint-with-untracked-env" + ], + "node": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "lint-with-untracked-env", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "lint-with-untracked-env", + "package_path": "/" + }, + "command": "vt tool print lint", + "and_item_index": null, + "cwd": "/" }, - "command": "vt tool print lint", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print", + "lint" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "CUSTOM_VAR", + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "lint-with-untracked-env", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print", "lint" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "CUSTOM_VAR", - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "lint-with-untracked-env", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache false disables synthetic cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache false disables synthetic cache.snap index 04079568..8402a4e9 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache false disables synthetic cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache false disables synthetic cache.snap @@ -7,52 +7,55 @@ info: - lint-no-cache input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled --- -[ - { - "key": [ - "/", - "lint-no-cache" - ], - "node": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "lint-no-cache", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "lint-no-cache", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "lint-no-cache" + ], + "node": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "lint-no-cache", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "lint-no-cache", + "package_path": "/" + }, + "command": "vt tool print lint", + "and_item_index": null, + "cwd": "/" }, - "command": "vt tool print lint", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": null, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": null, + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print", + "lint" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" + } } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache true enables synthetic cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache true enables synthetic cache.snap index 3b7ce025..42d859ea 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache true enables synthetic cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache true enables synthetic cache.snap @@ -7,84 +7,87 @@ info: - lint-with-cache input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled --- -[ - { - "key": [ - "/", - "lint-with-cache" - ], - "node": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "lint-with-cache", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/synthetic-cache-disabled", - "task_name": "lint-with-cache", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "lint-with-cache" + ], + "node": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "lint-with-cache", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/synthetic-cache-disabled", + "task_name": "lint-with-cache", + "package_path": "/" + }, + "command": "vt tool print lint", + "and_item_index": null, + "cwd": "/" }, - "command": "vt tool print lint", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print", + "lint" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "lint-with-cache", + "and_item_index": 0, + "extra_args": [], + "package_path": "" } }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] + } + }, + "spawn_command": { + "program_path": "/vtt", "args": [ "print", "lint" ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "lint-with-cache", - "and_item_index": 0, - "extra_args": [], - "package_path": "" - } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] + "all_envs": { + "NO_COLOR": "1", + "PATH": "/node_modules/.bin:" + }, + "cwd": "/" } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/node_modules/.bin:" - }, - "cwd": "/" } } } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-in-subpackage/snapshots/query - synthetic-in-subpackage.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-in-subpackage/snapshots/query - synthetic-in-subpackage.snap index 655d1c5b..25102b1f 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-in-subpackage/snapshots/query - synthetic-in-subpackage.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-in-subpackage/snapshots/query - synthetic-in-subpackage.snap @@ -7,116 +7,122 @@ info: - lint input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-in-subpackage --- -[ - { - "key": [ - "/", - "lint" - ], - "node": { - "task_display": { - "package_name": "", - "task_name": "lint", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "", - "task_name": "lint", - "package_path": "/" +{ + "graph": [ + { + "key": [ + "/", + "lint" + ], + "node": { + "task_display": { + "package_name": "", + "task_name": "lint", + "package_path": "/" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "", + "task_name": "lint", + "package_path": "/" + }, + "command": "vt run a#lint", + "and_item_index": null, + "cwd": "/" }, - "command": "vt run a#lint", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Expanded": [ - { - "key": [ - "/packages/a", - "lint" - ], - "node": { - "task_display": { - "package_name": "a", - "task_name": "lint", - "package_path": "/packages/a" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "a", - "task_name": "lint", - "package_path": "/packages/a" - }, - "command": "vt tool print lint", - "and_item_index": null, - "cwd": "/packages/a" + "kind": { + "Expanded": { + "graph": [ + { + "key": [ + "/packages/a", + "lint" + ], + "node": { + "task_display": { + "package_name": "a", + "task_name": "lint", + "package_path": "/packages/a" }, - "kind": { - "Leaf": { - "Spawn": { - "cache_metadata": { - "spawn_fingerprint": { - "cwd": "packages/a", - "program_fingerprint": { - "OutsideWorkspace": { - "program_name": "vtt" + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "a", + "task_name": "lint", + "package_path": "/packages/a" + }, + "command": "vt tool print lint", + "and_item_index": null, + "cwd": "/packages/a" + }, + "kind": { + "Leaf": { + "Spawn": { + "cache_metadata": { + "spawn_fingerprint": { + "cwd": "packages/a", + "program_fingerprint": { + "OutsideWorkspace": { + "program_name": "vtt" + } + }, + "args": [ + "print", + "lint" + ], + "env_fingerprints": { + "fingerprinted_envs": {}, + "untracked_env_config": [ + "" + ] + } + }, + "execution_cache_key": { + "UserTask": { + "task_name": "lint", + "and_item_index": 0, + "extra_args": [], + "package_path": "packages/a" + } + }, + "input_config": { + "includes_auto": true, + "positive_globs": [], + "negative_globs": [] } }, - "args": [ - "print", - "lint" - ], - "env_fingerprints": { - "fingerprinted_envs": {}, - "untracked_env_config": [ - "" - ] - } - }, - "execution_cache_key": { - "UserTask": { - "task_name": "lint", - "and_item_index": 0, - "extra_args": [], - "package_path": "packages/a" + "spawn_command": { + "program_path": "/vtt", + "args": [ + "print", + "lint" + ], + "all_envs": { + "NO_COLOR": "1", + "PATH": "/packages/a/node_modules/.bin:/node_modules/.bin:" + }, + "cwd": "/packages/a" } - }, - "input_config": { - "includes_auto": true, - "positive_globs": [], - "negative_globs": [] } - }, - "spawn_command": { - "program_path": "/vtt", - "args": [ - "print", - "lint" - ], - "all_envs": { - "NO_COLOR": "1", - "PATH": "/packages/a/node_modules/.bin:/node_modules/.bin:" - }, - "cwd": "/packages/a" } } } - } - } - ] - }, - "neighbors": [] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 } - ] + } } - } - ] - }, - "neighbors": [] - } -] + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 10 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/main.rs b/crates/vite_task_plan/tests/plan_snapshots/main.rs index 08ec2859..73d5c864 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/main.rs +++ b/crates/vite_task_plan/tests/plan_snapshots/main.rs @@ -65,13 +65,16 @@ impl CompactPlan { fn from_execution_graph(graph: &ExecutionGraph, workspace_root: &AbsolutePath) -> Self { use petgraph::visit::EdgeRef as _; let mut map = BTreeMap::::new(); - for node_idx in graph.node_indices() { - let node = &graph[node_idx]; + for node_idx in graph.graph.node_indices() { + let node = &graph.graph[node_idx]; let key = Self::task_key(&node.task_display, workspace_root); let neighbors: BTreeSet = graph + .graph .edges(node_idx) - .map(|edge| Self::task_key(&graph[edge.target()].task_display, workspace_root)) + .map(|edge| { + Self::task_key(&graph.graph[edge.target()].task_display, workspace_root) + }) .collect(); let expanded_items: Vec = node From 76661083fb9ef1d6e125371527a23a5afd3fc6e9 Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 17:46:46 +0800 Subject: [PATCH 02/21] docs: update changelog with PR links for --concurrency and --parallel Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c893477..a7cda44d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog -- **Added** `--concurrency` flag to limit the number of concurrent tasks per execution graph level, supporting both absolute values (e.g. `--concurrency 5`) and percentages of CPU cores (e.g. `--concurrency 50%`) -- **Added** `--parallel` flag to discard dependency edges between tasks, running them all independently with unlimited concurrency (unless `--concurrency` is also specified) +- **Added** `--concurrency` flag to limit the number of concurrent tasks per execution graph level, supporting both absolute values (e.g. `--concurrency 5`) and percentages of CPU cores (e.g. `--concurrency 50%`) ([#288](https://github.com/voidzero-dev/vite-task/pull/288), [#309](https://github.com/voidzero-dev/vite-task/pull/309)) +- **Added** `--parallel` flag to discard dependency edges between tasks, running them all independently with unlimited concurrency (unless `--concurrency` is also specified) ([#309](https://github.com/voidzero-dev/vite-task/pull/309)) - **Added** object form for `input` entries: `{ "pattern": "...", "base": "workspace" | "package" }` to resolve glob patterns relative to the workspace root instead of the package directory ([#295](https://github.com/voidzero-dev/vite-task/pull/295)) - **Fixed** arguments after the task name being consumed by `vp` instead of passed through to the task ([#286](https://github.com/voidzero-dev/vite-task/pull/286), [#290](https://github.com/voidzero-dev/vite-task/pull/290)) - **Changed** default untracked env patterns to align with Turborepo, covering more CI and platform-specific variables ([#262](https://github.com/voidzero-dev/vite-task/pull/262)) From 699176d12770688ae69859a0fd87f4afec2988bd Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 17:48:51 +0800 Subject: [PATCH 03/21] docs: simplify changelog wording Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7cda44d..812cd7aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog -- **Added** `--concurrency` flag to limit the number of concurrent tasks per execution graph level, supporting both absolute values (e.g. `--concurrency 5`) and percentages of CPU cores (e.g. `--concurrency 50%`) ([#288](https://github.com/voidzero-dev/vite-task/pull/288), [#309](https://github.com/voidzero-dev/vite-task/pull/309)) -- **Added** `--parallel` flag to discard dependency edges between tasks, running them all independently with unlimited concurrency (unless `--concurrency` is also specified) ([#309](https://github.com/voidzero-dev/vite-task/pull/309)) +- **Added** `--concurrency` flag to limit the number of tasks running at the same time, supporting both absolute values (e.g. `--concurrency 5`) and percentages of CPU cores (e.g. `--concurrency 50%`) ([#288](https://github.com/voidzero-dev/vite-task/pull/288), [#309](https://github.com/voidzero-dev/vite-task/pull/309)) +- **Added** `--parallel` flag to ignore task dependencies and run all tasks at once with unlimited concurrency (unless `--concurrency` is also specified) ([#309](https://github.com/voidzero-dev/vite-task/pull/309)) - **Added** object form for `input` entries: `{ "pattern": "...", "base": "workspace" | "package" }` to resolve glob patterns relative to the workspace root instead of the package directory ([#295](https://github.com/voidzero-dev/vite-task/pull/295)) - **Fixed** arguments after the task name being consumed by `vp` instead of passed through to the task ([#286](https://github.com/voidzero-dev/vite-task/pull/286), [#290](https://github.com/voidzero-dev/vite-task/pull/290)) - **Changed** default untracked env patterns to align with Turborepo, covering more CI and platform-specific variables ([#262](https://github.com/voidzero-dev/vite-task/pull/262)) From 59cb4bee66fa9ee5c0d6eff1b27f337ce893bb2f Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 18:14:51 +0800 Subject: [PATCH 04/21] refactor: rename --concurrency to --concurrency-limit, default to 4 - Rename flag from --concurrency to --concurrency-limit - Reduce default concurrency from 10 to 4 - Remove percentage format support (e.g. 50%) Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 4 +-- crates/vite_task/src/cli/mod.rs | 35 +++---------------- crates/vite_task/src/session/mod.rs | 2 +- crates/vite_task_plan/src/execution_graph.rs | 2 +- crates/vite_task_plan/src/plan.rs | 4 +-- crates/vite_task_plan/src/plan_request.rs | 2 +- ...ry - tool synthetic task in user task.snap | 2 +- ...oes not override per-task cache false.snap | 2 +- ...uery - --cache enables script caching.snap | 2 +- ...aching even when cache.tasks is false.snap | 2 +- ...h per-task cache true enables caching.snap | 2 +- ...ry - --no-cache disables task caching.snap | 2 +- ...o-cache overrides per-task cache true.snap | 2 +- ... not cached when cache.tasks is false.snap | 2 +- ...query - echo and lint with extra args.snap | 2 +- ...query - lint and echo with extra args.snap | 2 +- .../query - normal task with extra args.snap | 2 +- ... synthetic task in user task with cwd.snap | 2 +- .../query - synthetic task in user task.snap | 2 +- ...tic task with extra args in user task.snap | 2 +- .../query - script not cached by default.snap | 2 +- ...uery - another task cached by default.snap | 2 +- .../query - script not cached by default.snap | 2 +- .../query - task cached by default.snap | 2 +- .../query - cache clean in script.snap | 2 +- ...e still disabled by cache.tasks false.snap | 2 +- .../snapshots/query - script not cached.snap | 2 +- ... not cached when cache.tasks is false.snap | 2 +- ... script cached when global cache true.snap | 2 +- ... - task cached when global cache true.snap | 2 +- ... not cached despite global cache true.snap | 2 +- ...t should put synthetic task under cwd.snap | 2 +- ...n should not affect expanded task cwd.snap | 4 +-- ...ed --cache enables inner task caching.snap | 4 +-- ...-no-cache disables inner task caching.snap | 4 +-- ...n without flags inherits parent cache.snap | 4 +-- ...ropagates to nested run without flags.snap | 4 +-- ...oes not propagate into nested --cache.snap | 4 +-- ...ropagates to nested run without flags.snap | 4 +-- .../parallel-and-concurrency/package.json | 2 +- .../parallel-and-concurrency/snapshots.toml | 22 ++++++------ ...oncurrency-limit with explicit value.snap} | 2 +- ... - nested inherits parent concurrency.snap | 2 +- ...- nested overrides parent concurrency.snap | 4 +-- ...ry - parallel with concurrency-limit.snap} | 2 +- ...- parallel without concurrency-limit.snap} | 0 .../snapshots/task graph.snap | 2 +- ...test runs without hooks when disabled.snap | 2 +- ...en scriptInHook is called from a hook.snap | 4 +-- ...fig test does not expand pretest hook.snap | 2 +- ...query - build runs with pre hook only.snap | 2 +- ...uery - extra args not passed to hooks.snap | 2 +- ...repretest but not when called as hook.snap | 2 +- ...y - test runs with pre and post hooks.snap | 2 +- ...ery - shell fallback for pipe command.snap | 2 +- ... does not affect expanded query tasks.snap | 4 +-- ...s not affect expanded synthetic cache.snap | 4 +-- ...ut cache.scripts defaults to no cache.snap | 2 +- ...k untrackedEnv inherited by synthetic.snap | 2 +- ... cache false disables synthetic cache.snap | 2 +- ...th cache true enables synthetic cache.snap | 2 +- .../query - synthetic-in-subpackage.snap | 4 +-- 62 files changed, 89 insertions(+), 114 deletions(-) rename crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/{query - concurrency with explicit value.snap => query - concurrency-limit with explicit value.snap} (99%) rename crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/{query - parallel with concurrency.snap => query - parallel with concurrency-limit.snap} (99%) rename crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/{query - parallel without concurrency.snap => query - parallel without concurrency-limit.snap} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 812cd7aa..c65bda3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog -- **Added** `--concurrency` flag to limit the number of tasks running at the same time, supporting both absolute values (e.g. `--concurrency 5`) and percentages of CPU cores (e.g. `--concurrency 50%`) ([#288](https://github.com/voidzero-dev/vite-task/pull/288), [#309](https://github.com/voidzero-dev/vite-task/pull/309)) -- **Added** `--parallel` flag to ignore task dependencies and run all tasks at once with unlimited concurrency (unless `--concurrency` is also specified) ([#309](https://github.com/voidzero-dev/vite-task/pull/309)) +- **Added** `--concurrency-limit` flag to limit the number of tasks running at the same time (defaults to 4) ([#288](https://github.com/voidzero-dev/vite-task/pull/288), [#309](https://github.com/voidzero-dev/vite-task/pull/309)) +- **Added** `--parallel` flag to ignore task dependencies and run all tasks at once with unlimited concurrency (unless `--concurrency-limit` is also specified) ([#309](https://github.com/voidzero-dev/vite-task/pull/309)) - **Added** object form for `input` entries: `{ "pattern": "...", "base": "workspace" | "package" }` to resolve glob patterns relative to the workspace root instead of the package directory ([#295](https://github.com/voidzero-dev/vite-task/pull/295)) - **Fixed** arguments after the task name being consumed by `vp` instead of passed through to the task ([#286](https://github.com/voidzero-dev/vite-task/pull/286), [#290](https://github.com/voidzero-dev/vite-task/pull/290)) - **Changed** default untracked env patterns to align with Turborepo, covering more CI and platform-specific variables ([#262](https://github.com/voidzero-dev/vite-task/pull/262)) diff --git a/crates/vite_task/src/cli/mod.rs b/crates/vite_task/src/cli/mod.rs index e517cc86..84a420d6 100644 --- a/crates/vite_task/src/cli/mod.rs +++ b/crates/vite_task/src/cli/mod.rs @@ -52,13 +52,12 @@ pub struct RunFlags { #[clap(long, default_value = "interleaved")] pub log: LogMode, - /// Maximum number of tasks to run concurrently per execution graph level. - /// Accepts a number (e.g. `5`) or a percentage of available CPU cores (e.g. `50%`). + /// Maximum number of tasks to run concurrently. Defaults to 4. #[clap(long)] - pub concurrency: Option, + pub concurrency_limit: Option, /// Run tasks without dependency ordering. Sets concurrency to unlimited - /// unless `--concurrency` is also specified. + /// unless `--concurrency-limit` is also specified. #[clap(long, default_value = "false")] pub parallel: bool, } @@ -191,27 +190,6 @@ impl RunCommand { } } -#[derive(thiserror::Error, Debug)] -pub enum ConcurrencyParseError { - #[error("invalid concurrency value: {0}")] - InvalidValue(Str), -} - -/// Parse a `--concurrency` value: either a plain number or a percentage (e.g. `50%`). -/// The result is always clamped to at least 1. -fn parse_concurrency(raw: &str) -> Result { - if let Some(pct_str) = raw.strip_suffix('%') { - let pct: usize = - pct_str.parse().map_err(|_| ConcurrencyParseError::InvalidValue(Str::from(raw)))?; - let cpus = std::thread::available_parallelism().map_or(1, std::num::NonZero::get); - Ok((cpus * pct / 100).max(1)) - } else { - let n: usize = - raw.parse().map_err(|_| ConcurrencyParseError::InvalidValue(Str::from(raw)))?; - Ok(n.max(1)) - } -} - #[derive(thiserror::Error, Debug)] pub enum CLITaskQueryError { #[error("no task specifier provided")] @@ -219,9 +197,6 @@ pub enum CLITaskQueryError { #[error(transparent)] PackageQuery(#[from] PackageQueryError), - - #[error(transparent)] - Concurrency(#[from] ConcurrencyParseError), } impl ResolvedRunCommand { @@ -240,7 +215,7 @@ impl ResolvedRunCommand { let cache_override = self.flags.cache_override(); let include_explicit_deps = !self.flags.ignore_depends_on; - let concurrency = self.flags.concurrency.as_deref().map(parse_concurrency).transpose()?; + let concurrency_limit = self.flags.concurrency_limit.map(|n| n.max(1)); let parallel = self.flags.parallel; let (package_query, is_cwd_only) = @@ -256,7 +231,7 @@ impl ResolvedRunCommand { plan_options: PlanOptions { extra_args: self.additional_args.into(), cache_override, - concurrency, + concurrency_limit, parallel, }, }, diff --git a/crates/vite_task/src/session/mod.rs b/crates/vite_task/src/session/mod.rs index 66697392..09c7e8df 100644 --- a/crates/vite_task/src/session/mod.rs +++ b/crates/vite_task/src/session/mod.rs @@ -508,7 +508,7 @@ impl<'a> Session<'a> { plan_options: PlanOptions { extra_args: run_command.additional_args.clone().into(), cache_override: run_command.flags.cache_override(), - concurrency: None, + concurrency_limit: None, parallel: false, }, }) diff --git a/crates/vite_task_plan/src/execution_graph.rs b/crates/vite_task_plan/src/execution_graph.rs index 8abc7faa..4e8b94d9 100644 --- a/crates/vite_task_plan/src/execution_graph.rs +++ b/crates/vite_task_plan/src/execution_graph.rs @@ -162,7 +162,7 @@ impl Serialize for Acyclic } /// The default concurrency limit for task execution within a single graph level. -pub const DEFAULT_CONCURRENCY_LIMIT: usize = 10; +pub const DEFAULT_CONCURRENCY_LIMIT: usize = 4; /// An execution graph with a per-level concurrency limit. /// diff --git a/crates/vite_task_plan/src/plan.rs b/crates/vite_task_plan/src/plan.rs index 7b9da5d3..68595a8a 100644 --- a/crates/vite_task_plan/src/plan.rs +++ b/crates/vite_task_plan/src/plan.rs @@ -678,9 +678,9 @@ pub async fn plan_query_request( // Resolve effective concurrency for this level. // // When `Some(n)`, use the explicit value. When `None`, inherit from the - // parent context — unless `--parallel` is set without `--concurrency`, + // parent context — unless `--parallel` is set without `--concurrency-limit`, // in which case use unlimited concurrency. - let effective_concurrency = match plan_options.concurrency { + let effective_concurrency = match plan_options.concurrency_limit { Some(n) => n, None => { if plan_options.parallel { diff --git a/crates/vite_task_plan/src/plan_request.rs b/crates/vite_task_plan/src/plan_request.rs index 5f9e622a..b7addc8e 100644 --- a/crates/vite_task_plan/src/plan_request.rs +++ b/crates/vite_task_plan/src/plan_request.rs @@ -51,7 +51,7 @@ pub struct PlanOptions { pub cache_override: CacheOverride, /// Per-level concurrency limit. `None` means inherit from the parent level /// (or default to [`crate::DEFAULT_CONCURRENCY_LIMIT`] at the root). - pub concurrency: Option, + pub concurrency_limit: Option, /// When `true`, discard dependency edges between tasks at this level, /// running all tasks as independent. If `concurrency` is also `None`, /// this sets the effective concurrency to `usize::MAX`. diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/additional-env/snapshots/query - tool synthetic task in user task.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/additional-env/snapshots/query - tool synthetic task in user task.snap index f0430ac1..ab370951 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/additional-env/snapshots/query - tool synthetic task in user task.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/additional-env/snapshots/query - tool synthetic task in user task.snap @@ -92,5 +92,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/additional-env "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache does not override per-task cache false.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache does not override per-task cache false.snap index 47a56b6d..a4a3a4a3 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache does not override per-task cache false.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache does not override per-task cache false.snap @@ -58,5 +58,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-overri "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables script caching.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables script caching.snap index 482c1a6e..1fec2e4c 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables script caching.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables script caching.snap @@ -90,5 +90,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-overri "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables task caching even when cache.tasks is false.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables task caching even when cache.tasks is false.snap index 11d183e0..474a1ab4 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables task caching even when cache.tasks is false.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache enables task caching even when cache.tasks is false.snap @@ -90,5 +90,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-overri "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache on task with per-task cache true enables caching.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache on task with per-task cache true enables caching.snap index 98b9b587..ea5b94f3 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache on task with per-task cache true enables caching.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --cache on task with per-task cache true enables caching.snap @@ -90,5 +90,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-overri "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache disables task caching.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache disables task caching.snap index 5740231e..7bb3c028 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache disables task caching.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache disables task caching.snap @@ -58,5 +58,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-overri "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache overrides per-task cache true.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache overrides per-task cache true.snap index ca4288be..609a8abc 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache overrides per-task cache true.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - --no-cache overrides per-task cache true.snap @@ -58,5 +58,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-overri "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - baseline - tasks not cached when cache.tasks is false.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - baseline - tasks not cached when cache.tasks is false.snap index a3e01aaf..94f369ca 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - baseline - tasks not cached when cache.tasks is false.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-override/snapshots/query - baseline - tasks not cached when cache.tasks is false.snap @@ -57,5 +57,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-cli-overri "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - echo and lint with extra args.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - echo and lint with extra args.snap index cea88ef6..6e75db7d 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - echo and lint with extra args.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - echo and lint with extra args.snap @@ -120,5 +120,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - lint and echo with extra args.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - lint and echo with extra args.snap index 6e024c4d..63e165ba 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - lint and echo with extra args.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - lint and echo with extra args.snap @@ -116,5 +116,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - normal task with extra args.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - normal task with extra args.snap index 2d559adb..2b8b8c95 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - normal task with extra args.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - normal task with extra args.snap @@ -92,5 +92,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task with cwd.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task with cwd.snap index 0f22972f..f33b18c9 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task with cwd.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task with cwd.snap @@ -90,5 +90,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task.snap index 26c8fdc2..b5b496c5 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task in user task.snap @@ -89,5 +89,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task with extra args in user task.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task with extra args in user task.snap index 4ad41409..1437733f 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task with extra args in user task.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys/snapshots/query - synthetic task with extra args in user task.snap @@ -94,5 +94,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-keys "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-default/snapshots/query - script not cached by default.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-default/snapshots/query - script not cached by default.snap index d1425825..fab6d952 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-default/snapshots/query - script not cached by default.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-default/snapshots/query - script not cached by default.snap @@ -57,5 +57,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-de "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - another task cached by default.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - another task cached by default.snap index c630f7fc..1cae81f1 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - another task cached by default.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - another task cached by default.snap @@ -89,5 +89,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-ta "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - script not cached by default.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - script not cached by default.snap index b925313d..d4a0b5ff 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - script not cached by default.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - script not cached by default.snap @@ -57,5 +57,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-ta "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - task cached by default.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - task cached by default.snap index c6e0df57..869906ce 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - task cached by default.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/query - task cached by default.snap @@ -89,5 +89,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-ta "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-subcommand/snapshots/query - cache clean in script.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-subcommand/snapshots/query - cache clean in script.snap index 0f665801..5275a8f5 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-subcommand/snapshots/query - cache clean in script.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-subcommand/snapshots/query - cache clean in script.snap @@ -57,5 +57,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-subcommand "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - per-task cache true still disabled by cache.tasks false.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - per-task cache true still disabled by cache.tasks false.snap index 8ce39c16..bb0b66cc 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - per-task cache true still disabled by cache.tasks false.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - per-task cache true still disabled by cache.tasks false.snap @@ -57,5 +57,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disa "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - script not cached.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - script not cached.snap index 2a22104d..9594a9d9 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - script not cached.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - script not cached.snap @@ -57,5 +57,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disa "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - task not cached when cache.tasks is false.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - task not cached when cache.tasks is false.snap index 0e8ad817..e72d2099 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - task not cached when cache.tasks is false.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disabled/snapshots/query - task not cached when cache.tasks is false.snap @@ -57,5 +57,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-tasks-disa "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - script cached when global cache true.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - script cached when global cache true.snap index 870886ab..fcfb2ef0 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - script cached when global cache true.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - script cached when global cache true.snap @@ -89,5 +89,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-fo "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task cached when global cache true.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task cached when global cache true.snap index 981f8be5..26fe7993 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task cached when global cache true.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task cached when global cache true.snap @@ -89,5 +89,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-fo "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task with cache false not cached despite global cache true.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task with cache false not cached despite global cache true.snap index 390b5919..700ad40e 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task with cache false not cached despite global cache true.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-force-enable/snapshots/query - task with cache false not cached despite global cache true.snap @@ -57,5 +57,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-true-no-fo "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt lint should put synthetic task under cwd.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt lint should put synthetic task under cwd.snap index d9cfb50d..d675dd9a 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt lint should put synthetic task under cwd.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt lint should put synthetic task under cwd.snap @@ -89,5 +89,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt run should not affect expanded task cwd.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt run should not affect expanded task cwd.snap index ef5d64bd..fea71c5a 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt run should not affect expanded task cwd.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts/snapshots/query - cd before vt run should not affect expanded task cwd.snap @@ -115,7 +115,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } } } @@ -124,5 +124,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cd-in-scripts "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --cache enables inner task caching.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --cache enables inner task caching.snap index 31733753..541fc3df 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --cache enables inner task caching.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --cache enables inner task caching.snap @@ -115,7 +115,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } } } @@ -124,5 +124,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --no-cache disables inner task caching.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --no-cache disables inner task caching.snap index 84fbcb7c..aed12a13 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --no-cache disables inner task caching.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested --no-cache disables inner task caching.snap @@ -83,7 +83,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } } } @@ -92,5 +92,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested run without flags inherits parent cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested run without flags inherits parent cache.snap index 162a2be6..626ebf28 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested run without flags inherits parent cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - nested run without flags inherits parent cache.snap @@ -83,7 +83,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } } } @@ -92,5 +92,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --cache propagates to nested run without flags.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --cache propagates to nested run without flags.snap index 65933b80..987a8c07 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --cache propagates to nested run without flags.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --cache propagates to nested run without flags.snap @@ -116,7 +116,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } } } @@ -125,5 +125,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache does not propagate into nested --cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache does not propagate into nested --cache.snap index a0e47054..156ff02f 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache does not propagate into nested --cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache does not propagate into nested --cache.snap @@ -116,7 +116,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } } } @@ -125,5 +125,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache propagates to nested run without flags.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache propagates to nested run without flags.snap index 255457ce..c29e017d 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache propagates to nested run without flags.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-override/snapshots/query - outer --no-cache propagates to nested run without flags.snap @@ -84,7 +84,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } } } @@ -93,5 +93,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/nested-cache-ove "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/package.json b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/package.json index 56cd9c6a..c2e0d471 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/package.json +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/package.json @@ -3,6 +3,6 @@ "private": true, "scripts": { "build": "vt run -r build", - "build-with-concurrency": "vt run -r --concurrency 5 build" + "build-with-concurrency": "vt run -r --concurrency-limit 5 build" } } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml index 455238a7..54103b82 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml @@ -16,27 +16,27 @@ name = "parallel only affects current level" args = ["run", "--parallel", "build"] compact = true -# --concurrency with explicit value +# --concurrency-limit with explicit value [[plan]] -name = "concurrency with explicit value" -args = ["run", "-r", "--concurrency", "5", "build"] +name = "concurrency-limit with explicit value" +args = ["run", "-r", "--concurrency-limit", "5", "build"] -# --parallel without --concurrency sets concurrency to max +# --parallel without --concurrency-limit sets concurrency to max [[plan]] -name = "parallel without concurrency" +name = "parallel without concurrency-limit" args = ["run", "-r", "--parallel", "build"] -# --parallel with --concurrency uses explicit concurrency, not max +# --parallel with --concurrency-limit uses explicit concurrency, not max [[plan]] -name = "parallel with concurrency" -args = ["run", "-r", "--parallel", "--concurrency", "3", "build"] +name = "parallel with concurrency-limit" +args = ["run", "-r", "--parallel", "--concurrency-limit", "3", "build"] # Nested vt run inherits parent concurrency [[plan]] name = "nested inherits parent concurrency" -args = ["run", "--concurrency", "2", "build"] +args = ["run", "--concurrency-limit", "2", "build"] -# Nested vt run with explicit --concurrency overrides parent +# Nested vt run with explicit --concurrency-limit overrides parent [[plan]] name = "nested overrides parent concurrency" -args = ["run", "--concurrency", "2", "build-with-concurrency"] +args = ["run", "--concurrency-limit", "2", "build-with-concurrency"] diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - concurrency with explicit value.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - concurrency-limit with explicit value.snap similarity index 99% rename from crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - concurrency with explicit value.snap rename to crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - concurrency-limit with explicit value.snap index 1fbf2214..a33bbd36 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - concurrency with explicit value.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - concurrency-limit with explicit value.snap @@ -5,7 +5,7 @@ info: args: - run - "-r" - - "--concurrency" + - "--concurrency-limit" - "5" - build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap index e1f6a32e..a2823606 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap @@ -4,7 +4,7 @@ expression: "&plan_json" info: args: - run - - "--concurrency" + - "--concurrency-limit" - "2" - build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested overrides parent concurrency.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested overrides parent concurrency.snap index a8b8ee2a..c8ee46a7 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested overrides parent concurrency.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested overrides parent concurrency.snap @@ -4,7 +4,7 @@ expression: "&plan_json" info: args: - run - - "--concurrency" + - "--concurrency-limit" - "2" - build-with-concurrency input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency @@ -30,7 +30,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-con "task_name": "build-with-concurrency", "package_path": "/" }, - "command": "vt run -r --concurrency 5 build", + "command": "vt run -r --concurrency-limit 5 build", "and_item_index": null, "cwd": "/" }, diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel with concurrency.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel with concurrency-limit.snap similarity index 99% rename from crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel with concurrency.snap rename to crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel with concurrency-limit.snap index dc9831f6..7d856058 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel with concurrency.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel with concurrency-limit.snap @@ -6,7 +6,7 @@ info: - run - "-r" - "--parallel" - - "--concurrency" + - "--concurrency-limit" - "3" - build input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel without concurrency.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel without concurrency-limit.snap similarity index 100% rename from crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel without concurrency.snap rename to crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - parallel without concurrency-limit.snap diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/task graph.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/task graph.snap index 6ef5ee97..768246a6 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/task graph.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/task graph.snap @@ -50,7 +50,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-con "package_path": "/" }, "resolved_config": { - "command": "vt run -r --concurrency 5 build", + "command": "vt run -r --concurrency-limit 5 build", "resolved_options": { "cwd": "/", "cache_config": { diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-disabled/snapshots/query - test runs without hooks when disabled.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-disabled/snapshots/query - test runs without hooks when disabled.snap index 1cf2bc01..173cfbf0 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-disabled/snapshots/query - test runs without hooks when disabled.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-disabled/snapshots/query - test runs without hooks when disabled.snap @@ -52,5 +52,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-dis "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-nested-run/snapshots/query - prescriptInHook runs when scriptInHook is called from a hook.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-nested-run/snapshots/query - prescriptInHook runs when scriptInHook is called from a hook.snap index 3ba05e30..3627717f 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-nested-run/snapshots/query - prescriptInHook runs when scriptInHook is called from a hook.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-nested-run/snapshots/query - prescriptInHook runs when scriptInHook is called from a hook.snap @@ -104,7 +104,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-nes "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } } }, @@ -139,5 +139,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-nes "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-task-no-hook/snapshots/query - task config test does not expand pretest hook.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-task-no-hook/snapshots/query - task config test does not expand pretest hook.snap index c6d89dfc..8c4c1322 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-task-no-hook/snapshots/query - task config test does not expand pretest hook.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-task-no-hook/snapshots/query - task config test does not expand pretest hook.snap @@ -52,5 +52,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks-tas "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - build runs with pre hook only.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - build runs with pre hook only.snap index fdff7407..b3e378f8 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - build runs with pre hook only.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - build runs with pre hook only.snap @@ -78,5 +78,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - extra args not passed to hooks.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - extra args not passed to hooks.snap index af150202..b3592131 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - extra args not passed to hooks.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - extra args not passed to hooks.snap @@ -106,5 +106,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - pretest directly expands prepretest but not when called as hook.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - pretest directly expands prepretest but not when called as hook.snap index 8b5f6924..d6caa487 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - pretest directly expands prepretest but not when called as hook.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - pretest directly expands prepretest but not when called as hook.snap @@ -78,5 +78,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - test runs with pre and post hooks.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - test runs with pre and post hooks.snap index 8085d110..8c59d369 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - test runs with pre and post hooks.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks/snapshots/query - test runs with pre and post hooks.snap @@ -104,5 +104,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/script-hooks "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/shell-fallback/snapshots/query - shell fallback for pipe command.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/shell-fallback/snapshots/query - shell fallback for pipe command.snap index 638f6d4e..b0496247 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/shell-fallback/snapshots/query - shell fallback for pipe command.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/shell-fallback/snapshots/query - shell fallback for pipe command.snap @@ -89,5 +89,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/shell-fallback "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - parent cache false does not affect expanded query tasks.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - parent cache false does not affect expanded query tasks.snap index 988890e1..7dc94216 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - parent cache false does not affect expanded query tasks.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - parent cache false does not affect expanded query tasks.snap @@ -115,7 +115,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache- "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } } } @@ -124,5 +124,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache- "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script cache false does not affect expanded synthetic cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script cache false does not affect expanded synthetic cache.snap index 72b6f01c..5b5acfec 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script cache false does not affect expanded synthetic cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script cache false does not affect expanded synthetic cache.snap @@ -115,7 +115,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache- "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } } } @@ -124,5 +124,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache- "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script without cache.scripts defaults to no cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script without cache.scripts defaults to no cache.snap index af36aa2d..13285719 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script without cache.scripts defaults to no cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - script without cache.scripts defaults to no cache.snap @@ -57,5 +57,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache- "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task untrackedEnv inherited by synthetic.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task untrackedEnv inherited by synthetic.snap index f7d82879..cea7eaa8 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task untrackedEnv inherited by synthetic.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task untrackedEnv inherited by synthetic.snap @@ -90,5 +90,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache- "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache false disables synthetic cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache false disables synthetic cache.snap index 8402a4e9..1b9647c6 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache false disables synthetic cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache false disables synthetic cache.snap @@ -57,5 +57,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache- "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache true enables synthetic cache.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache true enables synthetic cache.snap index 42d859ea..0aabadb4 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache true enables synthetic cache.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache-disabled/snapshots/query - task with cache true enables synthetic cache.snap @@ -89,5 +89,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-cache- "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-in-subpackage/snapshots/query - synthetic-in-subpackage.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-in-subpackage/snapshots/query - synthetic-in-subpackage.snap index 25102b1f..f387431f 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-in-subpackage/snapshots/query - synthetic-in-subpackage.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-in-subpackage/snapshots/query - synthetic-in-subpackage.snap @@ -115,7 +115,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-in-sub "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } } } @@ -124,5 +124,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/synthetic-in-sub "neighbors": [] } ], - "concurrency_limit": 10 + "concurrency_limit": 4 } From 259588fef080ebb6be338ced4fccefc498cb1750 Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 18:20:37 +0800 Subject: [PATCH 05/21] fix: remove broken CONCURRENCY_LIMIT doc link Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/vite_task/src/session/execute/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/vite_task/src/session/execute/mod.rs b/crates/vite_task/src/session/execute/mod.rs index 8aba7f5b..4e03668d 100644 --- a/crates/vite_task/src/session/execute/mod.rs +++ b/crates/vite_task/src/session/execute/mod.rs @@ -76,7 +76,7 @@ impl ExecutionContext<'_> { /// /// Uses a DAG scheduler: tasks whose dependencies have all completed are scheduled /// onto a `FuturesUnordered`, bounded by a per-graph `Semaphore` with - /// [`CONCURRENCY_LIMIT`] permits. Each recursive `Expanded` graph creates its own + /// `concurrency_limit` permits. Each recursive `Expanded` graph creates its own /// semaphore, so nested graphs have independent concurrency limits. /// /// Fast-fail: if any task fails, `execute_leaf` cancels the `CancellationToken` From f5ae5a93f6344a83857befd483309e56baf36610 Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 18:30:31 +0800 Subject: [PATCH 06/21] docs: add concurrency documentation Co-Authored-By: Claude Opus 4.6 (1M context) --- docs/concurrency.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/concurrency.md diff --git a/docs/concurrency.md b/docs/concurrency.md new file mode 100644 index 00000000..828dc9f4 --- /dev/null +++ b/docs/concurrency.md @@ -0,0 +1,28 @@ +# Concurrency + +By default, `vp run` executes up to 4 tasks at the same time while respecting the dependency order between them. + +## `--concurrency-limit` + +Override the number of tasks that can run simultaneously: + +```sh +vp run -r build --concurrency-limit 1 # one at a time (sequential) +vp run -r build --concurrency-limit 16 # up to 16 at once +``` + +## `--parallel` + +Run all matched tasks at the same time, ignoring dependency order: + +```sh +vp run -r lint --parallel +``` + +This is useful for tasks like linting or type-checking that don't depend on each other's output. + +`--parallel` also removes the concurrency limit. To run tasks in parallel but still cap how many run at once, combine both flags: + +```sh +vp run -r lint --parallel --concurrency-limit 8 +``` From a471fa6896802cc3d6fe0fc32a2c0330dc40449c Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 19:40:37 +0800 Subject: [PATCH 07/21] docs: fix flag ordering in concurrency examples Flags must appear before the task name. Co-Authored-By: Claude Opus 4.6 (1M context) --- docs/concurrency.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/concurrency.md b/docs/concurrency.md index 828dc9f4..c47c70a6 100644 --- a/docs/concurrency.md +++ b/docs/concurrency.md @@ -7,8 +7,8 @@ By default, `vp run` executes up to 4 tasks at the same time while respecting th Override the number of tasks that can run simultaneously: ```sh -vp run -r build --concurrency-limit 1 # one at a time (sequential) -vp run -r build --concurrency-limit 16 # up to 16 at once +vp run -r --concurrency-limit 1 build # one at a time (sequential) +vp run -r --concurrency-limit 16 build # up to 16 at once ``` ## `--parallel` @@ -16,7 +16,7 @@ vp run -r build --concurrency-limit 16 # up to 16 at once Run all matched tasks at the same time, ignoring dependency order: ```sh -vp run -r lint --parallel +vp run -r --parallel lint ``` This is useful for tasks like linting or type-checking that don't depend on each other's output. @@ -24,5 +24,5 @@ This is useful for tasks like linting or type-checking that don't depend on each `--parallel` also removes the concurrency limit. To run tasks in parallel but still cap how many run at once, combine both flags: ```sh -vp run -r lint --parallel --concurrency-limit 8 +vp run -r --parallel --concurrency-limit 8 lint ``` From 7b35c53fb480473d032a12c20d568e003ab45e87 Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 19:51:08 +0800 Subject: [PATCH 08/21] docs: add design rationale to concurrency documentation Co-Authored-By: Claude Opus 4.6 (1M context) --- docs/concurrency.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/docs/concurrency.md b/docs/concurrency.md index c47c70a6..9d72ae25 100644 --- a/docs/concurrency.md +++ b/docs/concurrency.md @@ -4,25 +4,39 @@ By default, `vp run` executes up to 4 tasks at the same time while respecting th ## `--concurrency-limit` -Override the number of tasks that can run simultaneously: +Override the maximum number of tasks that can run simultaneously: ```sh -vp run -r --concurrency-limit 1 build # one at a time (sequential) -vp run -r --concurrency-limit 16 build # up to 16 at once +vp run -t --concurrency-limit 1 build # one at a time (sequential) +vp run -t --concurrency-limit 16 build # up to 16 at once ``` +**Why it defaults to 4**: Same as pnpm. It balances between enough concurrency to keep the machine busy and leaving headroom for the tasks themselves, which often consume all available CPU cores (e.g. `tsc`, bundlers). + +**Why the name `--concurrency-limit`**: It conveys that this is **an upper bound, not a target**. We plan to introduce task-level concurrency control (e.g. a build task that already saturates all CPU cores), and when that lands the actual concurrency may be less than the limit. + +Equivalent flags in other tools: + +| pnpm | Turborepo | Nx | +| ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | +| [`--workspace-concurrency`](https://pnpm.io/cli/recursive#--workspace-concurrency) | [`--concurrency`](https://turborepo.dev/docs/reference/run#--concurrency-number--percentage) | [`--parallel`](https://nx.dev/nx-api/nx/documents/run-many#parallel) | + ## `--parallel` Run all matched tasks at the same time, ignoring dependency order: ```sh -vp run -r --parallel lint +vp run -r --parallel dev ``` -This is useful for tasks like linting or type-checking that don't depend on each other's output. - -`--parallel` also removes the concurrency limit. To run tasks in parallel but still cap how many run at once, combine both flags: +**`--parallel` also removes the concurrency limit** (same as pnpm), which is useful for starting multiple dev servers that run indefinitely. To run tasks in parallel but still cap how many run at once, combine both flags: ```sh vp run -r --parallel --concurrency-limit 8 lint ``` + +Equivalent flags in other tools: + +| pnpm | Turborepo | Nx | +| -------------------------------------------------- | ------------------------------------------------------------------- | --- | +| [`--parallel`](https://pnpm.io/cli/run#--parallel) | [`--parallel`](https://turborepo.dev/docs/reference/run#--parallel) | n/a | From f22f8f03054f2bc9240da6e1d4073928479dd267 Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 20:23:09 +0800 Subject: [PATCH 09/21] refactor: replace concurrency inheritance with VP_RUN_CONCURRENCY_LIMIT env var Remove the implicit context-based concurrency inheritance. Instead, use the VP_RUN_CONCURRENCY_LIMIT environment variable (which naturally passes through to child processes since VP_* is already untracked). Priority order: --concurrency-limit flag > VP_RUN_CONCURRENCY_LIMIT env > --parallel (unlimited) > default (4). Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/vite_task/src/session/mod.rs | 5 + crates/vite_task_plan/src/context.rs | 16 -- crates/vite_task_plan/src/error.rs | 3 + crates/vite_task_plan/src/lib.rs | 1 - crates/vite_task_plan/src/plan.rs | 28 ++- .../parallel-and-concurrency/snapshots.toml | 19 +- .../query - cli flag overrides env var.snap | 171 ++++++++++++++++ .../query - env var sets concurrency.snap | 169 ++++++++++++++++ ... - nested inherits parent concurrency.snap | 190 ------------------ ...sted with explicit concurrency-limit.snap} | 4 +- .../tests/plan_snapshots/main.rs | 18 ++ docs/concurrency.md | 35 +++- 12 files changed, 429 insertions(+), 230 deletions(-) create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - cli flag overrides env var.snap create mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - env var sets concurrency.snap delete mode 100644 crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap rename crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/{query - nested overrides parent concurrency.snap => query - nested with explicit concurrency-limit.snap} (99%) diff --git a/crates/vite_task/src/session/mod.rs b/crates/vite_task/src/session/mod.rs index 09c7e8df..44e675c5 100644 --- a/crates/vite_task/src/session/mod.rs +++ b/crates/vite_task/src/session/mod.rs @@ -591,6 +591,11 @@ impl<'a> Session<'a> { &self.envs } + /// Mutably access the environment map, cloning the `Arc` if shared. + pub fn envs_mut(&mut self) -> &mut FxHashMap, Arc> { + Arc::make_mut(&mut self.envs) + } + pub const fn cwd(&self) -> &Arc { &self.cwd } diff --git a/crates/vite_task_plan/src/context.rs b/crates/vite_task_plan/src/context.rs index accb5351..119d68af 100644 --- a/crates/vite_task_plan/src/context.rs +++ b/crates/vite_task_plan/src/context.rs @@ -45,17 +45,12 @@ pub struct PlanContext<'a> { /// Final resolved global cache config, combining the graph's config with any CLI override. resolved_global_cache: ResolvedGlobalCacheConfig, - /// Resolved concurrency limit inherited from the parent level. - /// At the root level this defaults to [`crate::DEFAULT_CONCURRENCY_LIMIT`]. - resolved_concurrency: usize, - /// The query that caused the current expansion. /// Used by the skip rule to detect and skip duplicate nested expansions. parent_query: Arc, } impl<'a> PlanContext<'a> { - #[expect(clippy::too_many_arguments, reason = "context initialization requires all fields")] pub fn new( workspace_path: &'a Arc, cwd: Arc, @@ -63,7 +58,6 @@ impl<'a> PlanContext<'a> { callbacks: &'a mut (dyn PlanRequestParser + 'a), indexed_task_graph: &'a IndexedTaskGraph, resolved_global_cache: ResolvedGlobalCacheConfig, - resolved_concurrency: usize, parent_query: Arc, ) -> Self { Self { @@ -75,7 +69,6 @@ impl<'a> PlanContext<'a> { indexed_task_graph, extra_args: Arc::default(), resolved_global_cache, - resolved_concurrency, parent_query, } } @@ -143,14 +136,6 @@ impl<'a> PlanContext<'a> { self.resolved_global_cache = config; } - pub const fn resolved_concurrency(&self) -> usize { - self.resolved_concurrency - } - - pub const fn set_resolved_concurrency(&mut self, concurrency: usize) { - self.resolved_concurrency = concurrency; - } - pub fn parent_query(&self) -> &TaskQuery { &self.parent_query } @@ -175,7 +160,6 @@ 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, - resolved_concurrency: self.resolved_concurrency, parent_query: Arc::clone(&self.parent_query), } } diff --git a/crates/vite_task_plan/src/error.rs b/crates/vite_task_plan/src/error.rs index 66db2783..7a255b8d 100644 --- a/crates/vite_task_plan/src/error.rs +++ b/crates/vite_task_plan/src/error.rs @@ -154,6 +154,9 @@ pub enum Error { #[error("Task \"{0}\" not found")] NoTasksMatched(Str), + #[error("Invalid value for VP_RUN_CONCURRENCY_LIMIT: {0:?}")] + InvalidConcurrencyLimitEnv(Arc), + /// A cycle was detected in the task dependency graph during planning. /// /// This is caught by `AcyclicGraph::try_from_graph`, which validates that the diff --git a/crates/vite_task_plan/src/lib.rs b/crates/vite_task_plan/src/lib.rs index 0eac570e..c749ef29 100644 --- a/crates/vite_task_plan/src/lib.rs +++ b/crates/vite_task_plan/src/lib.rs @@ -209,7 +209,6 @@ pub async fn plan_query( plan_request_parser, indexed_task_graph, resolved_global_cache, - DEFAULT_CONCURRENCY_LIMIT, Arc::clone(&query), ); plan_query_request(query, plan_options, context).await diff --git a/crates/vite_task_plan/src/plan.rs b/crates/vite_task_plan/src/plan.rs index 68595a8a..1a9e2b37 100644 --- a/crates/vite_task_plan/src/plan.rs +++ b/crates/vite_task_plan/src/plan.rs @@ -677,20 +677,22 @@ pub async fn plan_query_request( } // Resolve effective concurrency for this level. // - // When `Some(n)`, use the explicit value. When `None`, inherit from the - // parent context — unless `--parallel` is set without `--concurrency-limit`, - // in which case use unlimited concurrency. + // Priority (highest to lowest): + // 1. `--concurrency-limit N` CLI flag + // 2. `VP_RUN_CONCURRENCY_LIMIT` env var + // 3. `--parallel` (without the above) → unlimited + // 4. `DEFAULT_CONCURRENCY_LIMIT` (4) let effective_concurrency = match plan_options.concurrency_limit { Some(n) => n, None => { if plan_options.parallel { usize::MAX } else { - context.resolved_concurrency() + concurrency_limit_from_env(context.envs())? + .unwrap_or(crate::DEFAULT_CONCURRENCY_LIMIT) } } }; - context.set_resolved_concurrency(effective_concurrency); let parallel = plan_options.parallel; @@ -802,6 +804,22 @@ pub async fn plan_query_request( }) } +/// Parse `VP_RUN_CONCURRENCY_LIMIT` from the environment variables. +/// +/// Returns `Ok(None)` if the variable is not set. +/// Returns `Err` if the variable is set but cannot be parsed as a positive integer. +#[expect(clippy::result_large_err, reason = "Error type is shared across all plan functions")] +fn concurrency_limit_from_env( + envs: &FxHashMap, Arc>, +) -> Result, Error> { + let Some(value) = envs.get(OsStr::new("VP_RUN_CONCURRENCY_LIMIT")) else { + return Ok(None); + }; + let s = value.to_str().ok_or_else(|| Error::InvalidConcurrencyLimitEnv(Arc::clone(value)))?; + let n: usize = s.parse().map_err(|_| Error::InvalidConcurrencyLimitEnv(Arc::clone(value)))?; + Ok(Some(n.max(1))) +} + #[cfg(test)] mod tests { use std::collections::BTreeSet; diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml index 54103b82..d3b72979 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots.toml @@ -31,12 +31,19 @@ args = ["run", "-r", "--parallel", "build"] name = "parallel with concurrency-limit" args = ["run", "-r", "--parallel", "--concurrency-limit", "3", "build"] -# Nested vt run inherits parent concurrency +# Nested vt run with explicit --concurrency-limit [[plan]] -name = "nested inherits parent concurrency" -args = ["run", "--concurrency-limit", "2", "build"] +name = "nested with explicit concurrency-limit" +args = ["run", "build-with-concurrency"] -# Nested vt run with explicit --concurrency-limit overrides parent +# VP_RUN_CONCURRENCY_LIMIT env var sets concurrency [[plan]] -name = "nested overrides parent concurrency" -args = ["run", "--concurrency-limit", "2", "build-with-concurrency"] +name = "env var sets concurrency" +args = ["run", "-r", "build"] +env = { VP_RUN_CONCURRENCY_LIMIT = "7" } + +# --concurrency-limit flag takes priority over VP_RUN_CONCURRENCY_LIMIT env +[[plan]] +name = "cli flag overrides env var" +args = ["run", "-r", "--concurrency-limit", "3", "build"] +env = { VP_RUN_CONCURRENCY_LIMIT = "7" } diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - cli flag overrides env var.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - cli flag overrides env var.snap new file mode 100644 index 00000000..052cc154 --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - cli flag overrides env var.snap @@ -0,0 +1,171 @@ +--- +source: crates/vite_task_plan/tests/plan_snapshots/main.rs +expression: "&plan_json" +info: + args: + - run + - "-r" + - "--concurrency-limit" + - "3" + - build +input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency +--- +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build", + "package_path": "/" + }, + "items": [] + }, + "neighbors": [] + }, + { + "key": [ + "/packages/a", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "command": "echo building a", + "and_item_index": null, + "cwd": "/packages/a" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "a" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [ + [ + "/packages/b", + "build" + ] + ] + }, + { + "key": [ + "/packages/b", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "command": "echo building b", + "and_item_index": null, + "cwd": "/packages/b" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "b" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [ + [ + "/packages/c", + "build" + ] + ] + }, + { + "key": [ + "/packages/c", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "command": "echo building c", + "and_item_index": null, + "cwd": "/packages/c" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "c" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 3 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - env var sets concurrency.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - env var sets concurrency.snap new file mode 100644 index 00000000..db02c515 --- /dev/null +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - env var sets concurrency.snap @@ -0,0 +1,169 @@ +--- +source: crates/vite_task_plan/tests/plan_snapshots/main.rs +expression: "&plan_json" +info: + args: + - run + - "-r" + - build +input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency +--- +{ + "graph": [ + { + "key": [ + "/", + "build" + ], + "node": { + "task_display": { + "package_name": "test-workspace", + "task_name": "build", + "package_path": "/" + }, + "items": [] + }, + "neighbors": [] + }, + { + "key": [ + "/packages/a", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/a", + "task_name": "build", + "package_path": "/packages/a" + }, + "command": "echo building a", + "and_item_index": null, + "cwd": "/packages/a" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "a" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [ + [ + "/packages/b", + "build" + ] + ] + }, + { + "key": [ + "/packages/b", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/b", + "task_name": "build", + "package_path": "/packages/b" + }, + "command": "echo building b", + "and_item_index": null, + "cwd": "/packages/b" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "b" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [ + [ + "/packages/c", + "build" + ] + ] + }, + { + "key": [ + "/packages/c", + "build" + ], + "node": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "items": [ + { + "execution_item_display": { + "task_display": { + "package_name": "@test/c", + "task_name": "build", + "package_path": "/packages/c" + }, + "command": "echo building c", + "and_item_index": null, + "cwd": "/packages/c" + }, + "kind": { + "Leaf": { + "InProcess": { + "kind": { + "Echo": { + "strings": [ + "building", + "c" + ], + "trailing_newline": true + } + } + } + } + } + } + ] + }, + "neighbors": [] + } + ], + "concurrency_limit": 7 +} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap deleted file mode 100644 index a2823606..00000000 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested inherits parent concurrency.snap +++ /dev/null @@ -1,190 +0,0 @@ ---- -source: crates/vite_task_plan/tests/plan_snapshots/main.rs -expression: "&plan_json" -info: - args: - - run - - "--concurrency-limit" - - "2" - - build -input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency ---- -{ - "graph": [ - { - "key": [ - "/", - "build" - ], - "node": { - "task_display": { - "package_name": "test-workspace", - "task_name": "build", - "package_path": "/" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "test-workspace", - "task_name": "build", - "package_path": "/" - }, - "command": "vt run -r build", - "and_item_index": null, - "cwd": "/" - }, - "kind": { - "Expanded": { - "graph": [ - { - "key": [ - "/packages/a", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/a", - "task_name": "build", - "package_path": "/packages/a" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/a", - "task_name": "build", - "package_path": "/packages/a" - }, - "command": "echo building a", - "and_item_index": null, - "cwd": "/packages/a" - }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "building", - "a" - ], - "trailing_newline": true - } - } - } - } - } - } - ] - }, - "neighbors": [ - [ - "/packages/b", - "build" - ] - ] - }, - { - "key": [ - "/packages/b", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/b", - "task_name": "build", - "package_path": "/packages/b" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/b", - "task_name": "build", - "package_path": "/packages/b" - }, - "command": "echo building b", - "and_item_index": null, - "cwd": "/packages/b" - }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "building", - "b" - ], - "trailing_newline": true - } - } - } - } - } - } - ] - }, - "neighbors": [ - [ - "/packages/c", - "build" - ] - ] - }, - { - "key": [ - "/packages/c", - "build" - ], - "node": { - "task_display": { - "package_name": "@test/c", - "task_name": "build", - "package_path": "/packages/c" - }, - "items": [ - { - "execution_item_display": { - "task_display": { - "package_name": "@test/c", - "task_name": "build", - "package_path": "/packages/c" - }, - "command": "echo building c", - "and_item_index": null, - "cwd": "/packages/c" - }, - "kind": { - "Leaf": { - "InProcess": { - "kind": { - "Echo": { - "strings": [ - "building", - "c" - ], - "trailing_newline": true - } - } - } - } - } - } - ] - }, - "neighbors": [] - } - ], - "concurrency_limit": 2 - } - } - } - ] - }, - "neighbors": [] - } - ], - "concurrency_limit": 2 -} diff --git a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested overrides parent concurrency.snap b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested with explicit concurrency-limit.snap similarity index 99% rename from crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested overrides parent concurrency.snap rename to crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested with explicit concurrency-limit.snap index c8ee46a7..a786312f 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested overrides parent concurrency.snap +++ b/crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency/snapshots/query - nested with explicit concurrency-limit.snap @@ -4,8 +4,6 @@ expression: "&plan_json" info: args: - run - - "--concurrency-limit" - - "2" - build-with-concurrency input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-concurrency --- @@ -201,5 +199,5 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/parallel-and-con "neighbors": [] } ], - "concurrency_limit": 2 + "concurrency_limit": 4 } diff --git a/crates/vite_task_plan/tests/plan_snapshots/main.rs b/crates/vite_task_plan/tests/plan_snapshots/main.rs index 73d5c864..4da61062 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/main.rs +++ b/crates/vite_task_plan/tests/plan_snapshots/main.rs @@ -36,6 +36,8 @@ struct Plan { pub cwd: RelativePathBuf, #[serde(default)] pub compact: bool, + #[serde(default)] + pub env: BTreeMap, } #[derive(serde::Deserialize, Default)] @@ -248,6 +250,17 @@ fn run_case_inner( panic!("only `run` commands supported in plan tests") }; + // Inject per-case environment variables, removing them after the plan call. + let env_keys: Vec> = plan + .env + .iter() + .map(|(k, v)| { + let key = Arc::::from(OsStr::new(k.as_str())); + session.envs_mut().insert(Arc::clone(&key), Arc::from(OsStr::new(v.as_str()))); + key + }) + .collect(); + let plan_result = session .plan_from_cli_run(workspace_root.path.join(plan.cwd).into(), run_command) .await; @@ -284,6 +297,11 @@ fn run_case_inner( let plan_json = redact_snapshot(&plan, workspace_root_str); insta::assert_json_snapshot!(snapshot_name.as_str(), &plan_json); } + + // Clean up per-case environment variables. + for key in env_keys { + session.envs_mut().remove(&key); + } } }); } diff --git a/docs/concurrency.md b/docs/concurrency.md index 9d72ae25..e6b7cb6b 100644 --- a/docs/concurrency.md +++ b/docs/concurrency.md @@ -1,19 +1,25 @@ # Concurrency -By default, `vp run` executes up to 4 tasks at the same time while respecting the dependency order between them. +`vp run` runs up to 4 tasks at once, respecting dependency order. -## `--concurrency-limit` - -Override the maximum number of tasks that can run simultaneously: +## `--concurrency-limit`/`VP_RUN_CONCURRENCY_LIMIT` ```sh -vp run -t --concurrency-limit 1 build # one at a time (sequential) +vp run -t --concurrency-limit 1 build # sequential vp run -t --concurrency-limit 16 build # up to 16 at once ``` -**Why it defaults to 4**: Same as pnpm. It balances between enough concurrency to keep the machine busy and leaving headroom for the tasks themselves, which often consume all available CPU cores (e.g. `tsc`, bundlers). +Also settable via the `VP_RUN_CONCURRENCY_LIMIT` env var. The CLI flag wins when both are present. + +**Default is 4** (same as pnpm) — enough to keep the machine busy while leaving room for tasks that already use all cores (bundlers, `tsc`, etc.). + +**Why the name `--concurrency-limit`**: The name makes clear this is an upper bound, not a target. We plan to add per-task concurrency control in `vite.config.*` (e.g. marking a build task as CPU-heavy), so the actual concurrency may end up lower than the limit. + +**Why not support CPU percentage** (like Turborepo's `--concurrency 50%`): This setting is meant to be a simple upper bound. CPU-core-aware concurrency control belongs at the per-task level, which we plan to add in the future. + +**Why support `VP_RUN_CONCURRENCY_LIMIT` env**: To allow people to apply it to every `vp run` without repeating the flag, especially in CI. -**Why the name `--concurrency-limit`**: It conveys that this is **an upper bound, not a target**. We plan to introduce task-level concurrency control (e.g. a build task that already saturates all CPU cores), and when that lands the actual concurrency may be less than the limit. +**Why not support `concurrencyLimit` in `vite.config.*`**: The right limit usually depends on the machine, not the project. We reserve config-file concurrency settings for per-task hints (see above). Equivalent flags in other tools: @@ -23,13 +29,15 @@ Equivalent flags in other tools: ## `--parallel` -Run all matched tasks at the same time, ignoring dependency order: +Ignores dependency order and removes the concurrency limit: ```sh vp run -r --parallel dev ``` -**`--parallel` also removes the concurrency limit** (same as pnpm), which is useful for starting multiple dev servers that run indefinitely. To run tasks in parallel but still cap how many run at once, combine both flags: +Useful for starting dev servers that all need to run at the same time. Same behavior as `--parallel` in pnpm. + +To ignore dependency order but still cap concurrency, combine both flags: ```sh vp run -r --parallel --concurrency-limit 8 lint @@ -40,3 +48,12 @@ Equivalent flags in other tools: | pnpm | Turborepo | Nx | | -------------------------------------------------- | ------------------------------------------------------------------- | --- | | [`--parallel`](https://pnpm.io/cli/run#--parallel) | [`--parallel`](https://turborepo.dev/docs/reference/run#--parallel) | n/a | + +## Resolution order of concurrency limit + +The concurrency limit is resolved in this order (first match wins): + +1. `--concurrency-limit` CLI flag +2. `VP_RUN_CONCURRENCY_LIMIT` env var +3. `--parallel` without the above → unlimited +4. Default: 4 From 4f680034ac57ae92ab4abd446d3f8914f1f63d87 Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 20:59:33 +0800 Subject: [PATCH 10/21] fix: guard interactive selector against execution flags, cap semaphore - Only show the interactive task selector when no execution flags (--concurrency-limit, --parallel) are present - Cap semaphore permits to Semaphore::MAX_PERMITS to avoid panic when concurrency_limit is usize::MAX (from --parallel) Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/vite_task/src/session/execute/mod.rs | 3 ++- crates/vite_task/src/session/mod.rs | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/vite_task/src/session/execute/mod.rs b/crates/vite_task/src/session/execute/mod.rs index 4e03668d..9f5877ed 100644 --- a/crates/vite_task/src/session/execute/mod.rs +++ b/crates/vite_task/src/session/execute/mod.rs @@ -88,7 +88,8 @@ impl ExecutionContext<'_> { return; } - let semaphore = Arc::new(Semaphore::new(graph.concurrency_limit)); + let semaphore = + Arc::new(Semaphore::new(graph.concurrency_limit.min(Semaphore::MAX_PERMITS))); // Compute dependency count for each node. // Edge A→B means "A depends on B", so A's dependency count = outgoing edge count. diff --git a/crates/vite_task/src/session/mod.rs b/crates/vite_task/src/session/mod.rs index 44e675c5..e7b5fb10 100644 --- a/crates/vite_task/src/session/mod.rs +++ b/crates/vite_task/src/session/mod.rs @@ -274,9 +274,13 @@ impl<'a> Session<'a> { self.plan_from_cli_run_resolved(cwd, run_command.clone()).await?; if graph.graph.node_count() == 0 { - // No tasks matched. With is_cwd_only (no scope flags) the - // task name is a typo — show the selector. Otherwise error. - if is_cwd_only { + // No tasks matched. Show the interactive selector only when + // the command has no scope flags and no execution flags + // (concurrency-limit, parallel) — otherwise the user intended + // a specific execution mode and a typo should be an error. + let has_execution_flags = run_command.flags.concurrency_limit.is_some() + || run_command.flags.parallel; + if is_cwd_only && !has_execution_flags { let qpr = self.handle_no_task(is_interactive, &run_command).await?; self.plan_from_query(qpr).await? } else { From 7c255fbf01865a0b271a3abb62353e450ae19b1f Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 21:04:15 +0800 Subject: [PATCH 11/21] update docs --- docs/concurrency.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/concurrency.md b/docs/concurrency.md index e6b7cb6b..3523f32c 100644 --- a/docs/concurrency.md +++ b/docs/concurrency.md @@ -1,6 +1,6 @@ # Concurrency -`vp run` runs up to 4 tasks at once, respecting dependency order. +`vp run` runs up to 4 tasks at once by default, respecting dependency order. ## `--concurrency-limit`/`VP_RUN_CONCURRENCY_LIMIT` From e9f8d0fd1cfc724d003f5ad3bdf8231bd39140ae Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 21:07:45 +0800 Subject: [PATCH 12/21] fix: correct concurrency resolution order in docs and comments --parallel takes priority over VP_RUN_CONCURRENCY_LIMIT, not the other way around. The code was correct; the docs and comments were not. Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/vite_task_plan/src/plan.rs | 4 ++-- docs/concurrency.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/vite_task_plan/src/plan.rs b/crates/vite_task_plan/src/plan.rs index 1a9e2b37..e9436680 100644 --- a/crates/vite_task_plan/src/plan.rs +++ b/crates/vite_task_plan/src/plan.rs @@ -679,8 +679,8 @@ pub async fn plan_query_request( // // Priority (highest to lowest): // 1. `--concurrency-limit N` CLI flag - // 2. `VP_RUN_CONCURRENCY_LIMIT` env var - // 3. `--parallel` (without the above) → unlimited + // 2. `--parallel` (without the above) → unlimited + // 3. `VP_RUN_CONCURRENCY_LIMIT` env var // 4. `DEFAULT_CONCURRENCY_LIMIT` (4) let effective_concurrency = match plan_options.concurrency_limit { Some(n) => n, diff --git a/docs/concurrency.md b/docs/concurrency.md index 3523f32c..57b021cd 100644 --- a/docs/concurrency.md +++ b/docs/concurrency.md @@ -54,6 +54,6 @@ Equivalent flags in other tools: The concurrency limit is resolved in this order (first match wins): 1. `--concurrency-limit` CLI flag -2. `VP_RUN_CONCURRENCY_LIMIT` env var -3. `--parallel` without the above → unlimited +2. `--parallel` without the above → unlimited +3. `VP_RUN_CONCURRENCY_LIMIT` env var 4. Default: 4 From e105318967d166ef3b286c5b0b306bd7128add2d Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 29 Mar 2026 21:15:57 +0800 Subject: [PATCH 13/21] test(e2e): add --parallel flag execution test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Package b depends on a, so without --parallel they run sequentially. Both use a barrier requiring 2 participants — completing without timeout proves --parallel discards edges and runs them concurrently. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../fixtures/parallel-execution/package.json | 4 ++++ .../parallel-execution/packages/a/package.json | 6 ++++++ .../parallel-execution/packages/b/package.json | 9 +++++++++ .../fixtures/parallel-execution/pnpm-workspace.yaml | 2 ++ .../fixtures/parallel-execution/snapshots.toml | 8 ++++++++ ...rallel flag runs dependent tasks concurrently.snap | 11 +++++++++++ .../fixtures/parallel-execution/vite-task.json | 3 +++ 7 files changed, 43 insertions(+) create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/package.json create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/packages/a/package.json create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/packages/b/package.json create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/pnpm-workspace.yaml create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/snapshots.toml create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/snapshots/parallel flag runs dependent tasks concurrently.snap create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/vite-task.json diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/package.json b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/package.json new file mode 100644 index 00000000..9bb9eec6 --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/package.json @@ -0,0 +1,4 @@ +{ + "name": "parallel-execution-test", + "private": true +} diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/packages/a/package.json b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/packages/a/package.json new file mode 100644 index 00000000..094c896c --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/packages/a/package.json @@ -0,0 +1,6 @@ +{ + "name": "@parallel/a", + "scripts": { + "build": "vtt barrier ../../.barrier sync 2" + } +} diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/packages/b/package.json b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/packages/b/package.json new file mode 100644 index 00000000..84cf6429 --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/packages/b/package.json @@ -0,0 +1,9 @@ +{ + "name": "@parallel/b", + "scripts": { + "build": "vtt barrier ../../.barrier sync 2" + }, + "dependencies": { + "@parallel/a": "workspace:*" + } +} diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/pnpm-workspace.yaml b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/pnpm-workspace.yaml new file mode 100644 index 00000000..924b55f4 --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/snapshots.toml b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/snapshots.toml new file mode 100644 index 00000000..de1cbd21 --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/snapshots.toml @@ -0,0 +1,8 @@ +# Package b depends on a, so without --parallel they run sequentially. +# Both use a barrier requiring 2 participants — if run sequentially the +# first would wait forever and the test would timeout. +# --parallel discards dependency edges, allowing both to run at once. + +[[e2e]] +name = "parallel flag runs dependent tasks concurrently" +steps = [["vt", "run", "-r", "--parallel", "build"]] diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/snapshots/parallel flag runs dependent tasks concurrently.snap b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/snapshots/parallel flag runs dependent tasks concurrently.snap new file mode 100644 index 00000000..a06f33e0 --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/snapshots/parallel flag runs dependent tasks concurrently.snap @@ -0,0 +1,11 @@ +--- +source: crates/vite_task_bin/tests/e2e_snapshots/main.rs +expression: e2e_outputs +--- +> vt run -r --parallel build +~/packages/a$ vtt barrier ../../.barrier sync 2 ⊘ cache disabled +~/packages/b$ vtt barrier ../../.barrier sync 2 ⊘ cache disabled + + +--- +vt run: 0/2 cache hit (0%). (Run `vt run --last-details` for full details) diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/vite-task.json b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/vite-task.json new file mode 100644 index 00000000..b39113d0 --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/parallel-execution/vite-task.json @@ -0,0 +1,3 @@ +{ + "cache": false +} From 48cbdeaedd1a57bd11dfb5e6955843e11875c671 Mon Sep 17 00:00:00 2001 From: branchseer Date: Tue, 31 Mar 2026 15:35:05 +0800 Subject: [PATCH 14/21] chore: add playground workspace for manual testing Co-Authored-By: Claude Opus 4.6 (1M context) --- playground/README.md | 28 ++++++++++++++++++++++++ playground/package.json | 4 ++++ playground/packages/app/build.mjs | 1 + playground/packages/app/dev.mjs | 6 +++++ playground/packages/app/lint.mjs | 1 + playground/packages/app/package.json | 11 ++++++++++ playground/packages/app/src/index.ts | 3 +++ playground/packages/app/test.mjs | 1 + playground/packages/app/typecheck.mjs | 1 + playground/packages/app/vite-task.json | 16 ++++++++++++++ playground/packages/lib/build.mjs | 1 + playground/packages/lib/dev.mjs | 6 +++++ playground/packages/lib/lint.mjs | 1 + playground/packages/lib/package.json | 11 ++++++++++ playground/packages/lib/src/index.ts | 5 +++++ playground/packages/lib/test.mjs | 1 + playground/packages/lib/typecheck.mjs | 1 + playground/packages/lib/vite-task.json | 16 ++++++++++++++ playground/packages/utils/build.mjs | 1 + playground/packages/utils/lint.mjs | 1 + playground/packages/utils/package.json | 5 +++++ playground/packages/utils/src/index.ts | 3 +++ playground/packages/utils/test.mjs | 1 + playground/packages/utils/vite-task.json | 13 +++++++++++ playground/pnpm-lock.yaml | 23 +++++++++++++++++++ playground/pnpm-workspace.yaml | 2 ++ playground/vite-task.json | 1 + 27 files changed, 164 insertions(+) create mode 100644 playground/README.md create mode 100644 playground/package.json create mode 100644 playground/packages/app/build.mjs create mode 100644 playground/packages/app/dev.mjs create mode 100644 playground/packages/app/lint.mjs create mode 100644 playground/packages/app/package.json create mode 100644 playground/packages/app/src/index.ts create mode 100644 playground/packages/app/test.mjs create mode 100644 playground/packages/app/typecheck.mjs create mode 100644 playground/packages/app/vite-task.json create mode 100644 playground/packages/lib/build.mjs create mode 100644 playground/packages/lib/dev.mjs create mode 100644 playground/packages/lib/lint.mjs create mode 100644 playground/packages/lib/package.json create mode 100644 playground/packages/lib/src/index.ts create mode 100644 playground/packages/lib/test.mjs create mode 100644 playground/packages/lib/typecheck.mjs create mode 100644 playground/packages/lib/vite-task.json create mode 100644 playground/packages/utils/build.mjs create mode 100644 playground/packages/utils/lint.mjs create mode 100644 playground/packages/utils/package.json create mode 100644 playground/packages/utils/src/index.ts create mode 100644 playground/packages/utils/test.mjs create mode 100644 playground/packages/utils/vite-task.json create mode 100644 playground/pnpm-lock.yaml create mode 100644 playground/pnpm-workspace.yaml create mode 100644 playground/vite-task.json diff --git a/playground/README.md b/playground/README.md new file mode 100644 index 00000000..d7072864 --- /dev/null +++ b/playground/README.md @@ -0,0 +1,28 @@ +# Playground + +A workspace for manually testing `vp run` (the task runner). + +## Structure + +``` +playground/ +├── packages/ +│ ├── app/ → depends on @playground/lib +│ ├── lib/ → depends on @playground/utils +│ └── utils/ → no dependencies +└── vite-task.json → workspace-level task config +``` + +Dependency chain: `app → lib → utils` + +## Scripts & Tasks + +Tasks are defined in each package's `vite-task.json` with caching enabled. `dev` is a package.json script (not cached). + +| Name | Type | Packages | Cached | Description | +| ----------- | ------ | --------------- | ------ | ---------------------------------------------- | +| `build` | task | app, lib, utils | yes | Prints a build message | +| `test` | task | app, lib, utils | yes | Prints a test message | +| `lint` | task | app, lib, utils | yes | Prints a lint message | +| `typecheck` | task | app, lib | yes | Prints a typecheck message | +| `dev` | script | app, lib | no | Long-running process (prints every 2s, ctrl-c) | diff --git a/playground/package.json b/playground/package.json new file mode 100644 index 00000000..51466b17 --- /dev/null +++ b/playground/package.json @@ -0,0 +1,4 @@ +{ + "name": "playground", + "private": true +} diff --git a/playground/packages/app/build.mjs b/playground/packages/app/build.mjs new file mode 100644 index 00000000..9b3bc870 --- /dev/null +++ b/playground/packages/app/build.mjs @@ -0,0 +1 @@ +console.log('Building app'); diff --git a/playground/packages/app/dev.mjs b/playground/packages/app/dev.mjs new file mode 100644 index 00000000..c6e4ab0e --- /dev/null +++ b/playground/packages/app/dev.mjs @@ -0,0 +1,6 @@ +process.on('SIGINT', () => { + console.log('app: dev server stopped'); + process.exit(0); +}); + +setInterval(() => console.log('app: waiting for changes...'), 2000); diff --git a/playground/packages/app/lint.mjs b/playground/packages/app/lint.mjs new file mode 100644 index 00000000..7f54bd9b --- /dev/null +++ b/playground/packages/app/lint.mjs @@ -0,0 +1 @@ +console.log('Linting app'); diff --git a/playground/packages/app/package.json b/playground/packages/app/package.json new file mode 100644 index 00000000..055ace37 --- /dev/null +++ b/playground/packages/app/package.json @@ -0,0 +1,11 @@ +{ + "name": "@playground/app", + "version": "0.0.0", + "private": true, + "scripts": { + "dev": "node dev.mjs" + }, + "dependencies": { + "@playground/lib": "workspace:*" + } +} diff --git a/playground/packages/app/src/index.ts b/playground/packages/app/src/index.ts new file mode 100644 index 00000000..7db55b49 --- /dev/null +++ b/playground/packages/app/src/index.ts @@ -0,0 +1,3 @@ +import { sum } from '@playground/lib'; + +console.log(sum(1, 2, 3)); diff --git a/playground/packages/app/test.mjs b/playground/packages/app/test.mjs new file mode 100644 index 00000000..7ffabb41 --- /dev/null +++ b/playground/packages/app/test.mjs @@ -0,0 +1 @@ +console.log('Testing app'); diff --git a/playground/packages/app/typecheck.mjs b/playground/packages/app/typecheck.mjs new file mode 100644 index 00000000..2980e420 --- /dev/null +++ b/playground/packages/app/typecheck.mjs @@ -0,0 +1 @@ +console.log('Typechecking app'); diff --git a/playground/packages/app/vite-task.json b/playground/packages/app/vite-task.json new file mode 100644 index 00000000..58a9b2b4 --- /dev/null +++ b/playground/packages/app/vite-task.json @@ -0,0 +1,16 @@ +{ + "tasks": { + "build": { + "command": "node build.mjs" + }, + "test": { + "command": "node test.mjs" + }, + "typecheck": { + "command": "node typecheck.mjs" + }, + "lint": { + "command": "node lint.mjs" + } + } +} diff --git a/playground/packages/lib/build.mjs b/playground/packages/lib/build.mjs new file mode 100644 index 00000000..9af60efc --- /dev/null +++ b/playground/packages/lib/build.mjs @@ -0,0 +1 @@ +console.log('Building lib'); diff --git a/playground/packages/lib/dev.mjs b/playground/packages/lib/dev.mjs new file mode 100644 index 00000000..8836ae3a --- /dev/null +++ b/playground/packages/lib/dev.mjs @@ -0,0 +1,6 @@ +process.on('SIGINT', () => { + console.log('lib: dev server stopped'); + process.exit(0); +}); + +setInterval(() => console.log('lib: waiting for changes...'), 2000); diff --git a/playground/packages/lib/lint.mjs b/playground/packages/lib/lint.mjs new file mode 100644 index 00000000..85e0d9d8 --- /dev/null +++ b/playground/packages/lib/lint.mjs @@ -0,0 +1 @@ +console.log('Linting lib'); diff --git a/playground/packages/lib/package.json b/playground/packages/lib/package.json new file mode 100644 index 00000000..fddb3aab --- /dev/null +++ b/playground/packages/lib/package.json @@ -0,0 +1,11 @@ +{ + "name": "@playground/lib", + "version": "0.0.0", + "private": true, + "scripts": { + "dev": "node dev.mjs" + }, + "dependencies": { + "@playground/utils": "workspace:*" + } +} diff --git a/playground/packages/lib/src/index.ts b/playground/packages/lib/src/index.ts new file mode 100644 index 00000000..f7fa1e13 --- /dev/null +++ b/playground/packages/lib/src/index.ts @@ -0,0 +1,5 @@ +import { add } from '@playground/utils'; + +export function sum(...nums: number[]): number { + return nums.reduce((acc, n) => add(acc, n), 0); +} diff --git a/playground/packages/lib/test.mjs b/playground/packages/lib/test.mjs new file mode 100644 index 00000000..6309a203 --- /dev/null +++ b/playground/packages/lib/test.mjs @@ -0,0 +1 @@ +console.log('Testing lib'); diff --git a/playground/packages/lib/typecheck.mjs b/playground/packages/lib/typecheck.mjs new file mode 100644 index 00000000..5f7e4b7d --- /dev/null +++ b/playground/packages/lib/typecheck.mjs @@ -0,0 +1 @@ +console.log('Typechecking lib'); diff --git a/playground/packages/lib/vite-task.json b/playground/packages/lib/vite-task.json new file mode 100644 index 00000000..58a9b2b4 --- /dev/null +++ b/playground/packages/lib/vite-task.json @@ -0,0 +1,16 @@ +{ + "tasks": { + "build": { + "command": "node build.mjs" + }, + "test": { + "command": "node test.mjs" + }, + "typecheck": { + "command": "node typecheck.mjs" + }, + "lint": { + "command": "node lint.mjs" + } + } +} diff --git a/playground/packages/utils/build.mjs b/playground/packages/utils/build.mjs new file mode 100644 index 00000000..f0cc45c7 --- /dev/null +++ b/playground/packages/utils/build.mjs @@ -0,0 +1 @@ +console.log('Building utils'); diff --git a/playground/packages/utils/lint.mjs b/playground/packages/utils/lint.mjs new file mode 100644 index 00000000..64299d21 --- /dev/null +++ b/playground/packages/utils/lint.mjs @@ -0,0 +1 @@ +console.log('Linting utils'); diff --git a/playground/packages/utils/package.json b/playground/packages/utils/package.json new file mode 100644 index 00000000..8036670a --- /dev/null +++ b/playground/packages/utils/package.json @@ -0,0 +1,5 @@ +{ + "name": "@playground/utils", + "version": "0.0.0", + "private": true +} diff --git a/playground/packages/utils/src/index.ts b/playground/packages/utils/src/index.ts new file mode 100644 index 00000000..8d9b8a22 --- /dev/null +++ b/playground/packages/utils/src/index.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number): number { + return a + b; +} diff --git a/playground/packages/utils/test.mjs b/playground/packages/utils/test.mjs new file mode 100644 index 00000000..2c833107 --- /dev/null +++ b/playground/packages/utils/test.mjs @@ -0,0 +1 @@ +console.log('Testing utils'); diff --git a/playground/packages/utils/vite-task.json b/playground/packages/utils/vite-task.json new file mode 100644 index 00000000..b86327b6 --- /dev/null +++ b/playground/packages/utils/vite-task.json @@ -0,0 +1,13 @@ +{ + "tasks": { + "build": { + "command": "node build.mjs" + }, + "test": { + "command": "node test.mjs" + }, + "lint": { + "command": "node lint.mjs" + } + } +} diff --git a/playground/pnpm-lock.yaml b/playground/pnpm-lock.yaml new file mode 100644 index 00000000..ef78a0a0 --- /dev/null +++ b/playground/pnpm-lock.yaml @@ -0,0 +1,23 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: {} + + packages/app: + dependencies: + '@playground/lib': + specifier: workspace:* + version: link:../lib + + packages/lib: + dependencies: + '@playground/utils': + specifier: workspace:* + version: link:../utils + + packages/utils: {} diff --git a/playground/pnpm-workspace.yaml b/playground/pnpm-workspace.yaml new file mode 100644 index 00000000..924b55f4 --- /dev/null +++ b/playground/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/playground/vite-task.json b/playground/vite-task.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/playground/vite-task.json @@ -0,0 +1 @@ +{} From b2bf3b9c09bc0c12caa11f22f2795bcdf08c13d7 Mon Sep 17 00:00:00 2001 From: branchseer Date: Tue, 31 Mar 2026 15:55:53 +0800 Subject: [PATCH 15/21] refactor: remove Session::envs_mut, create per-plan session in plan snapshot tests Each plan case now gets its own Session initialized with the correct env vars and cwd upfront, instead of mutating a shared session. Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/vite_task/src/session/mod.rs | 5 --- .../tests/plan_snapshots/main.rs | 33 ++++++++----------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/crates/vite_task/src/session/mod.rs b/crates/vite_task/src/session/mod.rs index e7b5fb10..eb1271d3 100644 --- a/crates/vite_task/src/session/mod.rs +++ b/crates/vite_task/src/session/mod.rs @@ -595,11 +595,6 @@ impl<'a> Session<'a> { &self.envs } - /// Mutably access the environment map, cloning the `Arc` if shared. - pub fn envs_mut(&mut self) -> &mut FxHashMap, Arc> { - Arc::make_mut(&mut self.envs) - } - pub const fn cwd(&self) -> &Arc { &self.cwd } diff --git a/crates/vite_task_plan/tests/plan_snapshots/main.rs b/crates/vite_task_plan/tests/plan_snapshots/main.rs index 4da61062..2fafc67a 100644 --- a/crates/vite_task_plan/tests/plan_snapshots/main.rs +++ b/crates/vite_task_plan/tests/plan_snapshots/main.rs @@ -187,7 +187,7 @@ fn run_case_inner( let workspace_root_str = workspace_root.path.as_path().to_str().unwrap(); let mut owned_config = vite_task_bin::OwnedSessionConfig::default(); let mut session = Session::init_with( - plan_envs, + plan_envs.clone(), Arc::clone(&workspace_root.path), owned_config.as_config(), ) @@ -250,20 +250,20 @@ fn run_case_inner( panic!("only `run` commands supported in plan tests") }; - // Inject per-case environment variables, removing them after the plan call. - let env_keys: Vec> = plan - .env - .iter() - .map(|(k, v)| { - let key = Arc::::from(OsStr::new(k.as_str())); - session.envs_mut().insert(Arc::clone(&key), Arc::from(OsStr::new(v.as_str()))); - key - }) - .collect(); + // Create a fresh session per plan case with case-specific env vars and cwd. + let mut case_envs = plan_envs.clone(); + for (k, v) in &plan.env { + case_envs + .insert(Arc::from(OsStr::new(k.as_str())), Arc::from(OsStr::new(v.as_str()))); + } + let case_cwd: Arc = workspace_root.path.join(plan.cwd).into(); + let mut case_owned_config = vite_task_bin::OwnedSessionConfig::default(); + let mut case_session = + Session::init_with(case_envs, Arc::clone(&case_cwd), case_owned_config.as_config()) + .unwrap(); + case_session.ensure_task_graph_loaded().await.unwrap(); - let plan_result = session - .plan_from_cli_run(workspace_root.path.join(plan.cwd).into(), run_command) - .await; + let plan_result = case_session.plan_from_cli_run(case_cwd, run_command).await; let plan = match plan_result { Ok(graph) => graph, @@ -297,11 +297,6 @@ fn run_case_inner( let plan_json = redact_snapshot(&plan, workspace_root_str); insta::assert_json_snapshot!(snapshot_name.as_str(), &plan_json); } - - // Clean up per-case environment variables. - for key in env_keys { - session.envs_mut().remove(&key); - } } }); } From c446d0ac891e8169a0da45e58c3bd4741fc4cf0a Mon Sep 17 00:00:00 2001 From: branchseer Date: Tue, 31 Mar 2026 16:54:19 +0800 Subject: [PATCH 16/21] feat: cancel future tasks and prevent caching on Ctrl-C MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce a separate `interrupt_token` (CancellationToken) that is cancelled by the Ctrl-C handler. Unlike the existing `fast_fail_token` (renamed from `cancellation_token`) which kills child processes on task failure, the interrupt token only prevents scheduling new tasks and caching results — running processes are left to handle SIGINT naturally from the OS. - Add `Cancelled` variant to `CacheNotUpdatedReason` - Add `ExecutionContext::cancelled()` helper that checks both tokens - Wire `ctrlc::set_handler` to cancel the interrupt token - Expand ctrl-c e2e fixture into a workspace to test both behaviors Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/vite_task/src/session/event.rs | 7 +++ crates/vite_task/src/session/execute/mod.rs | 61 +++++++++++++------ crates/vite_task/src/session/execute/spawn.rs | 8 +-- crates/vite_task/src/session/mod.rs | 22 ++++--- .../fixtures/ctrl-c/package.json | 3 +- .../fixtures/ctrl-c/packages/a/package.json | 6 ++ .../fixtures/ctrl-c/packages/b/package.json | 9 +++ .../fixtures/ctrl-c/pnpm-workspace.yaml | 2 + .../fixtures/ctrl-c/snapshots.toml | 45 +++++++++++++- .../snapshots/ctrl-c prevents caching.snap | 16 +++++ .../ctrl-c prevents future tasks.snap | 10 +++ ...l-c terminates running tasks (cached).snap | 6 +- .../ctrl-c terminates running tasks.snap | 6 +- .../fixtures/ctrl-c/vite-task.json | 12 +--- 14 files changed, 161 insertions(+), 52 deletions(-) create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/packages/a/package.json create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/packages/b/package.json create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/pnpm-workspace.yaml create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c prevents caching.snap create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c prevents future tasks.snap diff --git a/crates/vite_task/src/session/event.rs b/crates/vite_task/src/session/event.rs index a0ff4a3b..57aec779 100644 --- a/crates/vite_task/src/session/event.rs +++ b/crates/vite_task/src/session/event.rs @@ -59,6 +59,13 @@ pub enum CacheNotUpdatedReason { CacheDisabled, /// Execution exited with non-zero status NonZeroExitStatus, + /// Execution was cancelled before the result could be trusted. + /// Two possible causes: + /// - Ctrl-C: the user interrupted execution; the task may have + /// exited successfully but without completing its intended work. + /// - Fast-fail: a sibling task failed, triggering cancellation + /// while this task was still running. + Cancelled, /// Task modified files it read during execution (read-write overlap detected by fspy). /// Caching such tasks is unsound because the prerun input hashes become stale. InputModified { diff --git a/crates/vite_task/src/session/execute/mod.rs b/crates/vite_task/src/session/execute/mod.rs index 9f5877ed..9d5bf8e4 100644 --- a/crates/vite_task/src/session/execute/mod.rs +++ b/crates/vite_task/src/session/execute/mod.rs @@ -67,11 +67,23 @@ struct ExecutionContext<'a> { /// Base path for resolving relative paths in cache entries. /// Typically the workspace root. cache_base_path: &'a Arc, - /// Token for cancelling in-flight child processes. - cancellation_token: CancellationToken, + /// Token cancelled when a task fails. Kills in-flight child processes + /// (via `start_kill` in spawn.rs), prevents scheduling new tasks, and + /// prevents caching results of concurrently-running tasks. + fast_fail_token: CancellationToken, + /// Token cancelled by Ctrl-C. Unlike `fast_fail_token` (which kills + /// children), this only prevents scheduling new tasks and caching + /// results — running processes are left to handle SIGINT naturally. + interrupt_token: CancellationToken, } impl ExecutionContext<'_> { + /// Returns true if execution has been cancelled, either by a task + /// failure (fast-fail) or by Ctrl-C (interrupt). + fn cancelled(&self) -> bool { + self.fast_fail_token.is_cancelled() || self.interrupt_token.is_cancelled() + } + /// Execute all tasks in an execution graph concurrently, respecting dependencies. /// /// Uses a DAG scheduler: tasks whose dependencies have all completed are scheduled @@ -79,9 +91,10 @@ impl ExecutionContext<'_> { /// `concurrency_limit` permits. Each recursive `Expanded` graph creates its own /// semaphore, so nested graphs have independent concurrency limits. /// - /// Fast-fail: if any task fails, `execute_leaf` cancels the `CancellationToken` - /// (killing in-flight child processes). This method detects the cancellation, - /// closes the semaphore, drains remaining futures, and returns. + /// Fast-fail: if any task fails, `execute_leaf` cancels the `fast_fail_token` + /// (killing in-flight child processes). Ctrl-C cancels the `interrupt_token`. + /// Either cancellation causes this method to close the semaphore, drain + /// remaining futures, and return. #[tracing::instrument(level = "debug", skip_all)] async fn execute_expanded_graph(&self, graph: &ExecutionGraph) { if graph.graph.node_count() == 0 { @@ -111,7 +124,7 @@ impl ExecutionContext<'_> { // On failure, `execute_leaf` cancels the token — we detect it here, close // the semaphore (so pending acquires fail immediately), and drain. while let Some(completed_ix) = futures.next().await { - if self.cancellation_token.is_cancelled() { + if self.cancelled() { semaphore.close(); while futures.next().await.is_some() {} return; @@ -132,7 +145,7 @@ impl ExecutionContext<'_> { /// Create a future that acquires a semaphore permit, then executes a graph node. /// - /// On failure, `execute_node` cancels the `CancellationToken` — the caller + /// On failure, `execute_node` cancels the `fast_fail_token` — the caller /// detects this after the future completes. On semaphore closure or prior /// cancellation, the node is skipped. fn spawn_node<'a>( @@ -144,7 +157,7 @@ impl ExecutionContext<'_> { let sem = semaphore.clone(); async move { if let Ok(_permit) = sem.acquire_owned().await - && !self.cancellation_token.is_cancelled() + && !self.cancelled() { self.execute_node(graph, node_ix).await; } @@ -156,13 +169,13 @@ impl ExecutionContext<'_> { /// Execute a single node's items sequentially. /// /// A node may have multiple items (from `&&`-split commands). Items are executed - /// in order; if any item fails, `execute_leaf` cancels the `CancellationToken` + /// in order; if any item fails, `execute_leaf` cancels the `fast_fail_token` /// and remaining items are skipped (preserving `&&` semantics). async fn execute_node(&self, graph: &ExecutionGraph, node_ix: ExecutionNodeIndex) { let task_execution = &graph.graph[node_ix]; for item in &task_execution.items { - if self.cancellation_token.is_cancelled() { + if self.cancelled() { return; } match &item.kind { @@ -180,7 +193,7 @@ impl ExecutionContext<'_> { /// /// Creates a [`LeafExecutionReporter`] from the graph reporter and delegates /// to the appropriate execution method. On failure (non-zero exit or - /// infrastructure error), cancels the `CancellationToken`. + /// infrastructure error), cancels the `fast_fail_token`. #[tracing::instrument(level = "debug", skip_all)] async fn execute_leaf(&self, display: &ExecutionItemDisplay, leaf_kind: &LeafExecutionKind) { // Borrow the reporter briefly to create the leaf reporter, then drop @@ -215,7 +228,8 @@ impl ExecutionContext<'_> { spawn_execution, self.cache, self.cache_base_path, - self.cancellation_token.clone(), + self.fast_fail_token.clone(), + self.interrupt_token.clone(), ) .await; match outcome { @@ -226,7 +240,7 @@ impl ExecutionContext<'_> { } }; if failed { - self.cancellation_token.cancel(); + self.fast_fail_token.cancel(); } } } @@ -255,7 +269,8 @@ pub async fn execute_spawn( spawn_execution: &SpawnExecution, cache: &ExecutionCache, cache_base_path: &Arc, - cancellation_token: CancellationToken, + fast_fail_token: CancellationToken, + interrupt_token: CancellationToken, ) -> SpawnOutcome { let cache_metadata = spawn_execution.cache_metadata.as_ref(); @@ -348,7 +363,7 @@ pub async fn execute_spawn( // while the child also writes to the same FD. drop(stdio_config); - match spawn_inherited(&spawn_execution.spawn_command, cancellation_token).await { + match spawn_inherited(&spawn_execution.spawn_command, fast_fail_token).await { Ok(result) => { leaf_reporter.finish( Some(result.exit_status), @@ -419,7 +434,7 @@ pub async fn execute_spawn( std_outputs.as_mut(), path_accesses.as_mut(), &resolved_negatives, - cancellation_token, + fast_fail_token.clone(), ) .await { @@ -439,7 +454,11 @@ pub async fn execute_spawn( let (cache_update_status, cache_error) = if let Some((cache_metadata, globbed_inputs)) = cache_metadata_and_inputs { - if result.exit_status.success() { + let cancelled = fast_fail_token.is_cancelled() || interrupt_token.is_cancelled(); + if cancelled { + // Cancelled (Ctrl-C or sibling failure) — result is untrustworthy + (CacheUpdateStatus::NotUpdated(CacheNotUpdatedReason::Cancelled), None) + } else if result.exit_status.success() { // Check for read-write overlap: if the task wrote to any file it also // read, the inputs were modified during execution — don't cache. // Note: this only checks fspy-inferred reads, not globbed_inputs keys. @@ -519,7 +538,7 @@ pub async fn execute_spawn( #[tracing::instrument(level = "debug", skip_all)] async fn spawn_inherited( spawn_command: &SpawnCommand, - cancellation_token: CancellationToken, + fast_fail_token: CancellationToken, ) -> anyhow::Result { let mut cmd = fspy::Command::new(spawn_command.program_path.as_path()); cmd.args(spawn_command.args.iter().map(vite_str::Str::as_str)); @@ -579,7 +598,7 @@ async fn spawn_inherited( let exit_status = tokio::select! { status = child.wait() => status?, - () = cancellation_token.cancelled() => { + () = fast_fail_token.cancelled() => { child.start_kill()?; child.wait().await? } @@ -694,6 +713,7 @@ impl Session<'_> { &self, execution_graph: ExecutionGraph, builder: Box, + interrupt_token: CancellationToken, ) -> Result<(), ExitStatus> { // Initialize cache before building the reporter. Cache errors are reported // directly to stderr and cause an early exit, keeping the reporter flow clean @@ -713,7 +733,8 @@ impl Session<'_> { reporter: &reporter, cache, cache_base_path: &self.workspace_path, - cancellation_token: CancellationToken::new(), + fast_fail_token: CancellationToken::new(), + interrupt_token, }; // Execute the graph with fast-fail: if any task fails, remaining tasks diff --git a/crates/vite_task/src/session/execute/spawn.rs b/crates/vite_task/src/session/execute/spawn.rs index 03a055bb..6a3b7842 100644 --- a/crates/vite_task/src/session/execute/spawn.rs +++ b/crates/vite_task/src/session/execute/spawn.rs @@ -92,7 +92,7 @@ pub async fn spawn_with_tracking( std_outputs: Option<&mut Vec>, path_accesses: Option<&mut TrackedPathAccesses>, resolved_negatives: &[wax::Glob<'static>], - cancellation_token: CancellationToken, + fast_fail_token: CancellationToken, ) -> anyhow::Result { let mut cmd = fspy::Command::new(spawn_command.program_path.as_path()); cmd.args(spawn_command.args.iter().map(vite_str::Str::as_str)); @@ -108,7 +108,7 @@ pub async fn spawn_with_tracking( let (mut child_stdout, mut child_stderr, mut child_wait) = if path_accesses.is_some() { // fspy tracking enabled — fspy manages cancellation internally via a clone // of the token. We keep the original for the pipe read loop. - let mut tracked_child = cmd.spawn(cancellation_token.clone()).await?; + let mut tracked_child = cmd.spawn(fast_fail_token.clone()).await?; let stdout = tracked_child.stdout.take().unwrap(); let stderr = tracked_child.stderr.take().unwrap(); #[cfg(windows)] @@ -193,7 +193,7 @@ pub async fn spawn_with_tracking( } } } - () = cancellation_token.cancelled() => { + () = fast_fail_token.cancelled() => { // Kill the direct child (no-op for fspy which handles it internally). if let ChildWait::Tokio(ref mut child) = child_wait { let _ = child.start_kill(); @@ -291,7 +291,7 @@ pub async fn spawn_with_tracking( ChildWait::Tokio(mut child) => { let exit_status = tokio::select! { status = child.wait() => status?, - () = cancellation_token.cancelled() => { + () = fast_fail_token.cancelled() => { child.start_kill()?; child.wait().await? } diff --git a/crates/vite_task/src/session/mod.rs b/crates/vite_task/src/session/mod.rs index eb1271d3..62257f6a 100644 --- a/crates/vite_task/src/session/mod.rs +++ b/crates/vite_task/src/session/mod.rs @@ -331,14 +331,19 @@ impl<'a> Session<'a> { Some(self.make_summary_writer()), self.program_name.clone(), )); - // Ignore SIGINT/CTRL_C before executing tasks. Child tasks - // receive the signal directly from the terminal driver and handle - // it themselves. This lets the runner wait for tasks to exit and - // report their actual exit status rather than being killed - // mid-flight. - let _ = ctrlc::set_handler(|| {}); - - self.execute_graph(graph, builder).await.map_err(SessionError::EarlyExit) + // Don't let SIGINT/CTRL_C kill the runner. Child tasks receive + // the signal directly from the terminal driver and handle it + // themselves. Cancelling the interrupt token prevents scheduling + // new tasks and caching results of in-flight tasks. + let interrupt_token = tokio_util::sync::CancellationToken::new(); + let ct = interrupt_token.clone(); + let _ = ctrlc::set_handler(move || { + ct.cancel(); + }); + + self.execute_graph(graph, builder, interrupt_token) + .await + .map_err(SessionError::EarlyExit) } } } @@ -648,6 +653,7 @@ impl<'a> Session<'a> { cache, &self.workspace_path, tokio_util::sync::CancellationToken::new(), + tokio_util::sync::CancellationToken::new(), ) .await; match outcome { diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/package.json b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/package.json index f444dee5..a9a08d6f 100644 --- a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/package.json +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/package.json @@ -1,3 +1,4 @@ { - "name": "ctrl-c-test" + "name": "ctrl-c-test", + "private": true } diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/packages/a/package.json b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/packages/a/package.json new file mode 100644 index 00000000..afec67f2 --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/packages/a/package.json @@ -0,0 +1,6 @@ +{ + "name": "@ctrl-c/a", + "scripts": { + "dev": "vtt exit-on-ctrlc" + } +} diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/packages/b/package.json b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/packages/b/package.json new file mode 100644 index 00000000..3d0a9d82 --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/packages/b/package.json @@ -0,0 +1,9 @@ +{ + "name": "@ctrl-c/b", + "scripts": { + "dev": "vtt print b-ran" + }, + "dependencies": { + "@ctrl-c/a": "workspace:*" + } +} diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/pnpm-workspace.yaml b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/pnpm-workspace.yaml new file mode 100644 index 00000000..924b55f4 --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots.toml b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots.toml index ec1817db..7c41735c 100644 --- a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots.toml +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots.toml @@ -6,7 +6,8 @@ steps = [ { argv = [ "vt", "run", - "dev", + "--no-cache", + "@ctrl-c/a#dev", ], interactions = [ { "expect-milestone" = "ready" }, { "write-key" = "ctrl-c" }, @@ -19,9 +20,49 @@ steps = [ { argv = [ "vt", "run", - "dev-cached", + "@ctrl-c/a#dev", ], interactions = [ { "expect-milestone" = "ready" }, { "write-key" = "ctrl-c" }, ] }, ] + +# Package b depends on a, so without --parallel they run sequentially. +# After Ctrl-C terminates a, b should not be scheduled. +[[e2e]] +name = "ctrl-c prevents future tasks" +steps = [ + { argv = [ + "vt", + "run", + "-r", + "--no-cache", + "dev", + ], interactions = [ + { "expect-milestone" = "ready" }, + { "write-key" = "ctrl-c" }, + ] }, +] + +# dev exits 0 after Ctrl-C but the result should not be cached. +# The second run should be a cache miss, not a hit. +[[e2e]] +name = "ctrl-c prevents caching" +steps = [ + { argv = [ + "vt", + "run", + "@ctrl-c/a#dev", + ], interactions = [ + { "expect-milestone" = "ready" }, + { "write-key" = "ctrl-c" }, + ], comment = "exits 0 but should not be cached" }, + { argv = [ + "vt", + "run", + "@ctrl-c/a#dev", + ], interactions = [ + { "expect-milestone" = "ready" }, + { "write-key" = "ctrl-c" }, + ], comment = "should be cache miss, not hit" }, +] diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c prevents caching.snap b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c prevents caching.snap new file mode 100644 index 00000000..9f201464 --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c prevents caching.snap @@ -0,0 +1,16 @@ +--- +source: crates/vite_task_bin/tests/e2e_snapshots/main.rs +expression: e2e_outputs +--- +> vt run @ctrl-c/a#dev # exits 0 but should not be cached +@ expect-milestone: ready +~/packages/a$ vtt exit-on-ctrlc +@ write-key: ctrl-c +~/packages/a$ vtt exit-on-ctrlc +ctrl-c received +> vt run @ctrl-c/a#dev # should be cache miss, not hit +@ expect-milestone: ready +~/packages/a$ vtt exit-on-ctrlc +@ write-key: ctrl-c +~/packages/a$ vtt exit-on-ctrlc +ctrl-c received diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c prevents future tasks.snap b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c prevents future tasks.snap new file mode 100644 index 00000000..d3ba5c9a --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c prevents future tasks.snap @@ -0,0 +1,10 @@ +--- +source: crates/vite_task_bin/tests/e2e_snapshots/main.rs +expression: e2e_outputs +--- +> vt run -r --no-cache dev +@ expect-milestone: ready +~/packages/a$ vtt exit-on-ctrlc ⊘ cache disabled +@ write-key: ctrl-c +~/packages/a$ vtt exit-on-ctrlc ⊘ cache disabled +ctrl-c received diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c terminates running tasks (cached).snap b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c terminates running tasks (cached).snap index 8673a01f..6f0bca35 100644 --- a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c terminates running tasks (cached).snap +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c terminates running tasks (cached).snap @@ -2,9 +2,9 @@ source: crates/vite_task_bin/tests/e2e_snapshots/main.rs expression: e2e_outputs --- -> vt run dev-cached +> vt run @ctrl-c/a#dev @ expect-milestone: ready -$ vtt exit-on-ctrlc +~/packages/a$ vtt exit-on-ctrlc @ write-key: ctrl-c -$ vtt exit-on-ctrlc +~/packages/a$ vtt exit-on-ctrlc ctrl-c received diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c terminates running tasks.snap b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c terminates running tasks.snap index b19a6308..a29e7572 100644 --- a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c terminates running tasks.snap +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c terminates running tasks.snap @@ -2,9 +2,9 @@ source: crates/vite_task_bin/tests/e2e_snapshots/main.rs expression: e2e_outputs --- -> vt run dev +> vt run --no-cache @ctrl-c/a#dev @ expect-milestone: ready -$ vtt exit-on-ctrlc ⊘ cache disabled +~/packages/a$ vtt exit-on-ctrlc ⊘ cache disabled @ write-key: ctrl-c -$ vtt exit-on-ctrlc ⊘ cache disabled +~/packages/a$ vtt exit-on-ctrlc ⊘ cache disabled ctrl-c received diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/vite-task.json b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/vite-task.json index ed631d53..d548edfa 100644 --- a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/vite-task.json +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/vite-task.json @@ -1,13 +1,3 @@ { - "cache": true, - "tasks": { - "dev": { - "command": "vtt exit-on-ctrlc", - "cache": false - }, - "dev-cached": { - "command": "vtt exit-on-ctrlc", - "cache": true - } - } + "cache": true } From b80acb9b548031a39ed1770509dec623fee631a5 Mon Sep 17 00:00:00 2001 From: branchseer Date: Tue, 31 Mar 2026 16:58:56 +0800 Subject: [PATCH 17/21] fix: propagate ctrlc::set_handler error instead of ignoring it Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/vite_task/src/session/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/vite_task/src/session/mod.rs b/crates/vite_task/src/session/mod.rs index 62257f6a..d3d31156 100644 --- a/crates/vite_task/src/session/mod.rs +++ b/crates/vite_task/src/session/mod.rs @@ -337,9 +337,9 @@ impl<'a> Session<'a> { // new tasks and caching results of in-flight tasks. let interrupt_token = tokio_util::sync::CancellationToken::new(); let ct = interrupt_token.clone(); - let _ = ctrlc::set_handler(move || { + ctrlc::set_handler(move || { ct.cancel(); - }); + })?; self.execute_graph(graph, builder, interrupt_token) .await From 7327fcf9c6fc260275f8996b5a6b4bfefd99cb40 Mon Sep 17 00:00:00 2001 From: branchseer Date: Tue, 31 Mar 2026 17:00:55 +0800 Subject: [PATCH 18/21] fix(windows): clear inherited CTRL_C ignore flag before setting handler On Windows, an ancestor process created with CREATE_NEW_PROCESS_GROUP sets a per-process flag (CONSOLE_IGNORE_CTRL_C) that silently drops CTRL_C_EVENT before it reaches registered handlers. Clear this flag so the interrupt_token handler fires when Ctrl-C is pressed. Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/vite_task/src/session/mod.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/crates/vite_task/src/session/mod.rs b/crates/vite_task/src/session/mod.rs index d3d31156..4a2002ab 100644 --- a/crates/vite_task/src/session/mod.rs +++ b/crates/vite_task/src/session/mod.rs @@ -335,6 +335,25 @@ impl<'a> Session<'a> { // the signal directly from the terminal driver and handle it // themselves. Cancelling the interrupt token prevents scheduling // new tasks and caching results of in-flight tasks. + // + // On Windows, an ancestor process (e.g. cargo) may have been + // created with CREATE_NEW_PROCESS_GROUP, which sets a per-process + // flag that silently drops CTRL_C_EVENT before it reaches + // registered handlers. Clear it so our handler fires. + #[cfg(windows)] + { + // SAFETY: Passing (None, FALSE) clears the inherited + // CTRL_C ignore flag. + unsafe extern "system" { + fn SetConsoleCtrlHandler( + handler: Option i32>, + add: i32, + ) -> i32; + } + unsafe { + SetConsoleCtrlHandler(None, 0); + } + } let interrupt_token = tokio_util::sync::CancellationToken::new(); let ct = interrupt_token.clone(); ctrlc::set_handler(move || { From 9ed6a49d809206f14d2e7ec0123d6b601227c3fb Mon Sep 17 00:00:00 2001 From: branchseer Date: Tue, 31 Mar 2026 17:20:18 +0800 Subject: [PATCH 19/21] docs: add cancellation docs and changelog entry for Ctrl-C handling Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 1 + docs/cancellation.md | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 docs/cancellation.md diff --git a/CHANGELOG.md b/CHANGELOG.md index c65bda3d..f2aac7ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Changelog +- **Fixed** Ctrl-C now prevents future tasks from being scheduled and prevents caching of in-flight task results ([#309](https://github.com/voidzero-dev/vite-task/pull/309)) - **Added** `--concurrency-limit` flag to limit the number of tasks running at the same time (defaults to 4) ([#288](https://github.com/voidzero-dev/vite-task/pull/288), [#309](https://github.com/voidzero-dev/vite-task/pull/309)) - **Added** `--parallel` flag to ignore task dependencies and run all tasks at once with unlimited concurrency (unless `--concurrency-limit` is also specified) ([#309](https://github.com/voidzero-dev/vite-task/pull/309)) - **Added** object form for `input` entries: `{ "pattern": "...", "base": "workspace" | "package" }` to resolve glob patterns relative to the workspace root instead of the package directory ([#295](https://github.com/voidzero-dev/vite-task/pull/295)) diff --git a/docs/cancellation.md b/docs/cancellation.md new file mode 100644 index 00000000..30d4b104 --- /dev/null +++ b/docs/cancellation.md @@ -0,0 +1,23 @@ +# Cancellation + +`vp run` handles two kinds of cancellation: **Ctrl-C** (user interrupt) and **fast-fail** (a task exits with non-zero status). Both prevent new tasks from being scheduled and prevent caching of in-flight results, but they differ in how they treat running processes. + +## Ctrl-C + +When the user presses Ctrl-C: + +1. The OS delivers SIGINT (Unix) or CTRL_C_EVENT (Windows) directly to all processes in the terminal's foreground process group — both the runner and child tasks. This is standard OS behavior, not something `vp run` implements. +2. No new tasks are scheduled after the signal. +3. Results of in-flight tasks are **not cached**, even if a task handles the signal gracefully and exits 0. The output may be incomplete, so caching it would risk false cache hits on subsequent runs. + +## Fast-fail + +When any task exits with non-zero status: + +1. All other running child processes are killed immediately (`SIGKILL` on Unix, `TerminateJobObject` on Windows). +2. No new tasks are scheduled. +3. Results of other in-flight tasks are **not cached** (they were killed mid-execution). + +## Why interrupted tasks are not cached + +A task that receives Ctrl-C might exit 0 after partial work (e.g., a build tool that flushes what it has so far). Caching this result would mean the next `vp run` replays incomplete output and skips the real execution. By never caching interrupted results, `vp run` guarantees that the next run starts fresh. From 9fda35cccd031e476543d7e180bcab5d01bc5991 Mon Sep 17 00:00:00 2001 From: branchseer Date: Tue, 31 Mar 2026 17:29:15 +0800 Subject: [PATCH 20/21] docs: fix playground README command reference Co-Authored-By: Claude Opus 4.6 (1M context) --- playground/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playground/README.md b/playground/README.md index d7072864..863dce49 100644 --- a/playground/README.md +++ b/playground/README.md @@ -1,6 +1,6 @@ # Playground -A workspace for manually testing `vp run` (the task runner). +A workspace for manually testing `cargo run --bin vt run ...`. ## Structure From bf2ea55be5292ef41dd689034a978b026ee99a63 Mon Sep 17 00:00:00 2001 From: branchseer Date: Tue, 31 Mar 2026 17:31:37 +0800 Subject: [PATCH 21/21] docs: group test-related sections under Testing in CONTRIBUTING.md Co-Authored-By: Claude Opus 4.6 (1M context) --- CONTRIBUTING.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b847cb9d..db3ceab3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,7 +36,9 @@ just lint # Clippy linting just doc # Generate documentation ``` -### Running Specific Tests +## Testing + +### Running Tests ```bash cargo test # All tests @@ -55,6 +57,17 @@ Integration tests (e2e, plan, fspy) require `pnpm install` in `packages/tools` f See individual crate READMEs for crate-specific testing details. +### Playground + +The `playground/` directory is a small workspace for manually testing the task runner. It has three packages (`app → lib → utils`) with cached tasks (`build`, `test`, `lint`, `typecheck`) and an uncached `dev` script. + +```bash +cargo run --bin vt -- run -r build # run build across all packages +cargo run --bin vt -- run -r --parallel dev # start all dev scripts in parallel +``` + +See `playground/README.md` for the full task list and dependency structure. + ## Cross-Platform Development This project must work on macOS, Linux, and Windows. Skipping tests on any platform is not acceptable.