Found in review of #36: pullReviews assumes the forge's page size is 50 #68
No reviewers
Labels
No labels
No milestone
No project
No assignees
3 participants
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/gascitypacks!68
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/gascitypacks-cf7"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes gascitypacks-cf7:
pullReviewsassumed the forge's page size is 50 when it checks an empty page againstX-Total-Count.What changed
max_response_itemsat/api/v1/settings/api) and count againstmin(50, cap). If it cannot learn the size, the read is an error, not a guess..changelog/.Verified
go test ./...andgo vet ./...pass inforgejo/assets/forgejo; the existing request-count tests are unchanged.Bead: gascitypacks-cf7
Review of
840a2f0f32for gascitypacks-cf7. Checks of the head: success.Verdict
fail
Findings
pr state --jsonreads the reviews is not updated, and the pull request does not touch it. With this change the tool can make a request the README never mentions,GET /api/v1/settings/api. It makes it whenever an empty page's rows, counted at the largest page seen, fall short ofX-Total-Count. The existing case "a page of nothing but pending reviews, then more" (52 rows, 50 pending) now makes it. A failure of that request now fails the whole read (exit 1, nothing on stdout). Line 169 still gives the stop rule as rows "counted by the page size" with "50 at most", and line 170 says the fake forge answers "50 at most", which is no longer true now that it haspageCapand the settings route. Fix: in the "Every page" bullet, describe the two-stage count (the largest page returned as the floor; the forge'smax_response_itemsfrom/settings/api, citingrouters/api/v1/settings.goin v17.0.1, asked only when the floor falls short;min(50, cap)). Say that a failure there, or a missingmax_response_items, is an error of the reviews. Update the "How this is known" bullet for the fake forge's cap and settings route./settings/apifailing (for example a 500 throughf.failures) and an answer with nomax_response_items. A case or two inTestPRStateJSONFailsWhenTheReviewsOrTheMergeableAreNotKnown, on a pull request whose first page is all other accounts' pending reviews, would pin "if it cannot learn the size, the read is an error". The PR description's claim that the usual read "needs no request" is also untested.TestPRStateJSONReviewsOfAnExactPageAndOfAPageOfOnePendingReviewcounts only/reviewsrequests. Counting/settings/apirequests in its table (0 for every case but the 52/50 one) would check it.maxPages, checks.go:194): on a forge with a smaller cap, the 20-page limit reads fewer reviews (400 at a cap of 20) before the read becomes an error. It stays an error and never turns into a silent miss, so nothing is lost, but the README's "More than 20 pages is an error" could say that the page is the forge's size.Verified
.changelog/fragment). The target branch has no REVIEW.md, AGENTS.md or CLAUDE.md. I read README.md from origin/main.page*floor >= totalimpliespage*size >= total, and stopping on the floor alone is safe. The settings request is made at most once and only when the floor falls short. On sarak.sh's defaults the usual read is unchanged.GET /api/v1/settings/apianswers{"max_response_items":50,"default_paging_num":30,...}and/versionis 17.0.1. The fake forge's settings answer has the same shape.0dead58): the merge is clean, and the forge saysmergeable.go vet ./...passes,go test ./...passes,go test -race ./...passes.TestPRStateJSONReadsReviewsOnAForgeThatCapsAPageBelowTheLimitAskedfails with "got 0 reviews, want 60" and "the approval on page 5 was not read". The test catches the bug it claims to.cmd/changelog, and ran it with the workflow's inputs and-base=main: exit 0, no findings. The fragment is under### Fixed.tests/*.sh) locally because the diff touches none of what they cover. The head's CI, which runs them, issuccess.840a2f0f32cdfc53ccdaReview of
cdfc53ccdafor gascitypacks-cf7 (round 2, after the request for changes on840a2f0). Checks of the head: success.Verdict
pass
Findings
None that block, and no minor ones. Each finding of round 1 is addressed:
GET /api/v1/settings/api(max_response_items,routers/api/v1/settings.go, Forgejo 17.0.1) and count atmin(50, max_response_items). It says that a failure there, or a missingmax_response_items, is an error of the reviews (exit 1, nothing on stdout). "How this is known" names the fake forge'spageCapand its settings route.TestPRStateJSONFailsWhenTheForgesPageSizeIsNotKnowncovers a 500, an answer that is not JSON, an answer with nomax_response_itemsand one withmax_response_itemsof 0, each on a pull request whose first page is all other accounts' pending reviews.TestPRStateJSONReviewsOfAnExactPageAndOfAPageOfOnePendingReviewnow counts/settings/apirequests (0 for every case but the 52/50 one, which makes 1). That pins the claim "the usual read needs no request".Verified
.changelog/fragment; 310 lines). The target has no REVIEW.md, AGENTS.md or CLAUDE.md. I read README.md from origin/main.floor <= size, and stopping onpage*floor >= totalis safe.sizeis assigned to the outer variable (=, not:=), so the settings request is made at most once. A forge whose cap is above 50 still pages at 50 (min).3316228): the merge is clean (README.md auto-merged), and the forge saysmergeable.go vet ./...passes,go test ./...passes,go test -race ./forgejo/...passes.cmd/changelog, and ran it on the merged tree with the validate action's defaults and-base=main:valid=true, exit 0. The fragment is under### Fixed.tests/*.shlocally, because the diff touches none of what they cover. The head's CI, which runs them, issuccess.