Skip to content

refactor: replace ExecutionGraph with generic AcyclicGraph and show full cycle path in errors#158

Merged
branchseer merged 2 commits intomainfrom
refactor/acyclic-graph-cycle-detection
Feb 15, 2026
Merged

refactor: replace ExecutionGraph with generic AcyclicGraph and show full cycle path in errors#158
branchseer merged 2 commits intomainfrom
refactor/acyclic-graph-cycle-detection

Conversation

@branchseer
Copy link
Copy Markdown
Member

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 graphs

…ull cycle path in errors

- Rename ExecutionGraph to generic AcyclicGraph<N, Ix> with ExecutionGraph as a type alias
- Remove precomputed topological order; compute on-the-fly via compute_topological_order()
- Use DFS with predecessor tracking to detect cycles and reconstruct the full cycle path
- Display all tasks in cycle errors as arrow chain (e.g. pkg#a -> pkg#b -> pkg#a)
- Handle graphs with multiple disconnected components correctly
- Add 14 unit tests covering DAGs, cycles, self-loops, and multi-component graphs
@branchseer branchseer merged commit d47a293 into main Feb 15, 2026
6 checks passed
@branchseer branchseer deleted the refactor/acyclic-graph-cycle-detection branch February 15, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant