Commit d47a293
authored
refactor: replace ExecutionGraph with generic AcyclicGraph and show full cycle path in errors (#158)
## Summary
- Refactors `ExecutionGraph` into a generic `AcyclicGraph<N, Ix>` with
`ExecutionGraph` kept as a type alias for backward compatibility
- Removes precomputed topological order from the graph struct; computes
it on-the-fly via `compute_topological_order()`
- Replaces `petgraph::algo::toposort`-based cycle detection with DFS +
predecessor tracking that reconstructs the **full cycle path**
- Cycle errors now display all participating tasks as an arrow chain
(e.g. `Cycle dependency detected: pkg#task-a -> pkg#task-b ->
pkg#task-a`) instead of just one task
- Correctly handles graphs with multiple disconnected components
- Adds 14 unit tests for `AcyclicGraph` covering DAGs, cycles,
self-loops, and multi-component graphs1 parent 3a631c8 commit d47a293
File tree
7 files changed
+439
-81
lines changed- crates
- vite_task_bin/tests/e2e_snapshots/fixtures/error_cycle_dependency/snapshots
- vite_task_plan
- src
- tests/plan_snapshots/fixtures/cycle-dependency/snapshots
- vite_task/src/session/execute
7 files changed
+439
-81
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
| 59 | + | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
0 commit comments