shahar1 opened a new pull request, #67684:
URL: https://github.com/apache/airflow/pull/67684
A task using a "fast triggered" trigger rule (`ONE_FAILED`, `ONE_SUCCESS`,
`ONE_DONE`) inside a **mapped task group** was evaluated against *every*
expanded instance of its upstream, instead of the upstream instance that shares
its own map index. As a result, a single failed (or succeeded) upstream
instance wrongly triggered the rule for **every** expanded instance of the task.
For example, in the reproduction from the issue, `divide(0)` fails while
`divide(1..3)` succeed, yet the mapped `report_failure` task (`ONE_FAILED`) ran
for *all* map indexes instead of only index `0`.
### Root cause
`TriggerRuleDep._get_relevant_upstream_map_indexes` short-circuits to
"depend on every upstream instance" for the fast-triggered rules when the
upstream is not an expansion dependency of the group (introduced in #44937 to
fix #34023). That broad behavior is only needed for the **not-yet-expanded
summary task instance** (`map_index < 0`), so the task is not prematurely
skipped before the mapped task group expands. Applying it to the
already-expanded instances broke per-index correspondence.
### Fix
Restrict the special case to the summary instance (`ti.map_index < 0`).
Expanded instances now use the normal per-map-index upstream resolution, so
each `report_failure[k]` depends on `divide[k]` only.
### Tests
- Added `test_one_failed_trigger_rule_in_mapped_task_group_is_per_index`
(the issue's repro: `report_failure` is now `{0: success, 1..3: skipped}`).
- Added
`test_one_failed_trigger_rule_runs_on_indirect_failure_in_mapped_task_group`
(end-to-end guard for the #34023 behavior).
- The existing
`test_mapped_tasks_in_mapped_task_group_waits_for_upstreams_to_complete`
(#44937, premature-skip guard) still passes.
closes: #50210
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 4.8)
Generated-by: Claude Code (Opus 4.8) 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]