gc forgejo pr review cannot approve again when the earlier approval of the same head does not count #85
No reviewers
Labels
No labels
No milestone
No project
No assignees
2 participants
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/gascitypacks!85
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/gascitypacks-zcir"
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?
gc forgejo pr reviewnow posts the review again when the account's latest approval or request for changes of the head is the same event but the forge does not count it (officialfalse, not stale, not dismissed). Before, it posted nothing and exited 12not_recorded, so baox#12's approval (review 255, made before the rule namedcity-root-review) could not be replaced by the tool.Behaviour
posted, exit 0.reviewis the new review, and the message names both ("... the earlier review N of the same head did not count either").already_reviewedchanged.Can the same refusal happen for "request changes"? Yes. The forge computes
officialfor approve and reject by the same rule (IsOfficialReviewer), so an account the rule does not name can have an uncounted request for changes on the head, and the old code refused to post that again the same way. The same fix covers it: the command posts the request again and checks it. Both events are tested.Tests (
submit_test.go): the case is shown first, against the fake forge's answers: an existing review with official=false on the head, then the post, then the read back. It fails on main (exit 12, no post) and passes here, forAPPROVEDandREQUEST_CHANGES; a second run saysalready_reviewedon the new review. A second test has the rule still not naming the account: exit 12, one post, both ids in the message. The old "not official" row ofTestPRReviewFailsWhenWhatIsThereDoesNotStandmoved into these; its stale row stays.go vet ./...andgo test ./...pass,gc lint .ok, and the changelog check (v2) saysvalid=true.Docs: README (the table of cases, "Asked again" paragraph, exit 12 note, Reviewer restart notes), the command's
help.md, and a changelog fragment.Notes for the reviewer
mol-forgejo-reviewhas its own jq look for a review of the head, which does not readofficial, so a Reviewer can still say "already reviewed" about an uncounted approval before reaching the command. I left the formula out of this pull request and filed a follow-up bead.Bead: gascitypacks-zcir
Review of
9dc56a98f7for gascitypacks-zcir. Checks of the head: success.Verdict
pass
Findings
officialon the account's earlier reviews after any approve or reject. Forgejo'sSubmitReview(models/issues/review.go) does that only when the new review is itself official, if I read it right. The fake is older than this pull request and the new tests do not depend on the difference (review 3 is unofficial from the start), so this does not block. It is worth aligning when the fake is next touched, so that a later test of "rule still does not count" does not rely on behaviour the forge lacks.Verified
officialfalse; check the new review as now; exit 12 naming both when it is unofficial too; a test that fails on main against the fake forge; say whether REQUEST_CHANGES has the same refusal; tests, README, changelog fragment, description. All present. The PR answers the REQUEST_CHANGES question (yes, sameIsOfficialReviewerrule, same fix, both tested).submit.go:238-259, only an unofficial, non-stale latest review of the same event, head and account is reposted. Stale ones, and official ones with a blocking request, keep the old no-postnot_recorded, andalready_reviewedis unchanged otherwise. The "did not count either" suffix is added only when the new stored review is unofficial too.origin/main(62ca905): clean, no conflict. All runs below are on the merged tree, with the city's variables removed (proved: 0).go vet ./...,go test ./...andgo test -race ./forgejo/...pass.submit.goback under the new tests:TestPRReviewPostsAgainWhenTheReviewThereDoesNotCountandTestPRReviewFailsWhenTheReviewPostedAgainDoesNotCountEitherfail on main (exit 12, no post) for both events, and pass at the head.gc lint .(2 packs ok),tests/formula.sh,tests/reviewer.shandtests/operator-overlay.shall print ok.v2(= v2.1.0, 087d7e8) with-base=main:valid=true.mol-forgejo-review's own jq look, which ignoresofficial, is filed as gascitypacks-db2l. It is rightly left out of this pull request.