fix(compose): validate indirect edges in Workflow compile - #1268
Open
JopenChen wants to merge 1 commit into
Open
fix(compose): validate indirect edges in Workflow compile#1268JopenChen wants to merge 1 commit into
JopenChen wants to merge 1 commit into
Conversation
Add validation for noDirectDependency (indirect) edges during Workflow compilation. Previously, edges created via WithNoDirectDependency() were not checked to ensure an execution path exists from the source node to the target node through direct control edges. Changes: - Add validateIndirectEdges() to verify every indirect edge has a valid execution path via BFS reachability check - Add buildControlAdjacency() to build adjacency from graph control edges and branch edges (handles cases where branchDependency and noDirectDependency coexist on the same node pair) - Add isReachable() helper for BFS reachability - Return clear error messages for illegal indirect edge configurations - Add comprehensive tests covering illegal and valid scenarios Fixes the TODO at compose/workflow.go:509
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
fix
Check the PR title.
(Optional) Translate the PR title into Chinese.
fix(compose): 在 Workflow 编译时校验间接边的合法性
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
Add validation for noDirectDependency (indirect) edges during Workflow compilation.
There was a TODO at compose/workflow.go:509: "check indirect edges are legal". Edges created via WithNoDirectDependency() only establish data mappings without direct execution dependencies. Without validation, an illegal graph where no execution path exists from source to target could compile successfully and cause undefined behavior at runtime.
Changes:
zh(optional):
在 Workflow 编译阶段增加对间接边(noDirectDependency)的合法性校验。
compose/workflow.go:509 处原有 TODO 标注 "check indirect edges are legal"。通过 WithNoDirectDependency() 创建的边仅建立数据映射而无直接执行依赖。若不校验,源节点到目标节点不存在执行路径的非法图也能编译通过,运行时产生不可预期行为。
主要改动:
(Optional) Which issue(s) this PR fixes:
N/A (resolves internal TODO)
(optional) The PR that updates user documentation:
N/A