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


##########
.github/workflows/update_build_status.js:
##########
@@ -72,9 +77,7 @@ module.exports = async ({github, context, core, env = 
process.env, log = console
             statusCheckRollup {
               commit {
                 oid
-                checkSuites(first: 10, filterBy: {
-                  appId: $appId, checkName: "${BUILD_CHECK_NAME}"
-                }) {
+                checkSuites(first: ${BUILD_CHECK_SUITE_PAGE}, filterBy: 
{appId: $appId}) {

Review Comment:
   **Non-blocking (P2):** Raising the page to 100 covers the commits the 
earlier comment walked through, but the mechanism remains: this listing counts 
every GitHub Actions suite on the head commit, `toPR` still throws on 
`hasNextPage` (lines 164-167), and 100 is GitHub's maximum page, so there is no 
larger limit to raise.
   
   By the repository's workflow schedules, `labeler.yml` (cron `7-59/10`) and 
`update_build_status.yml` (cron `*/10`) alone add 12 suites an hour to the 
default branch's head commit, so a master commit that stays the head for about 
8.4 hours carries more than 100. By commit times, 7 master commits did so in 
the month before this PR's base commit. Take an open PR whose head commit is 
such a commit, for example a fork branch at that commit opened against 
`branch-4.x`. On the base branch the `checkName`-filtered listing returns only 
suites holding a Build check, so the PR gets its run-linked Build check or 
`action_required` guidance and then syncs. With this change the listing returns 
100 suites and a next page, so the PR is logged as failed on every pass that 
covers it: each quick sync while it was updated in the last 3 days, and every 
4-hourly full sync while it stays open. It never gets a Build check, and the 
log's advice to raise the limits in `prPageQuery` cannot help.
   
   Other PRs still sync, and no wrong check state is written. That each 
workflow run adds a suite this listing counts rests on GitHub's behavior as the 
PR description states it, which the repository cannot show.
   
   This extends an [existing 
discussion](https://github.com/apache/spark/pull/60467#discussion_r4571597689).
   
   **Recommended change:** Keep this PR's appId-only listing of the head 
commit's suites, and add back, as a second aliased connection on 
statusCheckRollup.commit in prPageQuery, the base branch's checkName-filtered 
listing (filterBy appId plus checkName "Build", first: 10) with the same nested 
selection of each suite's latest check run named Build. In toPR, read the 
suites from the appId-only listing when it reports no next page, otherwise from 
the checkName-filtered listing when that one reports no next page, and throw 
the existing overflow error only when both report a next page or a selected 
suite's Build check page overflows. Restore the comment on the databaseId Map 
saying the checkName-filtered listing can repeat a suite, update the comment 
above BUILD_CHECK_SUITE_PAGE, and rewrite the header paragraph to say which 
listing is used when and that the oldest-first argument concerns the fork-side 
listing. The fallback is the listing the base branch used (old lines 75-77), 
which th
 e PR's first commit, 631cbb0a413, replaced; the follow-up commit, c7d79661fce, 
raised the page to 100 instead, and the PR description declines the fallback as 
more code that brings back the filter behind the repeated rows.
   
   **Why this works:** The two listings fail on different inputs. The 
checkName-filtered listing counts only suites holding a check run named Build, 
so suites of unrelated workflow runs cannot fill it, but it repeats a suite 
once per historical Build check run. The appId-only listing lists each suite 
once but counts every Actions suite. A listing that reports no next page holds 
every suite that can carry a Build check, and the databaseId Map drops repeats, 
so syncing from whichever listing is complete gives every PR the base branch 
synced its Build checks again, keeps this PR's fix for repeated rows, and still 
fails a PR loudly when neither listing is complete.
   
   **Scope:** One script change: prPageQuery lists the head commit's suites 
both ways in the same page query, toPR syncs from the listing that is complete, 
and the header and constant comments describe the two listings.
   
   **Compatibility:** Fork PRs on new commits, whose head commit carries a 
single Actions suite in apache/spark, keep this PR's behavior: the appId-only 
listing is complete and supplies their Build checks, so the fix for repeated 
checkName rows stays intact.
   
   **Risks:** Each page query requests one more suite listing per PR, about 275 
more connection requests or roughly 3 more points by GitHub's documented 
formula, on top of the cost the open question about the page's GraphQL point 
cost asks about; recheck the header's estimate of about 3 seconds per page of 
25 PRs against GitHub's 10-second limit. The fallback relies on GitHub's 
checkName filter behaving as the PR description describes, the same behavior 
the base branch relied on; if that changes, a head commit with more than 100 
Actions suites fails loudly again rather than syncing from partial data. 
Reverting the repair restores this PR's single-listing behavior on the next 
pass, since Build checks keep the same name, states, and output.
   
   **Constraints:** When neither listing is complete, the PR must still fail 
with the existing overflow error and be named among the pass's failed PRs 
rather than be synced from partial data. Both listings must keep the same 
nested selection of each suite's latest check run named Build, so either one 
yields the same Build checks for the suites it lists. The fork-side listing of 
the fork's workflow runs and its truncation handling stay unchanged.
   
   **Exclusions:**
   - A head commit on which the appId-only listing has more suites than its 
page and the checkName-filtered listing more than 10 rows still fails loudly; 
paging through such commits with a cursor is left out.
   - The page size and the page query's GraphQL point cost are left to the 
separate question about measuring that cost.
   
   **Success:** A PR whose head commit carries more GitHub Actions suites than 
BUILD_CHECK_SUITE_PAGE, while the suites holding its Build checks fit one 
checkName-filtered page, is synced or given action_required guidance as on the 
base branch, with no overflow error. A PR whose single suite holds many 
historical Build check runs, as on #60293, is still synced once from that 
suite's latest Build check. A PR fails with the existing overflow error only 
when both listings report a next page or a selected suite's Build check page 
overflows, and the other PRs on the page still sync. Each Build check is 
processed once even when the checkName-filtered listing repeats its suite.
   
   **Verification:**
   - **Regression:** Given a page response in which the head commit's 
appId-only listing returns a full page of suites and reports a next page, while 
the checkName-filtered listing returns one suite with one latest Build check 
and no next page, the PR is synced from that Build check and is not counted as 
a failed PR.
   - **Behavior:** Given a page response in which the checkName-filtered 
listing returns ten copies of one suite and reports a next page, while the 
appId-only listing returns that suite once with no next page, the PR is synced 
once from its single latest Build check.
   - **Behavior:** Given a page response in which both listings report a next 
page, the PR fails with the existing overflow error and is named in the pass's 
failure summary, while the other PRs on the page still sync.
   - **Compatibility:** A read-only run of the repaired script against open 
apache/spark PRs selects the same Build checks as the base branch's script for 
every PR the base branch synced, also syncs the PRs whose checkName-filtered 
listing overflowed, and completes each page query within GitHub's 10-second 
limit.
   - **Inspection:** The header comment says which listing toPR reads when, 
describes the repetition as once per historical Build check run in a suite, and 
attributes the oldest-first argument to the fork-side listing, and the comment 
on the databaseId Map says the checkName-filtered listing can repeat a suite.



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