Skip to content

Commit aa59d25

Browse files
branchseerclaude
andcommitted
refactor: rename Rule 1/Rule 2 to skip rule/prune rule
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b577d27 commit aa59d25

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

crates/vite_task_plan/src/plan.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ async fn plan_task_as_execution_node(
200200
let execution_item_kind: ExecutionItemKind = match plan_request {
201201
// Expand task query like `vp run -r build`
202202
Some(PlanRequest::Query(query_plan_request)) => {
203-
// Rule 1: skip if this nested query is the same as the parent expansion.
203+
// Skip rule: skip if this nested query is the same as the parent expansion.
204204
// This handles workspace root tasks like `"build": "vp run -r build"` —
205205
// re-entering the same query would just re-expand the same tasks.
206206
if query_plan_request.query == *context.parent_query() {
@@ -566,7 +566,7 @@ fn plan_spawn_execution(
566566
/// Builds a `DiGraph` of task executions, then validates it is acyclic via
567567
/// `ExecutionGraph::try_from_graph`. Returns `CycleDependencyDetected` if a cycle is found.
568568
///
569-
/// **Rule 2 (prune self):** If the expanding task (the task whose command triggered
569+
/// **Prune rule:** If the expanding task (the task whose command triggered
570570
/// this nested query) appears in the expansion result, it is pruned from the graph
571571
/// and its predecessors are wired directly to its successors. This prevents
572572
/// workspace root tasks like `"build": "vp run build"` from infinitely re-expanding
@@ -609,7 +609,7 @@ pub async fn plan_query_request(
609609

610610
let task_node_index_graph = task_query_result.execution_graph;
611611

612-
// Rule 2: if the expanding task appears in the expansion, prune it.
612+
// Prune rule: if the expanding task appears in the expansion, prune it.
613613
// This handles cases like root `"build": "vp run build"` — the root's build
614614
// task is in the result but expanding it would recurse, so we remove it and
615615
// reconnect its predecessors directly to its successors.

crates/vite_task_plan/tests/plan_snapshots/fixtures/workspace-root-depends-on-passthrough/snapshots.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Tests that dependsOn works through a passthrough root task.
22
# Root build = "vp run -r build", with dependsOn: ["lint"].
3-
# Rule 1 skips the recursive part, but the dependsOn lint tasks still run.
3+
# The skip rule skips the recursive part, but the dependsOn lint tasks still run.
44

55
[[plan]]
66
name = "depends on through passthrough"

crates/vite_task_plan/tests/plan_snapshots/fixtures/workspace-root-multi-command/snapshots.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Tests multi-command with self-referencing: root build = "echo pre && vp run -r build"
2-
# Rule 1 skips the recursive `vp run -r build` part, echo pre still runs.
2+
# The skip rule skips the recursive `vp run -r build` part, echo pre still runs.
33

44
[[plan]]
55
name = "multi command skips recursive part"

crates/vite_task_plan/tests/plan_snapshots/fixtures/workspace-root-self-reference/snapshots.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Tests workspace root self-reference handling (Rule 1 and Rule 2)
1+
# Tests workspace root self-reference handling (skip rule and prune rule)
22

3-
# Rule 1: root's build command is `vp run -r build`, which is the same query
3+
# Skip rule: root's build command is `vp run -r build`, which is the same query
44
# as the top-level `vp run -r build`. The nested `vp run -r build` is skipped,
55
# so root#build becomes a passthrough (no items expand). Siblings a and b run.
66
[[plan]]
77
name = "recursive build skips self"
88
args = ["run", "-r", "build"]
99
compact = true
1010

11-
# Rule 2: root's build command is `vp run -r build`, but top-level query is
11+
# Prune rule: root's build command is `vp run -r build`, but top-level query is
1212
# `vp run build` (current package = root, no -r). The nested query differs
1313
# (All vs ContainingPackage), so it expands. Root appears in the expansion
1414
# result and is pruned — only a and b remain in the nested graph.

0 commit comments

Comments
 (0)