Skip to content

feat: implement unconditional cycle detection in workflow validation#811

Open
hanorik wants to merge 1 commit into
google:wolo/workflowsfrom
hanorik:validate_cycle
Open

feat: implement unconditional cycle detection in workflow validation#811
hanorik wants to merge 1 commit into
google:wolo/workflowsfrom
hanorik:validate_cycle

Conversation

@hanorik
Copy link
Copy Markdown
Contributor

@hanorik hanorik commented May 8, 2026

This PR introduces validation to detect unconditional cycles in the workflow graph. Cycles that consist entirely of edges without routing conditions (where edge.Route == nil) are now detected and reported as errors, while conditional cycles are permitted.

Key Changes:

  • Unconditional Cycle Detection: Implemented validateCycles in validation.go using a Depth-First Search (DFS) algorithm that tracks the current path (stack) to identify cycles, specifically ignoring edges with non-nil routes.
  • Unit Tests: Added TestValidateCycles in validation_test.go to verify behavior with no cycles, only conditional cycles, and mixed cycles.

@hanorik hanorik requested review from anFatum and wolo-lab May 8, 2026 12:46
@hanorik hanorik changed the title refactor: implement unconditional cycle detection in workflow validation feat: implement unconditional cycle detection in workflow validation May 11, 2026
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