Skip to content

Commit 4ad460d

Browse files
potiukvatsrahul1001
authored andcommitted
Fix bulk task instance update for mapped TIs and auth error rendering (#65874)
On v3-2-test, BulkTaskInstanceService had three pre-existing bugs: 1. `_perform_update` did not pass `map_index` to `_patch_ti_validate_request`, so the validation step looked up the wrong TI (default map_index=-1) and persistence silently no-op'd for mapped task instances. 2. `specific_entity_map` and `all_map_entity_map` used raw `(entity.dag_id, entity.dag_run_id, entity.task_id, ...)` tuples as keys. When `dag_id`/`dag_run_id` came from the path and not the request body, those attributes were `None` on the entity, while keys produced by `_categorize_entities` resolved them via `_extract_task_identifiers`. The resulting key mismatch meant matched task keys never resolved back to an entity, so `_perform_update` was never called and `response.update.success` came back empty. 3. `action_name=action.action` rendered as `'BulkAction.UPDATE'` /`'BulkAction.DELETE'` in authorization error messages because Python's str-enum `__format__` returns the enum repr, not the value. Use `.value` to get "update"/"delete". All three fixes already exist on main; this backport is the minimal diff to bring v3-2-test in line with main for this file. Also includes the following pre-existing v3-2-test fixes that the prek hooks force to land alongside any source change: - Regenerated _private_ui.yaml, schemas.gen.ts and types.gen.ts: generate-openapi-spec caught a description drift on `ExtraMenuItem`. - Added `fpr` to docs/spelling_wordlist.txt: codespell flagged the GPG colons-format `^fpr:` regex tag in dev/README_RELEASE_*.md. Same fix already on main from #65501. - Regenerated dev/breeze/doc/images/output_pr_auto-triage.{svg,txt}: the boring-cyborg config update in #65872 added the `backport-to-airflow-ctl-v0-1-test` label, which appears in the `breeze pr auto-triage --help` output and changes its hash.
1 parent 5b0362a commit 4ad460d

7 files changed

Lines changed: 28 additions & 20 deletions

File tree

airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,6 +2215,8 @@ components:
22152215
- text
22162216
- href
22172217
title: ExtraMenuItem
2218+
description: Define a menu item that can be added to the menu by auth managers
2219+
or plugins.
22182220
GanttResponse:
22192221
properties:
22202222
dag_id:

airflow-core/src/airflow/api_fastapi/core_api/services/public/task_instances.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ def _perform_update(
299299
dag_bag=self.dag_bag,
300300
body=entity,
301301
session=self.session,
302+
map_index=map_index,
302303
update_mask=update_mask,
303304
)
304305

@@ -337,17 +338,17 @@ def handle_bulk_update(
337338
"""Bulk Update Task Instances."""
338339
# Validate and categorize entities into specific and all map index update sets
339340
update_specific_map_index_task_keys, update_all_map_index_task_keys = self._categorize_entities(
340-
action.entities, results, method="PUT", action_name=action.action
341+
action.entities, results, method="PUT", action_name=action.action.value
341342
)
342343

343344
try:
344345
specific_entity_map = {
345-
(entity.dag_id, entity.dag_run_id, entity.task_id, entity.map_index): entity
346+
self._extract_task_identifiers(entity): entity
346347
for entity in action.entities
347348
if entity.map_index is not None
348349
}
349350
all_map_entity_map = {
350-
(entity.dag_id, entity.dag_run_id, entity.task_id): entity
351+
self._extract_task_identifiers(entity)[:3]: entity
351352
for entity in action.entities
352353
if entity.map_index is None
353354
}
@@ -439,7 +440,7 @@ def handle_bulk_delete(
439440
"""Bulk delete task instances."""
440441
# Validate and categorize entities into specific and all map index delete sets
441442
delete_specific_map_index_task_keys, delete_all_map_index_task_keys = self._categorize_entities(
442-
action.entities, results, method="DELETE", action_name=action.action
443+
action.entities, results, method="DELETE", action_name=action.action.value
443444
)
444445

445446
try:

airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8125,7 +8125,8 @@ export const $ExtraMenuItem = {
81258125
},
81268126
type: 'object',
81278127
required: ['text', 'href'],
8128-
title: 'ExtraMenuItem'
8128+
title: 'ExtraMenuItem',
8129+
description: 'Define a menu item that can be added to the menu by auth managers or plugins.'
81298130
} as const;
81308131

81318132
export const $GanttResponse = {

airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,6 +1985,9 @@ export type EdgeResponse = {
19851985
is_source_asset?: boolean | null;
19861986
};
19871987

1988+
/**
1989+
* Define a menu item that can be added to the menu by auth managers or plugins.
1990+
*/
19881991
export type ExtraMenuItem = {
19891992
text: string;
19901993
href: string;

dev/breeze/doc/images/output_pr_auto-triage.svg

Lines changed: 14 additions & 14 deletions
Loading
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d8cea45c4870fdc6a06e25481f7c85c0
1+
deebc98535219d8f556f4f2dca908a75

docs/spelling_wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ formatter
651651
formatters
652652
forwardability
653653
forwardable
654+
fpr
654655
fqdn
655656
frontend
656657
fs

0 commit comments

Comments
 (0)