ephraimbuddy opened a new issue, #76445:
URL: https://github.com/apache/airflow/issues/76445

   ### What happens
   
   A mapped task has already expanded, then its producer is re-run and returns 
an empty list. This happens on any clear; no Dag change is needed. 
`DagRun._revise_map_indexes_if_mapped` then marks every existing index REMOVED, 
and nothing is left SKIPPED. `_check_for_removed_or_restored_tasks` does the 
same when integrity is verified after the producer finishes.
   
   A fresh run that maps to zero marks the placeholder SKIPPED instead, in 
`TaskInstance.expand_mapped_task`. So downstream tasks behave differently:
   
   | Downstream trigger rule | Fresh run, `[]` | Re-run, `[]` |
   |---|---|---|
   | `all_success` | skipped | runs |
   | `none_failed_min_one_success` | skipped, run succeeds | upstream_failed, 
**run fails** |
   | `all_done` | runs | runs |
   
   `none_failed_min_one_success` counts REMOVED upstreams as done with no 
success, so it sets UPSTREAM_FAILED.
   
   ### How to reproduce
   
   1. Use a Dag with `size >> mapped.expand(arg=size.output) >> after`.
   2. `size` returns `[1, 2]`. Let the run finish.
   3. Clear `size` and its downstream tasks.
   4. `size` returns `[]`.
   5. `mapped` indexes 0 and 1 end REMOVED, and `after` follows the "Re-run" 
column above.
   
   ### What should happen
   
   The same as a fresh zero-length run: the mapped task ends SKIPPED, so 
downstream trigger rules see a skipped upstream.
   
   ### Notes
   
   - This has been the behaviour since #25788 (2022), and 
`test_calls_to_verify_integrity_with_mapped_task_zero_length_at_runtime` 
asserts all-REMOVED.
   - Changing it changes what downstream tasks do after such a re-run. For 
example, `all_success` downstreams that run today would skip.
   - One option: when the resolved length is 0, mark the lowest index SKIPPED 
and the rest REMOVED, in both places.
   - Raised in review of #76420.
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by @ephraimbuddy before posting
   


-- 
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