fix: argo workflows conditional nested static split joins#3002
fix: argo workflows conditional nested static split joins#3002
Conversation
Greptile SummaryThis PR adds special-case dependency-string generation for Argo Workflows DAG tasks where a static-split Key changes and observations:
Confidence Score: 2/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
start --> switch_step
switch_step -->|route == a| branch_a
switch_step -->|route == b| branch_b
branch_a -->|static split| sub_a
branch_a -->|static split| sub_b
sub_a --> sub_join["sub_join (join)"]
sub_b --> sub_join
sub_join --> shared["shared (conditional join)"]
branch_b --> shared
shared --> end_step[end]
subgraph "New depends generation for sub_join"
NB1["1. Detect: node.type==join AND any in_func is conditional"]
NB2["2. Build node_groups by split_branches[-1]\n{branch_a: [sub_a, sub_b]}"]
NB3["3. _split_switch_ancestors(fn, split_parents[-1])\ncollects any split-switch nodes between fn and the static split"]
NB4["4. build_ancestor_tree groups by frozenset of switch ancestors\nand chains subsets together"]
NB5["5. Emit depends string from required_deps\ne.g. ((sub-a.Succeeded || sub-b.Succeeded))"]
NB1 --> NB2 --> NB3 --> NB4 --> NB5
end
Last reviewed commit: 8939b41 |
| nodes = [ | ||
| n | ||
| for g in children | ||
| for n in (g if isinstance(g, list) else [g]) | ||
| ] |
There was a problem hiding this comment.
Dead isinstance(g, list) branch — always evaluates to [g]
children in node_groups is always a flat list of step-name strings. It is populated exclusively via new_funcs.append(fn) where fn is a string from node.in_funcs. Consequently isinstance(g, list) is always False, the g branch is dead code, and the comprehension is always equivalent to nodes = list(children).
Keeping the guard creates noise for future maintainers and may suggest that node_groups can hold nested lists when it cannot.
| nodes = [ | |
| n | |
| for g in children | |
| for n in (g if isinstance(g, list) else [g]) | |
| ] | |
| nodes = list(children) |
Fixes an issue where a join-step nested inside a conditional branch did not have the correct dependencies. This would lead to the join step possibly executing prematurely, before all of its preceding steps had finished.
example flow: