Skip to content

feat: implement workflow connectivity validation to ensure all nodes are reachable from start#809

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

feat: implement workflow connectivity validation to ensure all nodes are reachable from start#809
hanorik wants to merge 1 commit into
google:wolo/workflowsfrom
hanorik:connect_validator

Conversation

@hanorik
Copy link
Copy Markdown
Contributor

@hanorik hanorik commented May 8, 2026

This PR introduces validation to ensure that all nodes in a workflow graph are reachable from the Start node. This prevents orphaned nodes that can never be executed, ensuring the graph is fully connected and valid.

Key Changes:

  • validation.go: Added logic to traverse the workflow graph and verify that every registered node has at least one path leading to it from the start.
  • workflow.go: Integrated the connectivity check into the workflow initialization/validation process.
  • Tests: Added unit tests in validation_test.go to cover valid connected graphs and invalid disconnected graphs.

@hanorik hanorik requested review from anFatum and wolo-lab May 8, 2026 11:09
@hanorik hanorik force-pushed the connect_validator branch 2 times, most recently from 839de78 to 26d4538 Compare May 8, 2026 11:36
Comment thread workflow/validation.go Outdated
@hanorik hanorik force-pushed the connect_validator branch from 26d4538 to 5c985c8 Compare May 11, 2026 13:16
@hanorik hanorik requested a review from wolo-lab May 11, 2026 13:17
@hanorik hanorik force-pushed the connect_validator branch from 5c985c8 to c50c144 Compare May 11, 2026 17:45
Copy link
Copy Markdown

@wolo-lab wolo-lab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be careful while merging with 808

Comment thread workflow/validation.go
slices.Sort(unreachable)

if len(unreachable) > 0 {
return fmt.Errorf("%w: %s", ErrNodesNotReachable, strings.Join(unreachable, ", "))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%q instead of %s

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.

2 participants