potiuk commented on code in PR #77119:
URL: https://github.com/apache/airflow/pull/77119#discussion_r4758512472


##########
dev/breeze/src/airflow_breeze/utils/selective_checks.py:
##########
@@ -1790,8 +1793,8 @@ def ci_image_build(self) -> bool:
     @cached_property
     @_scoped_to_component_branch
     def run_generic_basic_tests(self) -> bool:
-        """The standalone Airflow test, which runs for every change."""
-        return True
+        """The standalone Airflow test, run alongside unit tests."""
+        return self.run_unit_tests and not self.only_text_non_doc_files_changed

Review Comment:
   **Packaging-only changes no longer run the standalone install test**
   
   `test-airflow-standalone` installs `airflow-core` from source and starts 
`airflow standalone`, so it is the check for `airflow-core/pyproject.toml`, 
`airflow-core/hatch_build.py` and `uv.lock` changes. None of those match 
`ALL_SOURCE_FILES`, so tying the job to `run_unit_tests` skips it on exactly 
the PRs it guards (unless `full_tests_needed` already covers them, in which 
case a test pinning that would help). Also run it when those packaging files 
change, and add a case to `test_selective_checks.py`.
   
   *Flagged by antigravity (adversarial review); cross-checked.*
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting



##########
dev/breeze/src/airflow_breeze/utils/selective_checks.py:
##########
@@ -1790,8 +1793,8 @@ def ci_image_build(self) -> bool:
     @cached_property
     @_scoped_to_component_branch
     def run_generic_basic_tests(self) -> bool:
-        """The standalone Airflow test, which runs for every change."""
-        return True
+        """The standalone Airflow test, run alongside unit tests."""
+        return self.run_unit_tests and not self.only_text_non_doc_files_changed

Review Comment:
   **Canary and full-test runs lose the standalone test on text-only changes**
   
   `run_unit_tests` is True for `full_tests_needed` and canary runs, but the 
new `and not self.only_text_non_doc_files_changed` still applies after it. A 
scheduled canary whose `main` tip only touched `.md`/`.txt` files, or a PR 
labelled `full tests needed` with only text changes, now skips 
`test-airflow-standalone`, although those runs exist to run everything. Return 
True for `full_tests_needed` / canary before the text-only check (e.g. `return 
self.full_tests_needed or (self.run_unit_tests and not 
self.only_text_non_doc_files_changed)`), with test cases for both.
   
   *Flagged by both the primary and adversarial reviewers.*
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting



##########
dev/breeze/src/airflow_breeze/utils/import_graph.py:
##########
@@ -153,7 +154,7 @@ def _extract_edges(
                 edges.update(_resolve_imported_name(imported, alias.name, 
modules))
         elif isinstance(node, ast.Constant) and isinstance(node.value, str):
             value = node.value
-            if value.startswith(".") and DOTTED_NAME.match("x" + value):
+            if value.startswith(".") and RELATIVE_DOTTED_NAME.match(value):
                 level = len(value) - len(value.lstrip("."))
                 base = ".".join(package.split(".")[: len(package.split(".")) - 
level + 1])

Review Comment:
   **Too many leading dots resolve to a made-up module**
   
   `RELATIVE_DOTTED_NAME` now accepts any number of leading dots, so a string 
such as `"....foo"` in `airflow.models` gives a negative slice end and resolves 
to `airflow.foo` instead of being ignored. Skip the value when `level > 
len(package.split('.'))`.
   
   *Flagged by antigravity (adversarial review); cross-checked.*
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting



##########
dev/breeze/src/airflow_breeze/utils/selective_checks.py:
##########
@@ -2741,6 +2744,25 @@ def _is_self_hosted_label_approved(self) -> bool:
     def has_migrations(self) -> bool:
         return any([file.startswith("airflow-core/src/airflow/migrations/") 
for file in self._files])
 
+    @cached_property
+    def has_added_or_renamed_files(self) -> bool:
+        if self._commit_ref is None:
+            return True
+        base: str
+        if self._fork_push:
+            if self._fork_changes_truncated or not self._fork_merge_base:
+                return True
+            base = self._fork_merge_base
+        elif self._selective_tests_on_push and self._github_event == 
GithubEvents.PUSH:
+            if not self._push_base_commit:
+                return True
+            base = self._push_base_commit
+        else:
+            base = f"{self._commit_ref}^"
+        cmd = ["git", "diff", "--name-only", "--diff-filter=A", 
"--no-renames", base, self._commit_ref]
+        result = run_command(cmd, check=False, capture_output=True, text=True)

Review Comment:
   **`git diff` runs in the current directory**
   
   Every other `git` call in `SelectiveChecks` passes `cwd=AIRFLOW_ROOT_PATH`; 
this one does not, so `breeze ci selective-check` (or `breeze verify`) started 
from another directory diffs the wrong repository, or fails and falls back to 
True. Pass `cwd=AIRFLOW_ROOT_PATH`.
   
   *Flagged by antigravity (adversarial review); cross-checked.*
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting



##########
devel-common/src/tests_common/pytest_plugin.py:
##########
@@ -890,23 +890,44 @@ def _is_db_test(item) -> bool:
     return False
 
 
+def _is_distributed_run(config) -> bool:
+    return (
+        getattr(config.option, "dist", "no") != "no"
+        or bool(getattr(config.option, "numprocesses", None))
+        or hasattr(config, "workerinput")
+    )
+
+
 def pytest_collection_modifyitems(config, items):
-    """Deselect DB/non-DB tests early so pytest-xdist workers never receive 
them.
+    """Deselect DB/non-DB tests, and quarantined/long-running/system tests 
during distributed runs.
 
-    Previously these tests were skipped at runtime via pytest_runtest_setup, 
which
-    still required every xdist worker to import the test modules. With 
thousands of
-    DB tests being skipped in non-DB runs, this caused excessive memory usage 
— enough
-    to OOM on Python 3.14 CI runners. Deselecting during collection avoids 
distributing
-    these items to workers entirely.
+    Deselecting early prevents pytest-xdist workers from importing test 
modules that will not
+    be executed, avoiding worker memory bloat on CI runners. During 
non-distributed runs,
+    quarantined, long-running, and system tests remain selected so 
pytest_runtest_setup can
+    report actionable skip reasons to developers.
     """
-    if not skip_db_tests and not run_db_tests_only:
-        return
+    include_quarantined = getattr(config.option, "include_quarantined", False)
+    include_long_running = getattr(config.option, "include_long_running", 
False)
+    system = getattr(config.option, "system", False)
+    is_distributed = _is_distributed_run(config)
 
     selected = []
     deselected = []
     for item in items:
         is_db = _is_db_test(item)
-        if (skip_db_tests and is_db) or (run_db_tests_only and not is_db):
+        should_deselect = (

Review Comment:
   **Deselecting everything under xdist makes pytest exit 5**
   
   Under xdist, a selection made only of quarantined, long-running or system 
tests is now fully deselected, and pytest exits with 5 (no tests collected) 
instead of 0 with skips. Breeze turns 5 into success only for 
`run_db_tests_only` (`testing_commands.py`), so such a slice now fails. Treat 
exit code 5 as success when the run deselected items (or keep at least the skip 
path for that case), and add a test.
   
   *Flagged by antigravity (adversarial review); cross-checked.*
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to