You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2025/07/03 20:30:11 UTC
(airflow) branch v3-0-test updated: Fixing bad cadwyn migration for upstream map indexes (#52797)
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-0-test by this push:
new d7825f110db Fixing bad cadwyn migration for upstream map indexes (#52797)
d7825f110db is described below
commit d7825f110db607e125b63ba2455a025ade2571e8
Author: Amogh Desai <am...@gmail.com>
AuthorDate: Thu Jul 3 22:27:50 2025 +0530
Fixing bad cadwyn migration for upstream map indexes (#52797)
(cherry picked from commit 2bb5d016b3404206e7d49ed5371f2f11e07aa537)
---
RELEASE_NOTES.rst | 1 +
.../airflow/api_fastapi/execution_api/versions/v2025_05_20.py | 9 +++++----
.../execution_api/versions/v2025_04_28/test_task_instances.py | 9 ++++++++-
reproducible_build.yaml | 4 ++--
4 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst
index f4ad5d7829f..e25919beb0f 100644
--- a/RELEASE_NOTES.rst
+++ b/RELEASE_NOTES.rst
@@ -77,6 +77,7 @@ Bug Fixes
- Add ti information to re-queue logs (#49995)
- Task SDK: Fix ``AssetEventOperations.get`` to use ``alias_name`` when specified (#52324)
- Ensure trigger kwargs are properly deserialized during trigger execution (#52721)
+- Fixing bad cadwyn migration for upstream map indexes (#52797)
Miscellaneous
"""""""""""""
diff --git a/airflow-core/src/airflow/api_fastapi/execution_api/versions/v2025_05_20.py b/airflow-core/src/airflow/api_fastapi/execution_api/versions/v2025_05_20.py
index f8039f0a4d3..be91ab2f0f8 100644
--- a/airflow-core/src/airflow/api_fastapi/execution_api/versions/v2025_05_20.py
+++ b/airflow-core/src/airflow/api_fastapi/execution_api/versions/v2025_05_20.py
@@ -30,7 +30,7 @@ class DowngradeUpstreamMapIndexes(VersionChange):
description = __doc__
instructions_to_migrate_to_previous_version = (
- schema(TIRunContext).field("upstream_map_indexes").had(type=Optional[dict[str, int]]), # type: ignore
+ schema(TIRunContext).field("upstream_map_indexes").had(type=Optional[dict[str, Optional[int]]]),
)
@convert_response_to_previous_version_for(TIRunContext) # type: ignore[arg-type]
@@ -42,13 +42,14 @@ class DowngradeUpstreamMapIndexes(VersionChange):
"""
resp = response.body.get("upstream_map_indexes")
if isinstance(resp, dict):
- downgraded = {}
+ downgraded: dict[str, int | list | None] = {}
for k, v in resp.items():
if isinstance(v, int):
downgraded[k] = v
elif isinstance(v, list) and v and all(isinstance(i, int) for i in v):
downgraded[k] = v[0]
else:
- # for cases like None, make it -1
- downgraded[k] = -1
+ # Keep values like None as is — the Task SDK expects them unchanged during mapped task expansion,
+ # and modifying them can cause unexpected failures.
+ downgraded[k] = None
response.body["upstream_map_indexes"] = downgraded
diff --git a/airflow-core/tests/unit/api_fastapi/execution_api/versions/v2025_04_28/test_task_instances.py b/airflow-core/tests/unit/api_fastapi/execution_api/versions/v2025_04_28/test_task_instances.py
index fce29c4b2e5..8d30b477ed1 100644
--- a/airflow-core/tests/unit/api_fastapi/execution_api/versions/v2025_04_28/test_task_instances.py
+++ b/airflow-core/tests/unit/api_fastapi/execution_api/versions/v2025_04_28/test_task_instances.py
@@ -62,9 +62,16 @@ class TestTIUpdateState:
{"task_a": 3, "task_b": 9},
id="list of ints",
),
+ pytest.param(
+ [
+ ("task_a", None),
+ ],
+ {"task_a": None},
+ id="task has no upstreams",
+ ),
pytest.param(
[("task_a", None), ("task_b", [6, 7]), ("task_c", 2)],
- {"task_a": -1, "task_b": 6, "task_c": 2},
+ {"task_a": None, "task_b": 6, "task_c": 2},
id="mixed types",
),
],
diff --git a/reproducible_build.yaml b/reproducible_build.yaml
index 618d83b4838..6663b4c8c3a 100644
--- a/reproducible_build.yaml
+++ b/reproducible_build.yaml
@@ -1,2 +1,2 @@
-release-notes-hash: 3a16d9fdbc3cac54b23e0cac1e92ff10
-source-date-epoch: 1751573977
+release-notes-hash: de8144e966c67986caa98ae835947858
+source-date-epoch: 1751574576