Skip to content

Commit ccbc4a5

Browse files
committed
Address review feedback on PR #68012
Fix the CI failures and review comments from PR #68012: - Remove the dead module-level VersionBundle construction in schema/versions/__init__.py that referenced names only imported under TYPE_CHECKING, breaking the lazy cadwyn import on any access to the module and causing NameError in ~30 task-sdk tests. - Remove a duplicated old_ver_client fixture and import block that had been pasted into test_task_instances.py, which triggered mypy no-redef and ruff F811/E402 failures in Static checks. - Use func.min(start_date) instead of ordering by TaskReschedule.id when computing the first reschedule start date, since insertion order does not guarantee chronological order.
1 parent d55bdf8 commit ccbc4a5

3 files changed

Lines changed: 3 additions & 22 deletions

File tree

airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,7 @@ def ti_run(
299299
first_task_reschedule_start_date = None
300300
if task_reschedule_count > 0:
301301
first_task_reschedule_start_date = session.scalar(
302-
select(TaskReschedule.start_date)
303-
.where(TaskReschedule.ti_id == task_instance_id)
304-
.order_by(TaskReschedule.id.asc())
305-
.limit(1)
302+
select(func.min(TaskReschedule.start_date)).where(TaskReschedule.ti_id == task_instance_id)
306303
)
307304

308305
dr.team_name = get_team_name_for_ti(task_instance_id, session)

airflow-core/tests/unit/api_fastapi/execution_api/versions/v2026_06_30/test_task_instances.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@
2929

3030
pytestmark = pytest.mark.db_test
3131

32-
33-
@pytest.fixture
34-
def old_ver_client(client):
35-
"""Last released execution API before first_task_reschedule_start_date was added."""
36-
import pytest
37-
38-
from airflow._shared.timezones import timezone
39-
from airflow.utils.state import DagRunState, State
40-
41-
from tests_common.test_utils.db import clear_db_runs
42-
43-
pytestmark = pytest.mark.db_test
44-
4532
TIMESTAMP_STR = "2024-09-30T12:00:00Z"
4633
TIMESTAMP = timezone.parse(TIMESTAMP_STR)
4734
PARTITION_DATE = timezone.parse("2026-05-20T01:00:00")
@@ -111,6 +98,8 @@ def test_first_task_reschedule_start_date_removed_from_previous_version(
11198
result = response.json()
11299
assert result["task_reschedule_count"] == 1
113100
assert "first_task_reschedule_start_date" not in result
101+
102+
114103
class TestPartitionDateFieldBackwardCompat:
115104
@pytest.fixture(autouse=True)
116105
def _freeze_time(self, time_machine):

task-sdk/src/airflow/sdk/execution_time/schema/versions/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
import functools
2121
from typing import TYPE_CHECKING, Any
2222

23-
bundle = VersionBundle(
24-
HeadVersion(),
25-
# First supervisor schema version; there is no previous version to migrate from.
26-
Version("2026-06-16"),
27-
)
2823
if TYPE_CHECKING:
2924
from cadwyn import VersionBundle
3025

0 commit comments

Comments
 (0)