gengliangwang opened a new pull request, #60371: URL: https://github.com/apache/spark/pull/60371
### What changes were proposed in this pull request? `dev/merge_spark_pr.py` now reads an open PR again while GitHub reports its `mergeable` as `null`, up to 5 times, 2 seconds apart (`MERGEABLE_RETRIES`, `MERGEABLE_RETRY_SECONDS`), before it decides whether to ask "Continue? (experts only!)". It prints "Waiting for GitHub to check whether pull request N is mergeable..." while it waits. The new `mergeable_warning` returns the warning to confirm, or `None`: | `mergeable` | Warning | |---|---| | `true` | None, as before | | `false` | "Pull request N is not mergeable in its current form.", as before | | still `null` after the re-reads | "GitHub is still checking whether pull request N is mergeable." | A closed PR is not read again. GitHub does not compute `mergeable` for a closed PR, which always reads as `null` with `mergeable_state: unknown`, so it keeps the "not mergeable" warning, as before. ### Why are the changes needed? GitHub computes whether a PR is mergeable in a background job. Until the job is done, e.g. right after a push to the PR or to its base branch, it reports `mergeable` as `null` and asks the client to resubmit the request later ([Get a pull request](https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request)). The script read `mergeable` once and took `null` for a conflict, since `bool(None)` is `False`. Right after a push to master, merging #59961 stopped at ``` Pull request 59961 is not mergeable in its current form. Continue? (experts only!) ``` although GitHub reported it as `mergeable: true` and `mergeable_state: clean` a little later, and running the script again merged it. A push to master makes GitHub compute `mergeable` again for the open PRs against master, so a committer who merges several PRs in a row is likely to hit this. ### Does this PR introduce _any_ user-facing change? No. Only `dev/merge_spark_pr.py`, the merge tool for committers, changes: while GitHub is still computing whether an open PR is mergeable, it waits instead of warning that the PR is not mergeable. ### How was this patch tested? - New doctests for `mergeable_warning`: - A PR that GitHub has checked, with `true` or `false`, is not read again. - An open PR that reads as `null` is read again until GitHub reports `true` or `false`. After 5 re-reads that are all `null`, it warns that GitHub is still checking. - A closed PR that reads as `null` is not read again. Without the re-reads (`MERGEABLE_RETRIES = 0`), 3 of them fail, and re-reading closed PRs too makes the closed PR one fail. All doctests of the script pass, 440 of them (432 before this change): ``` python3 -c 'import doctest, sys; sys.path.insert(0, "dev"); import merge_spark_pr; print(doctest.testmod(merge_spark_pr))' ``` - Against GitHub, after a push to master: the least recently updated open PRs, #57526 and #57198, first read as `mergeable: null` with `mergeable_state: unknown`, so the script would have warned that they were not mergeable. `mergeable_warning` read each of them again after 2 seconds, got `true`, and returned no warning. - `ruff check` and `ruff format --check` with ruff 0.14.8. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5) This pull request and its description were written by Isaac. -- 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]
