nchammas opened a new pull request, #60305: URL: https://github.com/apache/spark/pull/60305
# [SPARK-61370][INFRA] Fix build status sync for reruns and updated checks ### What changes were proposed in this pull request? This PR fixes two bugs in `update_build_status.js`, the scheduled job that mirrors each fork build's state onto the PR's `Build` check. 1. **Updates now preserve the link to the fork run.** Each `Build` check stores the ID of the fork run it represents. The sync script uses that ID to match the check to the run. Previously, updating a check without resending its output caused GitHub to clear the ID, so a later sync could create a duplicate check. Updates now resend the output to preserve the ID. 2. **Reruns get a new check.** When a fork run is rerun after its `Build` check completed, the script tried to move the completed check back to queued or in progress. GitHub accepts that request but leaves the check completed. The script now creates a new check linked to the rerun. The PR query reads only the latest `Build` check in a suite (`checkType: LATEST`), so the new check replaces the old one. Other changes: - New helpers, `createCheck` and `runLink`, to factor out repeated code. - An update that GitHub does not apply now logs a warning that names the PR and the state change. Previously the job logged only a total count. ### Why are the changes needed? Because GitHub cleared `output.text`, every updated check lost its link to its fork run. The next pass could not match the check to a run, so it created a duplicate. In 20 consecutive passes, 40 of the 61 checks created were such duplicates, and several PRs collected two to four `Build` checks for the same commit. A rerun of a finished fork build also left the PR's check showing the old result. The job then warned `1 check update(s) did not reach the requested state. GitHub cannot reopen completed checks.` without naming the PR ([example run](https://github.com/apache/spark/actions/runs/42815117839/job/129826131418)). The rerun only showed up later as a side effect of the first bug, through a duplicate check. ### Does this PR introduce _any_ user-facing change? No. This changes only the CI build status shown on PRs. Reruns of a fork build now show their progress on the PR, and PRs no longer collect duplicate `Build` checks. ### How was this patch tested? Via an agent: I ran the script locally against mocked GraphQL and REST clients (a throwaway harness, not committed) with these cases: - A rerun of a completed check creates a new check linked to the run and does not update the old check or warn. - Updates (in progress to completed, queued to in progress) resend `output.text` with the run ID, plus the title, summary, and `details_url`. - An update that GitHub does not apply warns with the PR and the state change. - Regressions: missing checks are still created from the branch build; action_required guidance is still created when there is no run; checks already in sync are left alone. All cases pass with this change. On `master`, the rerun, output, and warning cases fail, and the regression cases pass. I also ran a full sync against the live open PRs with check writes stubbed out. It completed without errors or warnings. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: GitHub Copilot -- 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]
