fix: prevent duplicate DAGTask names in foreach + split-switch flows#3204
Conversation
Greptile SummaryThis PR adds a one-line guard to
Confidence Score: 4/5The production fix is correct, but the regression test does not exercise the bug path it is meant to guard. The change to argo_workflows.py is minimal and logically sound. The accompanying test flow never reaches the duplicate-emission code path because its skip-to-end branch causes the split-switch conditional join to resolve to end rather than join_step, so the test passes identically with or without the fix. test/ux/core/flows/dag/foreach_split_switch_dedup_flow.py needs to be reworked so that all conditional branches of the split-switch converge at the foreach matching join step. Important Files Changed
Reviews (6): Last reviewed commit: "test: move argo foreach dedup regression..." | Re-trigger Greptile |
There was a problem hiding this comment.
the test cases need some polish. As they are, it is unnecessarily complex for one test setup. Consider the following as an alternative
- using
Deployerand passing the--only-jsonflag to it for the argo-workflows implementation. This will give you the same DAG spec that you can do the checks for - instead of inlining the test flow, simply add it as a separate asset, as the deployer can work with filenames directly.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3204 +/- ##
=========================================
Coverage ? 28.33%
=========================================
Files ? 381
Lines ? 52369
Branches ? 9247
=========================================
Hits ? 14841
Misses ? 36579
Partials ? 949 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@odncode thanks for doing this! i'd love to see this go in, so let me know if i can help get it across the finish line |
When a split-switch's matching_conditional_join resolves to the same node
as a foreach's matching_join, _visit in _dag_templates emitted two DAGTasks
with the same name. Argo rejects this at submit time with:
templates.<flow> sorting failed: duplicated nodeName <step>
Root cause: the foreach branch appended a join DAGTask but did not add the
matching_join name to the seen list, allowing a later traversal via the
split-switch handler to emit a second DAGTask for the same node.
Fix: add seen.append(self.graph[node.matching_join].name) immediately after
the foreach join task is appended.
Includes a regression test that compiles a minimal repro flow and checks
for duplicate task names in the generated Argo JSON.
Closes Netflix#3196
Addresses review feedback: the subprocess approach always skipped in CI due to cloud datastore requirements. The new test builds a minimal graph stand-in and calls _dag_templates() directly, consistent with the existing test patterns in test_argo_workflows_cli.py.
Fixed dunder method dispatch issue (class-level not instance-level). Added enable_heartbeat_daemon attribute needed by _dag_templates. Verified locally: new test passes, all 16 existing tests still pass.
Previous mock graph did not trigger the duplicate-emission condition because _parse_conditional_branches requires real graph attributes. Now uses Metaflow's FlowGraph to parse the repro flow directly, bypassing CLI and cloud datastore requirements. Verified: test FAILS without the fix (detects duplicate 'join-step'), PASSES with it. All 16 existing tests unaffected.
4574da4 to
3f3bf97
Compare
3f3bf97 to
93399e4
Compare
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
Summary
Fixes the duplicate
DAGTaskname bug reported in #3196.When a split-switch's
matching_conditional_joinresolves to the same node as a foreach'smatching_join,_visitin_dag_templatesemitted twoDAGTasks with the same name. Argo rejects this at submit time with:Root Cause
The foreach branch appends a
join_foreach_tasktodag_tasksbut did not add thematching_joinname to theseenlist.When a later traversal arrives at the same node via the split-switch handler, the
seencheck does not fire, and a secondDAGTaskis emitted.Fix
One-line change:
added immediately after:
Closes #3196