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


##########
dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py:
##########
@@ -894,14 +941,25 @@ def release(state: ForkState, comment: Callable[[Marker], 
str]) -> Plan:
       labels(first: 50) { nodes { name } }
       timelineItems(
         last: 100,
-        itemTypes: [CONVERT_TO_DRAFT_EVENT, UNLABELED_EVENT, REOPENED_EVENT, 
BASE_REF_CHANGED_EVENT]
+        itemTypes: [
+          CONVERT_TO_DRAFT_EVENT,
+          UNLABELED_EVENT,
+          REOPENED_EVENT,
+          BASE_REF_CHANGED_EVENT,
+          ISSUE_COMMENT,
+          PULL_REQUEST_REVIEW,
+          PULL_REQUEST_REVIEW_COMMENT

Review Comment:
   **the discovery query no longer validates**
   
   GitHub rejects this query. Running the same selection against apache/airflow 
returns `Argument 'itemTypes' on Field 'timelineItems' has an invalid value 
(... PULL_REQUEST_REVIEW_COMMENT). Expected type 
'[PullRequestTimelineItemsItemType!]'` and `Fragment on 
PullRequestReviewComment can't be spread inside PullRequestTimelineItems`. This 
selection is used by discovery before any pull request is reconciled, and 
`GitHubClient.graphql` raises on errors, so the monitor would stop reconciling 
every gated pull request. The unit tests mock the GraphQL response, so they 
pass. Inline review comments are reachable on the timeline as 
`PULL_REQUEST_REVIEW_THREAD` (or through each `PullRequestReview`'s 
`comments`), not as `PULL_REQUEST_REVIEW_COMMENT`. Whatever the fix, please run 
the query once against the real API (`gh api graphql -F query=@...`) before 
pushing.
   
   *Flagged by both the primary and adversarial reviewers.*



##########
dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py:
##########
@@ -236,7 +250,7 @@ class ForkState(str, Enum):
     GATE_MODIFIED = "gate_modified"
 
 
-CLOSABLE_STATES = frozenset({ForkState.SETUP_REQUIRED, 
ForkState.AWAITING_PUSH})
+CLOSABLE_STATES = frozenset({ForkState.SETUP_REQUIRED, 
ForkState.AWAITING_PUSH, ForkState.FAILED})

Review Comment:
   **two closure rules change under a hardening title**
   
   Two of these changes are policy rather than hardening: pull requests whose 
fork CI failed now close after 30 days, which the description does not mention, 
and a pull request whose head repository is deleted is closed instead of being 
reported, which the description words as if the reconciler already closed such 
pull requests. Both reverse rules the design document and ADIP-12 state 
(closure applies only while waiting for the author to set up fork CI or push; a 
deleted head repository is reported and otherwise left alone). Closing `failed` 
also covers an approved pull request whose re-run flaked, which the "failed 
does not draft" rule was written to protect. These need a maintainer decision, 
and the ADIP-12 page would change with them. Move the two closure changes into 
a pull request of their own with the reasoning in its description, so they can 
be discussed and decided on their own; keep the activity and attempt-ordering 
fixes here.



##########
dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py:
##########
@@ -894,14 +941,25 @@ def release(state: ForkState, comment: Callable[[Marker], 
str]) -> Plan:
       labels(first: 50) { nodes { name } }
       timelineItems(
         last: 100,

Review Comment:
   **comments now share the last-100 timeline window with the control events**
   
   The window is still `last: 100` and unpaginated, but it now also holds every 
comment and review. On a pull request with a busy conversation, the 
`BaseRefChangedEvent`, `ReopenedEvent` and `ConvertToDraftEvent` the reconciler 
depends on drop out of it. Losing a retarget means `last_base_change_at` stays 
unset, so a green decision and the gate check made for the old base are reused 
for the new one, and an author can force that by retargeting and posting enough 
comments. Losing a reopen makes the reconciler finish a closure the author 
already undid; losing the convert-to-draft actor makes a bot draft look like 
the author's. Read the latest human comment or review with a separate query (or 
`comments(last: 1)` / `reviews(last: 1)` on the pull request), and keep the 
control-event window as it was.
   
   *Flagged by both the primary and adversarial reviewers.*



##########
dev/breeze/src/airflow_breeze/utils/fork_ci_reconcile.py:
##########
@@ -625,6 +643,7 @@ def classify(
     jobs_reported: str | None = None,
     head_shared_across_bases: bool = False,
     find_gate_change: Callable[[], str | None] = lambda: None,
+    verify_head_repo_unavailable: Callable[[], bool] = lambda: True,

Review Comment:
   **the default closes pull requests**
   
   Any caller of `classify` that does not pass the check closes every pull 
request whose snapshot has `head_repo=None`, including the transient GraphQL 
case this change is meant to guard against. A default of `lambda: False` keeps 
an omitted check safe. Default to `lambda: False`.



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