This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch fork-ci-test-merge-commit
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 557a631a279403ee94783f793283a7fbfcfcb197
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Nov 16 02:10:31 2026 +0900

    Withhold CI passed when a fork run's merge does not check out
    
    A run that reported a merge tested that merge, not the head commit as
    it is, so comparing the head commit's own base could report CI passed
    for code no job ran, such as a pull request to a stable branch whose
    fork run merged with the test branch.
    
    Generated-by: Claude Opus 5
    Claude-Session: https://claude.ai/code/session_01NyQq9U7i5HhjDgrQ9qd3gq
---
 .../doc/ci/08_fork_ci_for_external_contributors.md | 16 +++++++++----
 .../src/airflow_breeze/utils/fork_ci_reconcile.py  | 13 +++++-----
 dev/breeze/tests/test_fork_ci_reconcile.py         | 28 +++++++---------------
 3 files changed, 27 insertions(+), 30 deletions(-)

diff --git a/dev/breeze/doc/ci/08_fork_ci_for_external_contributors.md 
b/dev/breeze/doc/ci/08_fork_ci_for_external_contributors.md
index a20b8ea264e..154d084e65a 100644
--- a/dev/breeze/doc/ci/08_fork_ci_for_external_contributors.md
+++ b/dev/breeze/doc/ci/08_fork_ci_for_external_contributors.md
@@ -1207,8 +1207,14 @@ The run's report is trusted as far as its green result 
is: both come from the wo
 commit, which a pull request changing CI-defining files is not trusted with in 
any case (see
 "Trusting a green fork run").
 
-A run that names no merge (the conflict check could not resolve one), or whose 
merge does not
-check out, is compared as a run of the head commit as it is, as before merging 
was added:
+A run whose named merge does not check out, for example a pull request to a 
stable branch, whose
+fork run merges with the test branch that shares its defaults, gets no `CI 
passed`: its jobs tested
+that merge, so neither it nor the head commit as it is says what the merged 
result would do. As for
+a compare that fails, the pull request is listed for Slack, and a maintainer 
can run project CI for
+it with `use project ci`.
+
+A run that names no merge, because the conflict check could not resolve one, 
tested the head commit
+as it is and is compared as such:
 
 - `GET /repos/apache/airflow/compare/<base>...<fork-owner>:<sha>` gives the 
merge base, the commit
   of the base branch the fork run tested on top of (`sha`), the commits the 
base branch has since
@@ -1494,9 +1500,9 @@ as a failed check rather than a crash.
   signals hold. Keeping `use project ci` on such a pull request is the 
intended handling.
 - A fork run merges with the target branch that breeze's default branch at the 
pushed commit names
   (`main`, or the release branch it was cut from), since a push does not know 
which pull request it
-  is for. A pull request to another base branch is compared as a run of the 
head commit as it is
-  ("Tested base"). A run whose conflict check cannot fetch the target branch, 
or find the merge base
-  within 1,000 commits, also tests the head commit as it is.
+  is for. A pull request to another base branch gets no `CI passed` from fork 
CI ("Tested base") and
+  needs project CI. A run whose conflict check cannot fetch the target branch, 
or find the merge base
+  within 1,000 commits, tests the head commit as it is.
 - Every job of a fork run fetches the target branch commit and the merge base 
(two depth-1 fetches,
   some seconds each) to build the merge, about 55 jobs for a full-matrix run.
 
diff --git a/dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py 
b/dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py
index 37e7d10d25b..b4b96d7eb2e 100644
--- a/dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py
+++ b/dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py
@@ -2639,7 +2639,7 @@ def compare_tested_merge(
     if merge_base != tested.merge_base or status not in ("ahead", "identical"):
         console_print(
             f"[warning]#{pr.number}: the fork run's merge with 
{tested.base_sha} does not match GitHub "
-            f"(merge base {merge_base}, {pr.base_ref} {status}); comparing its 
head commit instead[/]"
+            f"(merge base {merge_base}, {pr.base_ref} {status})[/]"
         )
         return None
     return BaseCheck(tested.base_sha, behind, (), merged=True)
@@ -2655,8 +2655,9 @@ def compare_with_base(
     """
     Compare the base a fork run tested with the base branch; None when not 
readable.
 
-    A fork run that reports the merge it tested is checked with 
``compare_tested_merge``. Otherwise
-    it tested the head commit, so its base is the merge base with the base 
branch. Two
+    A fork run that reports the merge it tested is checked with 
``compare_tested_merge``, and gets
+    None when the merge does not hold. Otherwise it tested the head commit, so 
its base is the merge
+    base with the base branch. Two
     three-dot compares from it give the files the pull request changes and the 
files the base branch
     changed since; a file in both means the merged result differs from what 
the fork run tested
     in a file the pull request changes. Compares list at most 300 files (on 
their first page, which
@@ -2667,9 +2668,9 @@ def compare_with_base(
     """
     tested = find_tested_merge()
     if tested is not None:
-        merged = compare_tested_merge(client, repo, pr, tested)
-        if merged is not None:
-            return merged
+        # The jobs tested that merge, not the head commit as it is, so the 
head commit's own base
+        # says nothing about what was tested.
+        return compare_tested_merge(client, repo, pr, tested)
     owner = (pr.head_repo or "").split("/", 1)[0]
     base_ref = quote(pr.base_ref, safe="")
     try:
diff --git a/dev/breeze/tests/test_fork_ci_reconcile.py 
b/dev/breeze/tests/test_fork_ci_reconcile.py
index 1289264902e..507f7d83947 100644
--- a/dev/breeze/tests/test_fork_ci_reconcile.py
+++ b/dev/breeze/tests/test_fork_ci_reconcile.py
@@ -2988,36 +2988,26 @@ def _tested_base(status="ahead", ahead_by=7):
         ),
         pytest.param(
             TESTED._replace(base_ref="main"),
-            [_compare(5, _files("a.py")), _compare(0, _files("c.py"))],
-            BaseCheck(MERGE_BASE, 5, ()),
+            [],
+            None,
             id="merged-with-another-branch",
         ),
         pytest.param(
             TESTED,
-            [
-                _compare(0, [], merge_base="c" * 40),
-                _tested_base(),
-                _compare(5, _files("a.py")),
-                _compare(0, []),
-            ],
-            BaseCheck(MERGE_BASE, 5, ()),
+            [_compare(0, [], merge_base="c" * 40), _tested_base()],
+            None,
             id="other-merge-base",
         ),
         pytest.param(
             TESTED,
-            [
-                _compare(0, [], merge_base=TESTED_MERGE_BASE),
-                _tested_base("diverged"),
-                _compare(5, _files("a.py")),
-                _compare(0, []),
-            ],
-            BaseCheck(MERGE_BASE, 5, ()),
+            [_compare(0, [], merge_base=TESTED_MERGE_BASE), 
_tested_base("diverged")],
+            None,
             id="not-on-the-base-branch",
         ),
         pytest.param(
             TESTED,
-            [GitHubError("gh api failed: HTTP 500"), _compare(5, 
_files("a.py")), _compare(0, [])],
-            BaseCheck(MERGE_BASE, 5, ()),
+            [GitHubError("gh api failed: HTTP 500")],
+            None,
             id="merge-not-checkable",
         ),
     ],
@@ -3030,7 +3020,7 @@ def 
test_compare_with_base_checks_the_merge_the_fork_run_tested(client, tested,
     )
 
     assert check == expected
-    if expected.merged:
+    if expected is not None:
         assert [call.args[0] for call in client.rest_get.call_args_list] == [
             TESTED_HEAD_COMPARE,
             TESTED_BASE_COMPARE,

Reply via email to