shahar1 opened a new pull request, #75417:
URL: https://github.com/apache/airflow/pull/75417

   related: #39801, #69377
   
   <!-- HUMAN SUMMARY - AGENTS DO NOT MODIFY -->
   
   <!-- END OF HUMAN SUMMARY -->
   
   <details><summary>AI Summary</summary>
   
   A task with `trigger_rule="all_done_min_one_success"` inside a dynamically 
mapped task group never expands when all of its direct upstreams are in the 
same group. Its unexpanded placeholder (`map_index=-1`) is marked 
`upstream_failed` and the Dag run fails, even when every upstream instance 
succeeds:
   
   ```
   init[-1] = success
   tg.imsleepy[0..2] = success
   tg.imawake[-1] = upstream_failed   # never expands
   ```
   
   Reproduced with `airflow dags test` in Breeze on main.
   
   **Cause.** For the placeholder, the relevant map index of an in-group 
upstream is `-1`. Once that upstream expands, no upstream task instance has map 
index `-1`, so the placeholder counts zero upstreams. `all_success`, 
`none_failed` and `all_done` pass on zero upstreams and the task expands. 
`all_done_min_one_success` reads zero as "all done, none succeeded" and sets 
`upstream_failed`.
   
   **Fix.** When a placeholder inside a mapped task group has no upstream task 
instance left to judge, the trigger rule check now passes without setting a 
state. The task expands and each expanded instance evaluates its own upstreams, 
as with the other "all done" rules.
   
   #69377 fixed the same symptom for `none_failed_min_one_success` by adding it 
to `is_fast_triggered`. Doing the same here was rejected: the placeholder would 
then count every upstream instance, so one skipped index would skip the whole 
task. It would also regress shapes that work on main today, such as a task that 
also takes the group's mapped argument.
   
   Per-index results for `all_done_min_one_success`, in-group upstream only:
   
   | Upstream index 1 | main | this PR |
   |---|---|---|
   | succeeds | `{-1: upstream_failed}` | `{0, 1, 2: success}` |
   | skipped | `{-1: upstream_failed}` | `{0: success, 1: skipped, 2: success}` 
|
   | failed | `{-1: upstream_failed}` | `{0: success, 1: upstream_failed, 2: 
success}` |
   
   Shapes where the task also has the mapped argument or an outside task as 
upstream already decide per index on main and are unchanged.
   
   A before/after comparison of `dag.test()` runs covered every trigger rule 
except `always`, several upstream shapes, skipped/failed upstream indexes, 
branching, zero-length expansion and a mapped group inside a loop. Only 
`all_done_min_one_success` results changed, and all to per-index states.
   
   Known limitations, not regressions:
   
   - `all_done_min_one_success` with a **failed** upstream outside the group 
and a successful one inside still ends `{-1: upstream_failed}`, as on main.
   - `none_failed_min_one_success` (#69377) still fails the whole task when one 
in-group upstream index fails. Moving it from `is_fast_triggered` to this guard 
may fix that; left for a follow-up.
   
   </details>
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5)
   
   Generated-by: Claude Code (Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to