This is an automated email from the ASF dual-hosted git repository.
jason810496 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 41519146043 Skip spotless and the Java SDK Dag schema sync on
unrelated PRs (#75268)
41519146043 is described below
commit 4151914604391e5439e5efe8a2fb8204b2e1bf49
Author: PoAn Yang <[email protected]>
AuthorDate: Wed Oct 28 16:02:40 2026 +0800
Skip spotless and the Java SDK Dag schema sync on unrelated PRs (#75268)
Signed-off-by: PoAn Yang <[email protected]>
---
dev/breeze/doc/ci/04_selective_checks.md | 32 ++++++---
.../src/airflow_breeze/utils/selective_checks.py | 12 +++-
dev/breeze/tests/test_selective_checks.py | 78 ++++++++++++++--------
3 files changed, 81 insertions(+), 41 deletions(-)
diff --git a/dev/breeze/doc/ci/04_selective_checks.md
b/dev/breeze/doc/ci/04_selective_checks.md
index 03d5ccf2c96..4481d99b054 100644
--- a/dev/breeze/doc/ci/04_selective_checks.md
+++ b/dev/breeze/doc/ci/04_selective_checks.md
@@ -610,17 +610,29 @@ when some files are not changed. Those are the rules
implemented:
type errors (see #68919)
* if no `All Python files` changed - `flynt` check is skipped
* if no `Helm files` changed - `lint-helm-chart` check is skipped
- * if no `Java SDK files` changed - `ktlint` and
- `regenerate-java-sdk-verification-metadata` checks are skipped (both run
the java-sdk
- Gradle wrapper, which downloads the Gradle distribution, and the latter
additionally
- resolves the whole Java SDK dependency graph from Maven Central, so we
avoid those
- downloads on PRs that do not touch `java-sdk/`)
+ * if no `Java SDK files` (`java-sdk/`, excluding `.md`) changed - `ktlint`,
`spotless` and
+ `regenerate-java-sdk-verification-metadata` checks are skipped. All three
run the java-sdk
+ Gradle wrapper, and `regenerate-java-sdk-verification-metadata` also
resolves the whole Java
+ SDK dependency graph from Maven Central
* if no `Java SDK conformance files` changed -
`check-java-sdk-serialization-conformance`
- is skipped (it compiles the Java SDK with Gradle and resolves its
dependencies from Maven
- Central). The group is wider than `Java SDK files`: it also covers
Airflow's serializer
- (`serialized_objects.py`), `schema.json` and the shared harness under
- `scripts/ci/lang_sdk_serialization/`, because the check compares the SDK
against those and
- none of them forces `full_tests_needed`
+ and `sync-java-sdk-dag-schema` are skipped
(`check-java-sdk-serialization-conformance`
+ compiles the Java SDK with Gradle and resolves its dependencies from Maven
Central, and
+ `sync-java-sdk-dag-schema` runs the `:sdk:syncDagSchema` Gradle task). The
group is wider
+ than `Java SDK files`. It also covers Airflow's serializer
(`serialized_objects.py`),
+ `airflow-core/src/airflow/serialization/schema.json` and the shared
harness under
+ `scripts/ci/lang_sdk_serialization/`. These files are in the group because
the conformance
+ check compares the SDK against them, and none of them forces
`full_tests_needed`. Because
+ airflow-core's `schema.json` is in the group, `sync-java-sdk-dag-schema`
still runs on a PR
+ that changes only that file. Such a change is what leaves the Java SDK's
copy in
+ `java-sdk/sdk/schema/dag-schema.json` out of date
+ * whichever of the five Java SDK hooks above runs first in a job pays for
Gradle's cold
+ start, which includes downloading the Gradle distribution. A PR skips the
cold start only
+ when it changes none of the `Java SDK conformance files`
+ * neither Java SDK group includes `.pre-commit-config.yaml` or CI setup
files. A PR that
+ changes only the definition of one of the five hooks therefore does not
run the hooks in
+ its own CI. The same holds for a PR whose only change is CI setup that
does not force
+ `full_tests_needed`, for example a composite action under
`.github/actions/`. The scheduled
+ canary runs skip none of the five hooks, so they still check such a change
* if no `TS SDK files` (`ts-sdk/`) changed -
`check-ts-sdk-supervisor-schema` check is
skipped (it regenerates and diffs the generated ts-sdk file from the
vendored schema). A
change to the supervisor wire schema on the Python side is not deferred to
a follow-up PR:
diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
index 733e1b68b61..8dfc0f2b8ab 100644
--- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
+++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
@@ -2141,10 +2141,11 @@ class SelectiveChecks:
):
prek_hooks_to_skip.add("lint-helm-chart")
if not self._matching_files(FileGroupForCi.JAVA_SDK_FILES,
CI_FILE_GROUP_MATCHES):
- # ktlint runs the java-sdk Gradle wrapper, which downloads the
Gradle distribution
- # on a cold cache. Skip it when no java-sdk files changed so
unrelated PRs do not
- # depend on that (intermittently failing) download.
+ # ktlint and spotless run the java-sdk Gradle wrapper, which
downloads the Gradle
+ # distribution on a cold cache. Skip both hooks when no java-sdk
files changed, so
+ # unrelated PRs do not depend on a download that fails
intermittently.
prek_hooks_to_skip.add("ktlint")
+ prek_hooks_to_skip.add("spotless")
# Rewriting the verification metadata resolves the entire Java SDK
dependency graph
# from Maven Central. Skip it when no java-sdk files changed so
unrelated PRs do not
# depend on that resolution.
@@ -2154,6 +2155,11 @@ class SelectiveChecks:
# Central. Skip it unless a java-sdk file, Airflow's serializer or
schema, or the shared
# harness changed. Those last do not force full_tests_needed, so
they need their own group.
prek_hooks_to_skip.add("check-java-sdk-serialization-conformance")
+ # sync-java-sdk-dag-schema runs the Gradle wrapper too. This hook
is skipped together
+ # with the conformance check, not with ktlint, because
JAVA_SDK_CONFORMANCE_FILES
+ # includes airflow-core's schema.json. A PR that changes only
schema.json can leave
+ # the Java SDK's copy of the schema out of date, and this hook
detects the outdated copy.
+ prek_hooks_to_skip.add("sync-java-sdk-dag-schema")
if not self._matching_files(FileGroupForCi.TS_SDK_FILES,
CI_FILE_GROUP_MATCHES):
# This hook regenerates ts-sdk/src/generated/supervisor.ts from
the vendored schema
# and diffs it, so it is skipped when no ts-sdk/ files changed. A
supervisor-schema
diff --git a/dev/breeze/tests/test_selective_checks.py
b/dev/breeze/tests/test_selective_checks.py
index 7dbf8a004f8..2aa1c6fc5ce 100644
--- a/dev/breeze/tests/test_selective_checks.py
+++ b/dev/breeze/tests/test_selective_checks.py
@@ -125,7 +125,7 @@ ALL_SKIPPED_COMMITS_ON_NO_CI_IMAGE = (
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
)
ALL_SKIPPED_COMMITS_BY_DEFAULT_ON_ALL_TESTS_NEEDED = "identity"
@@ -139,7 +139,7 @@ ALL_SKIPPED_COMMITS_IF_ONLY_UI_OPENAPI_CHANGED = (
"mypy-shared-observability,mypy-shared-plugins_manager,mypy-shared-providers_discovery,"
"mypy-shared-secrets_backend,mypy-shared-secrets_masker,mypy-shared-serialization,"
"mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,"
- "mypy-task-sdk-integration-tests,regenerate-java-sdk-verification-metadata"
+
"mypy-task-sdk-integration-tests,regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema"
)
ALL_SKIPPED_COMMITS_IF_NO_UI = (
@@ -150,7 +150,7 @@ ALL_SKIPPED_COMMITS_IF_NO_UI = (
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
)
ALL_SKIPPED_COMMITS_IF_NO_HELM_TESTS = (
"check-java-sdk-serialization-conformance,check-ts-sdk-supervisor-schema,identity,ktlint,lint-helm-chart,"
@@ -160,7 +160,7 @@ ALL_SKIPPED_COMMITS_IF_NO_HELM_TESTS = (
"mypy-shared-configuration,mypy-shared-dagnode,mypy-shared-listeners,mypy-shared-logging,"
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
-
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,regenerate-java-sdk-verification-metadata"
+
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema"
)
ALL_SKIPPED_COMMITS_IF_NO_UI_AND_HELM_TESTS = (
@@ -172,7 +172,7 @@ ALL_SKIPPED_COMMITS_IF_NO_UI_AND_HELM_TESTS = (
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
)
# API source/test change with NO OpenAPI spec change: the full matrix is no
longer
@@ -188,7 +188,7 @@ ALL_SKIPPED_COMMITS_IF_ONLY_API_SOURCE_CHANGED = (
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,"
"mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
)
ALL_SKIPPED_COMMITS_IF_NO_PROVIDERS_AND_UI = (
@@ -200,7 +200,7 @@ ALL_SKIPPED_COMMITS_IF_NO_PROVIDERS_AND_UI = (
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
)
ALL_SKIPPED_COMMITS_IF_NO_PROVIDERS = (
@@ -212,7 +212,7 @@ ALL_SKIPPED_COMMITS_IF_NO_PROVIDERS = (
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
)
@@ -225,7 +225,7 @@ ALL_SKIPPED_COMMITS_IF_NO_PROVIDERS_UI_AND_HELM_TESTS = (
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
)
ALL_SKIPPED_COMMITS_IF_NO_CODE_PROVIDERS_AND_HELM_TESTS = (
@@ -236,7 +236,7 @@ ALL_SKIPPED_COMMITS_IF_NO_CODE_PROVIDERS_AND_HELM_TESTS = (
"mypy-shared-configuration,mypy-shared-dagnode,mypy-shared-listeners,mypy-shared-logging,"
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
-
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,regenerate-java-sdk-verification-metadata"
+
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema"
)
ALL_SKIPPED_COMMITS_IF_NOT_IMPORTANT_FILES_CHANGED = (
@@ -248,7 +248,7 @@ ALL_SKIPPED_COMMITS_IF_NOT_IMPORTANT_FILES_CHANGED = (
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
)
@@ -493,7 +493,7 @@ def assert_outputs_are_printed(expected_outputs: dict[str,
str], stderr: str):
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
"upgrade-to-newer-dependencies": "false",
"core-test-types-list-as-strings-in-json": json.dumps(
@@ -540,7 +540,7 @@ def assert_outputs_are_printed(expected_outputs: dict[str,
str], stderr: str):
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,"
"mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
"upgrade-to-newer-dependencies": "false",
"core-test-types-list-as-strings-in-json": json.dumps(
@@ -794,7 +794,7 @@ def assert_outputs_are_printed(expected_outputs: dict[str,
str], stderr: str):
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
"skip-providers-tests": "false",
"upgrade-to-newer-dependencies": "false",
@@ -832,7 +832,7 @@ def assert_outputs_are_printed(expected_outputs: dict[str,
str], stderr: str):
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
"skip-providers-tests": "true",
"upgrade-to-newer-dependencies": "false",
@@ -895,7 +895,7 @@ def assert_outputs_are_printed(expected_outputs: dict[str,
str], stderr: str):
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
"skip-providers-tests": "true",
"upgrade-to-newer-dependencies": "false",
@@ -931,7 +931,7 @@ def assert_outputs_are_printed(expected_outputs: dict[str,
str], stderr: str):
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
"skip-providers-tests": "true",
"upgrade-to-newer-dependencies": "false",
@@ -1280,7 +1280,7 @@ def assert_outputs_are_printed(expected_outputs:
dict[str, str], stderr: str):
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
"upgrade-to-newer-dependencies": "false",
"core-test-types-list-as-strings-in-json": json.dumps(
@@ -1487,7 +1487,7 @@ def assert_outputs_are_printed(expected_outputs:
dict[str, str], stderr: str):
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
"upgrade-to-newer-dependencies": "false",
"core-test-types-list-as-strings-in-json": None,
@@ -1999,7 +1999,7 @@ def assert_outputs_are_printed(expected_outputs:
dict[str, str], stderr: str):
"mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,"
"mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
},
id=("Shared logging change keeps only mypy-shared-logging
among the mypy-shared-* hooks"),
@@ -2023,7 +2023,13 @@ def test_expected_output_pull_request_main(
@pytest.mark.parametrize(
"hook",
- ["ktlint", "regenerate-java-sdk-verification-metadata",
"check-java-sdk-serialization-conformance"],
+ [
+ "ktlint",
+ "spotless",
+ "regenerate-java-sdk-verification-metadata",
+ "check-java-sdk-serialization-conformance",
+ "sync-java-sdk-dag-schema",
+ ],
)
@pytest.mark.parametrize(
("files", "hook_skipped"),
@@ -2048,8 +2054,8 @@ def test_expected_output_pull_request_main(
def test_java_sdk_gradle_hooks_only_run_for_java_sdk_changes(
files: tuple[str, ...], hook_skipped: bool, hook: str
):
- # Both hooks run the java-sdk Gradle wrapper and download from it, so they
must be skipped
- # unless java-sdk changed.
+ # These hooks run the java-sdk Gradle wrapper and download through it, so
selective checks
+ # must skip them when only unrelated files change.
stderr = SelectiveChecks(
files=files,
commit_ref=NEUTRAL_COMMIT,
@@ -2061,6 +2067,7 @@ def
test_java_sdk_gradle_hooks_only_run_for_java_sdk_changes(
assert (hook in skipped_hooks) is hook_skipped
[email protected]("hook", ["check-java-sdk-serialization-conformance",
"sync-java-sdk-dag-schema"])
@pytest.mark.parametrize(
("files", "hook_skipped"),
[
@@ -2086,7 +2093,9 @@ def
test_java_sdk_gradle_hooks_only_run_for_java_sdk_changes(
),
],
)
-def test_java_sdk_conformance_hook_runs_for_serializer_changes(files:
tuple[str, ...], hook_skipped: bool):
+def test_java_sdk_conformance_hook_runs_for_serializer_changes(
+ files: tuple[str, ...], hook_skipped: bool, hook: str
+):
stderr = SelectiveChecks(
files=files,
commit_ref=NEUTRAL_COMMIT,
@@ -2095,7 +2104,20 @@ def
test_java_sdk_conformance_hook_runs_for_serializer_changes(files: tuple[str,
default_branch="main",
)
skipped_hooks =
get_outputs_from_stderr(str(stderr))["skip-prek-hooks"].split(",")
- assert ("check-java-sdk-serialization-conformance" in skipped_hooks) is
hook_skipped
+ assert (hook in skipped_hooks) is hook_skipped
+
+
+def test_spotless_skipped_when_only_airflow_serializer_changes():
+ # Changing serialized_objects.py runs the conformance check and the Dag
schema sync, but
+ # spotless only formats java-sdk/ files, so it is skipped.
+ stderr = SelectiveChecks(
+
files=("airflow-core/src/airflow/serialization/serialized_objects.py",),
+ commit_ref=NEUTRAL_COMMIT,
+ github_event=GithubEvents.PULL_REQUEST,
+ pr_labels=tuple(),
+ default_branch="main",
+ )
+ assert "spotless" in
get_outputs_from_stderr(str(stderr))["skip-prek-hooks"].split(",")
@pytest.mark.parametrize(
@@ -3062,7 +3084,7 @@ def test_expected_output_fork_push(
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
"upgrade-to-newer-dependencies": "false",
"core-test-types-list-as-strings-in-json": json.dumps(
@@ -3103,7 +3125,7 @@ def test_expected_output_fork_push(
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
"run-kubernetes-tests": "true",
"upgrade-to-newer-dependencies": "false",
@@ -3149,7 +3171,7 @@ def test_expected_output_fork_push(
"mypy-shared-module_loading,mypy-shared-observability,mypy-shared-plugins_manager,"
"mypy-shared-providers_discovery,mypy-shared-secrets_backend,mypy-shared-secrets_masker,"
"mypy-shared-serialization,mypy-shared-state,mypy-shared-template_rendering,mypy-shared-timezones,mypy-task-sdk,mypy-task-sdk-integration-tests,"
-
"regenerate-java-sdk-verification-metadata,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
+
"regenerate-java-sdk-verification-metadata,spotless,sync-java-sdk-dag-schema,ts-compile-lint-simple-auth-manager-ui,ts-compile-lint-ui"
),
"run-kubernetes-tests": "false",
"upgrade-to-newer-dependencies": "false",