spark-test commented on code in PR #60305:
URL: https://github.com/apache/spark/pull/60305#discussion_r4531769492


##########
.github/workflows/update_build_status.js:
##########
@@ -282,23 +342,28 @@ module.exports = async ({github, context, core, env = 
process.env, log = console
           count.unchanged++
           continue
         }
+        // The fork run was rerun after its check completed. GitHub accepts an 
update
+        // that reopens a completed check but leaves it unchanged, so create a 
new
+        // check instead. It hides this one, since the PR query reads only the 
latest
+        // Build check in a suite.
+        if (cr.status == 'completed' && state.status != 'completed') {

Review Comment:
   **Non-blocking (P2):** This creates a new Build check for every listed 
completed check whose fork run is pending again, and counts on the new check 
hiding the old one ("It hides this one" above). Nothing in the request makes 
that happen: `checks.create` can't name a check suite, and the PR query keeps 
the latest Build check per suite (`checkType: LATEST`). Whenever the completed 
check is still listed on the next pass, this branch fires again. From reading 
the code, the PR then gets another Build check for the same run on every pass 
until the rerun finishes (about six an hour for a PR updated in the last 3 
days). Each one is logged as an ordinary `rerun -> in_progress` create with no 
warning, and the old result stays visible.
   
   Two cases leave the completed check listed:
   
   - The head commit has more than one listed Build check linked to the run. 
This loop supports that (lines 314-316), and the removed notify workflow 
produced it by creating one on opened, reopened, and synchronize. One pass then 
sends an identical create per old check, and identical requests can't each 
replace a different suite's latest check.
   - GitHub files the new check in another GitHub Actions suite of the commit. 
The removed notify and labeler workflows both noted that such a check "randomly 
picks any associated workflow", and commits that ran more than one of their 
runs still carry those suites.
   
   After one such rerun the commit keeps two linked checks for the run, so the 
next rerun starts with two creates in one pass. If each create opened a new 
suite, the PR would soon exceed the 10 Build-bearing suites the query reads, 
and `toPR` would fail it on every pass (lines 161-165).
   
   The backfill below creates only when no listed check already serves a run. 
This branch could do the same: skip the create while a listed check linked to 
the same run is not completed, or once this pass has already created one for 
that run.
   
   **Verification:**
   - **Regression:** With mocked GitHub clients, run a pass over a PR whose 
head commit lists two completed Build checks linked to the same fork run while 
that run is in progress. The pass makes exactly one check creation, linked to 
the run in its current state, and updates neither completed check.
   - **Regression:** Run a pass whose listing holds, in either order, a 
completed Build check and a queued or in-progress Build check, both linked to 
the same in-progress fork run. The pass creates no check and writes nothing to 
the completed check. It updates the pending check only when that check's state 
differs from the run's.
   - **Behavior:** Run a pass whose only listed Build check is completed and 
linked to a fork run that is queued or in progress again. The pass creates one 
Build check linked to that run in the run's current state, logs it as a rerun, 
and leaves the completed check unchanged.
   - **Compatibility:** The update and backfill paths keep the behavior this PR 
gives them. A linked check whose state differs from its run's is updated with 
the run link. A PR with no syncable Build check still gets one created from the 
PR branch's build run, or action_required guidance. Checks already in sync 
receive no write.
   - **Inspection:** The comment above the rerun branch no longer claims that 
the new check always hides the completed one, and it states that each run gets 
at most one rerun check per pass.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to