Skip to content

Commit b5bbfdb

Browse files
branchseerclaude
andcommitted
docs: document self-containment invariant on TaskQuery
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a64f39c commit b5bbfdb

File tree

1 file changed

+13
-0
lines changed
  • crates/vite_task_graph/src/query

1 file changed

+13
-0
lines changed

crates/vite_task_graph/src/query/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ use crate::{IndexedTaskGraph, TaskDependencyType, TaskId, TaskNodeIndex};
3131
pub type TaskExecutionGraph = DiGraphMap<TaskNodeIndex, ()>;
3232

3333
/// A query for which tasks to run.
34+
///
35+
/// A `TaskQuery` must be **self-contained**: it fully describes which tasks
36+
/// will be selected, without relying on ambient state such as cwd or
37+
/// environment variables. For example, the implicit cwd is captured as a
38+
/// `ContainingPackage(path)` selector inside [`PackageQuery`], so two
39+
/// queries from different directories compare as unequal even though the
40+
/// user typed the same CLI arguments.
41+
///
42+
/// This property is essential for the **skip rule** in task planning, which
43+
/// compares the nested query against the parent query with `==`. If any
44+
/// external context leaked into the comparison (or was excluded from it),
45+
/// the skip rule would either miss legitimate recursion or incorrectly
46+
/// suppress distinct expansions.
3447
#[derive(Debug, PartialEq)]
3548
pub struct TaskQuery {
3649
/// Which packages to select.

0 commit comments

Comments
 (0)