shahar1 commented on code in PR #76282:
URL: https://github.com/apache/airflow/pull/76282#discussion_r4455257618


##########
dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py:
##########
@@ -134,17 +134,25 @@
 # can have done project CI work and are worth listing jobs for.
 SUSPICIOUS_RUN_DURATION = timedelta(minutes=5)
 GATE_MAX_DURATION = timedelta(minutes=5)
-# Paths whose content defines what fork CI runs. A pull request changing them 
controls its own
-# fork CI result, so a green fork run cannot be trusted for it.
+# Paths that decide the build-info outputs (which jobs run and on which 
runners): the workflows
+# and actions, the breeze sources whose selective checks compute those 
outputs, the files that
+# install breeze, and scripts/ci/prek/, which holds the script selective 
checks runs to generate
+# the gitignored generated/provider_dependencies.json. That script runs with 
its directory first on
+# sys.path, so any module added there, such as a `yaml.py`, would run too. A 
pull request changing them controls its own fork CI result and could

Review Comment:
   **nit — line length.** This line is about 150 characters; 
`dev/breeze/pyproject.toml` sets `line-length = 110` and only the `E501` ignore 
lets it through. Reflow the comment block.



##########
dev/breeze/src/airflow_breeze/utils/fork_ci_messages.py:
##########
@@ -155,9 +155,9 @@ def _setup_instructions(fork: str) -> str:
     "green": "**Fork CI: green.** CI for the latest commit passed in your 
fork. The pull request is "
     "ready for maintainer review.",
     "green_unverified": "**Fork CI: green, needs a maintainer.** CI for the 
latest commit passed in your "
-    "fork, but this pull request changes files that define what CI runs (such 
as `.github/`, "
-    "`dev/breeze/` or `scripts/ci/`), and the fork run used those changed 
files. A maintainer will "
-    "review the change and run project CI for it; the pull request stays a 
draft until then.",
+    "fork, but this pull request changes files that decide which CI jobs run 
and where (`.github/`, "
+    "the breeze sources or the breeze installation), and the fork run used 
those changed files. A "

Review Comment:
   **nit — message omits `scripts/ci/prek/`.** `CI_DEFINING_PREFIXES` also 
holds `scripts/ci/prek/`, so a contributor whose only CI-defining change is 
there is told about `.github/`, the breeze sources and the breeze installation 
and will not see why the pull request is held. The ADR 0020 sentence this PR 
edits has the same gap. Suggest naming `scripts/ci/prek/` in both.



##########
dev/breeze/src/airflow_breeze/utils/fork_ci_messages.py:
##########
@@ -275,22 +275,40 @@ def _sanitize_path(path: str) -> str:
     return "".join(char if char.isprintable() and char != "`" else "?" for 
char in path)
 
 
-def ci_change_approval_comment(*, ci_files: list[str]) -> str:
+def build_ci_file_list(ci_files: list[str]) -> str:
     listed = [f"- `{_sanitize_path(path)}`" for path in 
ci_files[:MAX_LISTED_CI_FILES]]
     if len(ci_files) > MAX_LISTED_CI_FILES:
         listed.append(f"- and {len(ci_files) - MAX_LISTED_CI_FILES} more")
+    return "\n".join(listed)
+
+
+def ci_change_approval_comment(*, ci_files: list[str]) -> str:
     return (
         f"{CI_CHANGE_MARKER}\n\n"
         "**Your CI change needs a maintainer.** CI for this pull request runs 
in your fork, and the "
         "workflow runs it starts in apache/airflow are approved automatically 
while they only run the "
         "fork CI gate. This pull request changes files that define what CI 
runs:\n\n"
-        + "\n".join(listed)
+        + build_ci_file_list(ci_files)
         + "\n\nSuch a change can make project CI run on the project's runners, 
so its workflow runs in "
         "apache/airflow wait for a maintainer to review the change and approve 
them. CI in your fork "
         "is not affected, and its result stays visible on this pull request. " 
+ WHY_FORK_CI + FOOTER
     )
 
 
+CI_MODIFICATION_MARKER = "<!-- workflow-approval: ci-modification -->"
+
+
+def ci_modification_note_comment(*, ci_files: list[str]) -> str:
+    return (
+        f"{CI_MODIFICATION_MARKER}\n\n"
+        "**This pull request changes CI files.** It changes files that CI 
uses:\n\n"
+        + build_ci_file_list(ci_files)
+        + "\n\nThey do not decide which CI jobs run or on which runners, so 
its workflow runs are not "

Review Comment:
   **minor — the note is the only signal that a trusted green fork run executed 
the changed CI scripts.**
   
   I checked the approval side and agree it holds: every path dropped from 
`CI_DEFINING_PREFIXES` (`Dockerfile*`, `scripts/docker/`, 
`scripts/in_container/`, `dev/**/*.py`) is in 
`FileGroupForCi.ENVIRONMENT_FILES`, so a non-gated fork PR touching them still 
fails auto-approval with "it needs the full set of tests", and a gated one only 
runs the gate.
   
   The fork-CI trust side is the deliberate weakening: a gated PR that edits 
`scripts/in_container/run_ci_tests.sh` or `scripts/ci/testing/*.sh` now reaches 
`green`, gets `CI passed` and `ready for maintainer review`, although the fork 
run executed those edited scripts. This note comment is the only hint, and it 
is posted by the approval workflow, not next to the fork CI status.
   
   Suggestion: pass whether the PR is gated into `ci_modification_note_comment` 
(known in the `if` branch of `decide_for_pull_request`) and add one sentence 
for gated PRs, e.g. "CI for this pull request runs in your fork and executed 
these changed files; a maintainer will check them before trusting the result." 
Then a maintainer merging from the `ready for maintainer review` list knows 
where the green came from.



-- 
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