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

   ## Summary
   
   Add validation for the `map_index` parameter when creating task instances 
via CLI commands. Previously, an out-of-range `map_index` would silently 
proceed without any indication of the error; now it raises a clear 
`RuntimeError` when the index exceeds the parse-time mapped task count.
   
   ## Issue
   
   Fixes #60463
   
   ## Changes
   
   - Added `map_index` range validation in `_get_ti()` function in 
`task_command.py`
   - Validation is performed for tasks with parse-time known mapped counts 
using `task.get_parse_time_mapped_ti_count()`
   - Gracefully skips validation for dynamically mapped tasks or non-mapped 
tasks (catches `NotFullyPopulated` and `NotMapped` exceptions)
   - Raises `RuntimeError` with a descriptive message when `map_index` is out 
of range
   - Added unit test `test_mapped_task_render_out_of_range` to verify the 
validation behavior
   
   ## Testing
   
   - Added new unit test `test_mapped_task_render_out_of_range` that verifies 
`RuntimeError` is raised when `map_index` exceeds the mapped task count
   - Test uses existing `test_mapped_classic` DAG with `consumer_literal` task 
(which has 3 mapped instances) and attempts to access `map_index=3`


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