This is an automated email from the ASF dual-hosted git repository.
amoghrajesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new cc995694371 Run task sdk tests and mypy when uv lock changes (#77525)
cc995694371 is described below
commit cc9956943712d27eeb845cdf2532ebe08537adb8
Author: Amogh Desai <[email protected]>
AuthorDate: Tue Nov 24 17:01:47 2026 +0530
Run task sdk tests and mypy when uv lock changes (#77525)
---
dev/breeze/doc/ci/04_selective_checks.md | 9 +++++---
.../src/airflow_breeze/utils/selective_checks.py | 13 +++++++++--
dev/breeze/tests/test_selective_checks.py | 27 ++++++++++++++++++++++
3 files changed, 44 insertions(+), 5 deletions(-)
diff --git a/dev/breeze/doc/ci/04_selective_checks.md
b/dev/breeze/doc/ci/04_selective_checks.md
index 5fc62d5d671..8260dcdee9d 100644
--- a/dev/breeze/doc/ci/04_selective_checks.md
+++ b/dev/breeze/doc/ci/04_selective_checks.md
@@ -511,7 +511,10 @@ together using `pytest-xdist` (pytest-xdist distributes
the tests among parallel
with the images they need (none for airflow-ctl); other tests do not run,
provider tests are skipped,
and docs build only the chart's package. Static checks still run. See [Stage
2](#stage-2--decide-which-jobs-run).
* If no Source files are changed - no tests are run and no further rules below
are checked.
-* `CI Image building` is enabled if either test are run, docs are build.
+* `CI Image building` is enabled if either test are run, docs are build, or
`uv.lock` changed.
+* `Task SDK tests` and the `mypy-task-sdk` check run when `Task SDK files` or
`uv.lock` changed, because a
+ lock file bump can upgrade a library the Task SDK imports (for example
`kubernetes` in serde). Unlike a
+ Task SDK file change, a `uv.lock` change alone does not select the tests of
all providers.
* Jobs that used to run for every change run only when a file they depend on
changed. Full-test runs,
which include the scheduled canary runs, still run all of them:
* `Shared distributions tests` run when `shared/`, `devel-common/`,
`dev/mypy/`, the root `pyproject.toml`
@@ -689,7 +692,7 @@ when some files are not changed. Those are the rules
implemented:
* if no `All Airflow Python files` changed - `mypy-airflow-core` check is
skipped
* if no `All Dev Python files` changed - `mypy-dev` check is skipped
* if no `All Scripts Python files` changed - `mypy-scripts` check is skipped
- * if no `Task SDK files` changed - `mypy-task-sdk` check is skipped
+ * if neither `Task SDK files` nor `uv.lock` changed - `mypy-task-sdk` check
is skipped
* if no `All Airflow CTL Python files` changed - `mypy-airflow-ctl` check is
skipped
* if no `All Devel Common Python files` changed - `mypy-devel-common` check
is skipped
* if no files under the matching folder changed, the corresponding
per-folder mypy hook
@@ -820,7 +823,7 @@ GitHub Actions to pass the list of parameters to a command
to execute
| run-providers-compatibility-tests | Whether the
provider tests run against released Airflow versions: false when every changed
file is hidden from them (Task SDK or core Python sources, Task SDK tests,
their docs); off on component branches | true
| |
| run-shared-distributions-tests | Whether the shared
distributions tests run: `shared/`, `devel-common/`, `dev/mypy/`, the root
`pyproject.toml` or `uv.lock` changed; off on component branches | true
| |
| run-system-tests | Whether system
tests should be run ("true"/"false")
| true | |
-| run-task-sdk-tests | Whether Task SDK
tests should be run ("true"/"false")
| true | |
+| run-task-sdk-tests | Whether Task SDK
tests should be run: Task SDK files or `uv.lock` changed ("true"/"false")
| true | |
| run-translation-check | Whether the UI
translation completeness check runs: a translation file changed; off on
component branches | true | |
| run-ts-sdk-docs | Whether the
TypeScript SDK API reference should be built — on `ts-sdk/api-docs/`,
`ts-sdk/docs/`, or `ts-sdk/src/` changes, including Markdown ("true"/"false")
| true | |
| run-ts-sdk-e2e-tests | Whether TypeScript
SDK e2e tests should be run — on runtime-affecting `ts-sdk/`, TS e2e test, Node
coordinator, or native Lang-SDK Dag parsing changes ("true"/"false") | true
| |
diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
index 5f3a3bfe649..f7a3754105d 100644
--- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
+++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
@@ -1627,6 +1627,11 @@ class SelectiveChecks:
@cached_property
@_scoped_to_component_branch
def run_task_sdk_tests(self) -> bool:
+ # A uv.lock bump can upgrade a library the Task SDK imports, e.g.
kubernetes in serde.
+ return self._task_sdk_files_changed or self.is_uv_lock_update
+
+ @cached_property
+ def _task_sdk_files_changed(self) -> bool:
return self._should_be_run(FileGroupForCi.TASK_SDK_FILES)
@cached_property
@@ -1780,6 +1785,7 @@ class SelectiveChecks:
or self.run_ui_tests
or self.pyproject_toml_changed
or self.any_provider_yaml_or_pyproject_toml_changed
+ or self.is_uv_lock_update
or self.prod_image_build
# prek hooks no longer force the full test matrix (they are static
checks, not
# tests), but they still need the CI image so mypy-scripts and the
image-based
@@ -1937,7 +1943,7 @@ class SelectiveChecks:
return []
if self.upgrade_to_newer_dependencies:
return ["Providers"]
- if self.full_tests_needed or self.run_task_sdk_tests:
+ if self.full_tests_needed or self._task_sdk_files_changed:
if split_to_individual_providers:
return list(providers_test_type())
return ["Providers"]
@@ -2463,7 +2469,10 @@ class SelectiveChecks:
prek_hooks_to_skip.add("mypy-dev")
if not
self._matching_files(FileGroupForCi.ALL_SCRIPTS_PYTHON_FILES,
CI_FILE_GROUP_MATCHES):
prek_hooks_to_skip.add("mypy-scripts")
- if not self._matching_files(FileGroupForCi.TASK_SDK_FILES,
CI_FILE_GROUP_MATCHES):
+ if (
+ not self._matching_files(FileGroupForCi.TASK_SDK_FILES,
CI_FILE_GROUP_MATCHES)
+ and not self.is_uv_lock_update
+ ):
prek_hooks_to_skip.add("mypy-task-sdk")
if not
self._matching_files(FileGroupForCi.ALL_DEVEL_COMMON_PYTHON_FILES,
CI_FILE_GROUP_MATCHES):
prek_hooks_to_skip.add("mypy-devel-common")
diff --git a/dev/breeze/tests/test_selective_checks.py
b/dev/breeze/tests/test_selective_checks.py
index b40a7d935bb..0d949f39b05 100644
--- a/dev/breeze/tests/test_selective_checks.py
+++ b/dev/breeze/tests/test_selective_checks.py
@@ -1773,6 +1773,15 @@ def assert_outputs_are_printed(expected_outputs:
dict[str, str], stderr: str):
{"run-agent-framework-tests": "true", "full-tests-needed":
"false"},
id="Run agent framework tests when the lock file changes",
),
+ pytest.param(
+ ("uv.lock",),
+ {
+ "run-task-sdk-tests": "true",
+ "ci-image-build": "true",
+ "providers-test-types-list-as-strings-in-json": "[]",
+ },
+ id="Run Task SDK tests without all provider tests when the lock
file changes",
+ ),
pytest.param(
("providers/common/ai/docs/frameworks/strands.rst",),
{"run-agent-framework-tests": "false"},
@@ -4100,6 +4109,24 @@ def test_has_migrations(files: tuple[str, ...],
has_migrations: bool):
assert_outputs_are_printed({"has-migrations":
str(has_migrations).lower()}, str(stderr))
[email protected](
+ ("files", "skipped"),
+ [
+ pytest.param(("uv.lock",), False, id="lock file changed"),
+ pytest.param(("airflow-core/src/airflow/models/dag.py",), True, id="no
Task SDK or lock file change"),
+ ],
+)
+def test_mypy_task_sdk_skipped(files: tuple[str, ...], skipped: bool):
+ skip_prek_hooks = SelectiveChecks(
+ files=files,
+ commit_ref=NEUTRAL_COMMIT,
+ github_event=GithubEvents.PULL_REQUEST,
+ default_branch="main",
+ ).skip_prek_hooks
+
+ assert ("mypy-task-sdk" in skip_prek_hooks.split(",")) is skipped
+
+
@pytest.mark.parametrize(
("labels", "expected_outputs"),
[