Skip to content

Commit 33820c0

Browse files
authored
Update Cadwyn migrations with v3-1-test changes (#57011)
After cherry-picking, the versions needs to change on one of the Cadwyn migrations.
1 parent 1e7639d commit 33820c0

File tree

5 files changed

+58
-21
lines changed

5 files changed

+58
-21
lines changed

airflow-core/src/airflow/api_fastapi/execution_api/versions/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@
2626
AddIncludePriorDatesToGetXComSlice,
2727
)
2828
from airflow.api_fastapi.execution_api.versions.v2025_09_23 import AddDagVersionIdField
29-
from airflow.api_fastapi.execution_api.versions.v2025_10_10 import (
30-
AddTriggeringUserNameField,
31-
MakeDagRunConfNullable,
32-
)
29+
from airflow.api_fastapi.execution_api.versions.v2025_10_27 import MakeDagRunConfNullable
30+
from airflow.api_fastapi.execution_api.versions.v2026_01_01 import AddTriggeringUserNameField
3331

3432
bundle = VersionBundle(
3533
HeadVersion(),
36-
Version("2025-10-10", AddTriggeringUserNameField, MakeDagRunConfNullable),
34+
Version("2026-01-01", AddTriggeringUserNameField),
35+
Version("2025-10-27", MakeDagRunConfNullable),
3736
Version("2025-09-23", AddDagVersionIdField),
3837
Version(
3938
"2025-08-10",
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
from __future__ import annotations
19+
20+
from cadwyn import ResponseInfo, VersionChange, convert_response_to_previous_version_for
21+
22+
from airflow.api_fastapi.execution_api.datamodels.taskinstance import TIRunContext
23+
24+
25+
class MakeDagRunConfNullable(VersionChange):
26+
"""Make DagRun.conf field nullable to match database schema."""
27+
28+
description = __doc__
29+
30+
instructions_to_migrate_to_previous_version = ()
31+
32+
@convert_response_to_previous_version_for(TIRunContext) # type: ignore[arg-type]
33+
def ensure_conf_is_dict_in_dag_run(response: ResponseInfo) -> None: # type: ignore[misc]
34+
"""Ensure conf is always a dict (never None) in previous versions."""
35+
if "dag_run" in response.body and isinstance(response.body["dag_run"], dict):
36+
if response.body["dag_run"].get("conf") is None:
37+
response.body["dag_run"]["conf"] = {}

airflow-core/src/airflow/api_fastapi/execution_api/versions/v2025_10_10.py renamed to airflow-core/src/airflow/api_fastapi/execution_api/versions/v2026_01_01.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,3 @@ def remove_triggering_user_name_from_dag_run(response: ResponseInfo) -> None: #
3434
"""Remove the `triggering_user_name` field from the dag_run object when converting to the previous version."""
3535
if "dag_run" in response.body and isinstance(response.body["dag_run"], dict):
3636
response.body["dag_run"].pop("triggering_user_name", None)
37-
38-
39-
class MakeDagRunConfNullable(VersionChange):
40-
"""Make DagRun.conf field nullable to match database schema."""
41-
42-
description = __doc__
43-
44-
instructions_to_migrate_to_previous_version = ()
45-
46-
@convert_response_to_previous_version_for(TIRunContext) # type: ignore[arg-type]
47-
def ensure_conf_is_dict_in_dag_run(response: ResponseInfo) -> None: # type: ignore[misc]
48-
"""Ensure conf is always a dict (never None) in previous versions."""
49-
if "dag_run" in response.body and isinstance(response.body["dag_run"], dict):
50-
if response.body["dag_run"].get("conf") is None:
51-
response.body["dag_run"]["conf"] = {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.

task-sdk/src/airflow/sdk/api/datamodels/_generated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, JsonValue, RootModel
2929

30-
API_VERSION: Final[str] = "2025-10-10"
30+
API_VERSION: Final[str] = "2026-01-01"
3131

3232

3333
class AssetAliasReferenceAssetEventDagRun(BaseModel):

0 commit comments

Comments
 (0)