Landing L6: gc forgejo pr review posts a review on a head and checks the forge recorded it #41

Merged
city-root merged 1 commit from worker/gascitypacks-zhy into main 2026-11-12 10:34:19 +00:00
Contributor

L6 of Landing (docs/handoffs.md, "What Landing needs"): gc forgejo pr review, which posts one review on one head of a pull request and checks the forge recorded it. Builds on pr state --json as #36 left it (08a754e).

What it does

gc forgejo pr review [--json] --repo <worktree> --pr <url|number> --expect-head <sha> --event <APPROVED|REQUEST_CHANGES> [--body-file <path>]
  • Posts {"event", "body", "commit_id": <expect-head>} as the account the token belongs to, and prints posted, or already_reviewed when the account's latest approval or request is this event on this head (nothing is posted); with --json, one object with schema_version, outcome, reason, state, head, account, event, review, lifted, forge_status, forge_message.
  • Refuses without posting, one exit status each: 3 head_moved, 4 not_open, 7 missing, 8 foreign (no request), 10 own_pull_request, 11 empty_body. A 422 from the forge is 9 rejected; 1 a failure, 2 a mistake in the command line.
  • After posting it reads the reviews back with the code of L3 and exits 12, outcome not_recorded, never a success, when the forge stored it otherwise: pending, a comment, another commit, stale, dismissed, not official, or an approval after which the account's earlier request still blocks.
  • Client rules of pr state hold: only the forge's own 404 is missing; a 5xx, a timeout, a bad token, or any other answer is exit 1 with nothing on stdout; a foreign --pr gets no request; the token goes to the forge's host only.
  • README section "Posting a review" (tables of cases, fields, exit statuses, what the forge does), CHANGELOG entry under [Unreleased], commands/pr/review/{run.sh,help.md}.

Question 7: does the same account's approval of a newer head lift its earlier "request changes"?

Yes, by itself; the command dismisses nothing. From Forgejo 17.0.1's source (tag v17.0.1, 363f3dc, read in a clean checkout), not tried on sarak.sh:

  • A request blocks while it is official and not dismissed, whatever its commit: models/issues/pull.go:923-939 (MergeBlockedByRejectedReview). A push does not end one: DismissApprovalReviews handles type approve only (services/pull/review.go:443-449, from services/pull/pull.go:395-408), so after the author's rework push the old request still blocks until the same account gives a new verdict.
  • A new approval or request clears official on every earlier review of the same account in the same transaction: UPDATE review SET official=false WHERE issue_id=? AND reviewer_id=? at models/issues/review.go:424 (fresh review) and :454 (from a pending one), for types approve and reject. CreatePullReview (routers/api/v1/repo/pull_review.go:432-554) goes through it (services/pull/review.go:384-440). So the earlier request stays listed as request_changes, official: false, and blocks nothing.
  • Who may dismiss: only a repository admin. dismissReview checks ctx.IsUserRepoAdmin() first (pull_review.go:1102-1105; routes routers/api/v1/api.go:1053-1054), the web form is behind reqRepoAdmin (routers/web/web.go:1451). So if the forge did keep the request blocking, the review account could dismiss it only if it is an admin, which the city's token cannot read.

So no dismissal is built. The command instead reports lifted (the ids of the account's requests that blocked before an approval and do not after), and if a request of the account is still official after the approval it exits 12 and says dismissing takes an admin, so a forge that differs from the source shows as a failure and not as a merge that waits for ever. The trial below is what settles it on sarak.sh.

How I checked it

  • go vet ./... and go test ./... (also -race) with GOPROXY=off: new tests on the fake forge for the success of both events, every refusal and its distinct exit status (the one table is shared with pr merge), the already-there rule (other event/head/account, dismissed, comment, pending, 60 reviews on 2 pages, a stored one that does not stand), each not_recorded case (pending, comment ×2, not official ×2, unlisted, stale by a push in between), the 422, every failure that must be exit 1 with no stdout (5xx, 404 from a proxy, 403, 201, garbage, a failed read back, bad or missing token, forge gone, no author), question 7 (request on one head, push, approval of the new head lifts it, nothing dismissed; and a forge that does not clear it), usage, foreign hosts, the token going to the forge alone. I broke the official check and the author check once each and the tests failed.
  • The fake forge gains GET /user and POST .../reviews, answering as the source cited does (own-pull 422, empty-body 422, official by the rule's whitelist, stale by commit, official cleared on the account's earlier reviews). One difference: the real forge decides stale by comparing diffs, the fake by commit.
  • The changelog check of CI's v1 action, built from its tag and run from the repo root: valid=true. gc lint . and tests/formula.sh pass.
  • Rebased onto origin/main (08a754e) right before the push; nothing of gascitypacks-8g8 was on it yet.
  • Not tried on sarak.sh, as the bead says: the city's account cannot review its own pull requests and I did not read the review account's token.

The trial, for the Operator

On a throwaway repository on sarak.sh that has the same rule as the real main (one approval needed from city-root-review, whitelisted; block on rejected reviews; the checks may be none), with a clone at $W, an author account A (the city's gascity-root) and the review account R. gc forgejo here is this branch's tool, e.g. go tool -C <this checkout>/forgejo forgejo with FORGEJO_URL=https://sarak.sh. $RT is R's token file, $AT A's; forgejo() { go tool -C <checkout>/forgejo forgejo "$@"; }.

cd $W && git switch -c trial && echo 1 >f && git add f && git commit -m one && git push -u origin trial
# as A: open the pull request
FORGEJO_TOKEN_FILE=$AT forgejo pr open --repo $W --title "trial" ; PR=<its url>; H1=$(git rev-parse HEAD)

# 1. own pull request: expect exit 10 own_pull_request, nothing posted
FORGEJO_TOKEN_FILE=$AT forgejo pr review --json --repo $W --pr $PR --expect-head $H1 --event APPROVED; echo $?
# 2. a request for changes with no body: expect exit 11 empty_body
FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H1 --event REQUEST_CHANGES; echo $?
# 3. a request with a body: expect exit 0 posted, review.official true
echo "fix it" >body.md
FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H1 --event REQUEST_CHANGES --body-file body.md
FORGEJO_TOKEN_FILE=$RT forgejo pr state --json --repo $W --pr $PR   # reviews[0] official true: blocks (README: "a blocking review stands")
# 4. again: expect exit 0 already_reviewed, no second review in `pr state`
FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H1 --event REQUEST_CHANGES --body-file body.md
# 5. rework push, as A
echo 2 >f && git commit -qam two && git push; H2=$(git rev-parse HEAD)
FORGEJO_TOKEN_FILE=$RT forgejo pr state --json --repo $W --pr $PR   # the request still official, not dismissed: a push ends only approvals
# 6. head moved: expect exit 3 head_moved
FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H1 --event APPROVED; echo $?
# 7. the approval of the new head: question 7
FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H2 --event APPROVED
FORGEJO_TOKEN_FILE=$RT forgejo pr state --json --repo $W --pr $PR
# 8. again: expect already_reviewed
FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H2 --event APPROVED

What each answer of step 7 means for question 7:

  • outcome posted, lifted [<id of the request>], and in pr state the request listed as request_changes, official: false, dismissed: false, with the approval official: true: the forge behaves as its source says. An approval of a newer head lifts the account's own request; L14 needs no dismissal step; this pull request stands as it is. With the checks green and a scheduled merge, the pull request merges (L12's trial).
  • Exit 12, stderr "an earlier request for changes of the account (review N) still blocks the merge, and dismissing it takes a repository admin": sarak.sh differs from the source: the request stays blocking after the approval. Then find who may dismiss: curl -sS -X POST -H "Authorization: token $(cat $RT)" -H 'Content-Type: application/json' -d '{"message":"superseded","priors":false}' https://sarak.sh/api/v1/repos/<o>/<r>/pulls/<n>/reviews/<id>/dismissals. 200 means the review account may dismiss its own request, and L6 gets a dismissal step before the approval (a follow-up bead, with this answer); 403 ("Must be repo admin") means it may not, and the Reviewer cannot clear its own request, and the user is asked how it is cleared (an admin account dismisses it, or the review account is made an admin); L14 waits for that.
  • Exit 12, stderr "does not count" (official: false on the approval itself): the review account is not on the rule's whitelist on this repository: that is L4's, not this command's.
  • Exit 12, "pending" or "stored it as comment": the forge did not take the event as a verdict; keep the output and stop.

Clean up: close the pull request, and delete the throwaway repository.

🤖 Generated with Claude Code

Bead: gascitypacks-zhy

L6 of Landing (`docs/handoffs.md`, "What Landing needs"): `gc forgejo pr review`, which posts one review on one head of a pull request and checks the forge recorded it. Builds on `pr state --json` as #36 left it (`08a754e`). ## What it does ``` gc forgejo pr review [--json] --repo <worktree> --pr <url|number> --expect-head <sha> --event <APPROVED|REQUEST_CHANGES> [--body-file <path>] ``` - Posts `{"event", "body", "commit_id": <expect-head>}` as the account the token belongs to, and prints `posted`, or `already_reviewed` when the account's latest approval or request is this event on this head (nothing is posted); with `--json`, one object with `schema_version`, `outcome`, `reason`, `state`, `head`, `account`, `event`, `review`, `lifted`, `forge_status`, `forge_message`. - Refuses without posting, one exit status each: 3 `head_moved`, 4 `not_open`, 7 `missing`, 8 `foreign` (no request), 10 `own_pull_request`, 11 `empty_body`. A 422 from the forge is 9 `rejected`; 1 a failure, 2 a mistake in the command line. - After posting it reads the reviews back with the code of L3 and exits 12, outcome `not_recorded`, never a success, when the forge stored it otherwise: pending, a comment, another commit, stale, dismissed, not `official`, or an approval after which the account's earlier request still blocks. - Client rules of `pr state` hold: only the forge's own 404 is `missing`; a 5xx, a timeout, a bad token, or any other answer is exit 1 with nothing on stdout; a foreign `--pr` gets no request; the token goes to the forge's host only. - README section "Posting a review" (tables of cases, fields, exit statuses, what the forge does), CHANGELOG entry under `[Unreleased]`, `commands/pr/review/{run.sh,help.md}`. ## Question 7: does the same account's approval of a newer head lift its earlier "request changes"? **Yes, by itself; the command dismisses nothing.** From Forgejo 17.0.1's source (tag `v17.0.1`, `363f3dc`, read in a clean checkout), not tried on sarak.sh: - A request blocks while it is `official` and not `dismissed`, whatever its commit: `models/issues/pull.go:923-939` (`MergeBlockedByRejectedReview`). A push does not end one: `DismissApprovalReviews` handles type approve only (`services/pull/review.go:443-449`, from `services/pull/pull.go:395-408`), so after the author's rework push the old request still blocks until the same account gives a new verdict. - A new approval or request clears `official` on every earlier review of the same account in the same transaction: `UPDATE review SET official=false WHERE issue_id=? AND reviewer_id=?` at `models/issues/review.go:424` (fresh review) and `:454` (from a pending one), for types approve and reject. `CreatePullReview` (`routers/api/v1/repo/pull_review.go:432-554`) goes through it (`services/pull/review.go:384-440`). So the earlier request stays listed as `request_changes`, `official: false`, and blocks nothing. - Who may dismiss: only a repository admin. `dismissReview` checks `ctx.IsUserRepoAdmin()` first (`pull_review.go:1102-1105`; routes `routers/api/v1/api.go:1053-1054`), the web form is behind `reqRepoAdmin` (`routers/web/web.go:1451`). So if the forge did keep the request blocking, the review account could dismiss it only if it is an admin, which the city's token cannot read. So no dismissal is built. The command instead reports `lifted` (the ids of the account's requests that blocked before an approval and do not after), and if a request of the account is still `official` after the approval it exits 12 and says dismissing takes an admin, so a forge that differs from the source shows as a failure and not as a merge that waits for ever. The trial below is what settles it on sarak.sh. ## How I checked it - `go vet ./...` and `go test ./...` (also `-race`) with `GOPROXY=off`: new tests on the fake forge for the success of both events, every refusal and its distinct exit status (the one table is shared with `pr merge`), the already-there rule (other event/head/account, dismissed, comment, pending, 60 reviews on 2 pages, a stored one that does not stand), each `not_recorded` case (pending, comment ×2, not official ×2, unlisted, stale by a push in between), the 422, every failure that must be exit 1 with no stdout (5xx, 404 from a proxy, 403, 201, garbage, a failed read back, bad or missing token, forge gone, no author), question 7 (request on one head, push, approval of the new head lifts it, nothing dismissed; and a forge that does not clear it), usage, foreign hosts, the token going to the forge alone. I broke the official check and the author check once each and the tests failed. - The fake forge gains `GET /user` and `POST .../reviews`, answering as the source cited does (own-pull 422, empty-body 422, `official` by the rule's whitelist, `stale` by commit, `official` cleared on the account's earlier reviews). One difference: the real forge decides `stale` by comparing diffs, the fake by commit. - The changelog check of CI's v1 action, built from its tag and run from the repo root: `valid=true`. `gc lint .` and `tests/formula.sh` pass. - Rebased onto `origin/main` (`08a754e`) right before the push; nothing of `gascitypacks-8g8` was on it yet. - **Not tried on sarak.sh**, as the bead says: the city's account cannot review its own pull requests and I did not read the review account's token. ## The trial, for the Operator On a throwaway repository on sarak.sh that has the same rule as the real `main` (one approval needed from `city-root-review`, whitelisted; block on rejected reviews; the checks may be none), with a clone at `$W`, an author account `A` (the city's `gascity-root`) and the review account `R`. `gc forgejo` here is this branch's tool, e.g. `go tool -C <this checkout>/forgejo forgejo` with `FORGEJO_URL=https://sarak.sh`. `$RT` is R's token file, `$AT` A's; `forgejo() { go tool -C <checkout>/forgejo forgejo "$@"; }`. ```sh cd $W && git switch -c trial && echo 1 >f && git add f && git commit -m one && git push -u origin trial # as A: open the pull request FORGEJO_TOKEN_FILE=$AT forgejo pr open --repo $W --title "trial" ; PR=<its url>; H1=$(git rev-parse HEAD) # 1. own pull request: expect exit 10 own_pull_request, nothing posted FORGEJO_TOKEN_FILE=$AT forgejo pr review --json --repo $W --pr $PR --expect-head $H1 --event APPROVED; echo $? # 2. a request for changes with no body: expect exit 11 empty_body FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H1 --event REQUEST_CHANGES; echo $? # 3. a request with a body: expect exit 0 posted, review.official true echo "fix it" >body.md FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H1 --event REQUEST_CHANGES --body-file body.md FORGEJO_TOKEN_FILE=$RT forgejo pr state --json --repo $W --pr $PR # reviews[0] official true: blocks (README: "a blocking review stands") # 4. again: expect exit 0 already_reviewed, no second review in `pr state` FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H1 --event REQUEST_CHANGES --body-file body.md # 5. rework push, as A echo 2 >f && git commit -qam two && git push; H2=$(git rev-parse HEAD) FORGEJO_TOKEN_FILE=$RT forgejo pr state --json --repo $W --pr $PR # the request still official, not dismissed: a push ends only approvals # 6. head moved: expect exit 3 head_moved FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H1 --event APPROVED; echo $? # 7. the approval of the new head: question 7 FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H2 --event APPROVED FORGEJO_TOKEN_FILE=$RT forgejo pr state --json --repo $W --pr $PR # 8. again: expect already_reviewed FORGEJO_TOKEN_FILE=$RT forgejo pr review --json --repo $W --pr $PR --expect-head $H2 --event APPROVED ``` What each answer of step 7 means for question 7: - `outcome` `posted`, `lifted` `[<id of the request>]`, and in `pr state` the request listed as `request_changes`, `official: false`, `dismissed: false`, with the approval `official: true`: **the forge behaves as its source says.** An approval of a newer head lifts the account's own request; L14 needs no dismissal step; this pull request stands as it is. With the checks green and a scheduled merge, the pull request merges (L12's trial). - Exit 12, stderr "an earlier request for changes of the account (review N) still blocks the merge, and dismissing it takes a repository admin": **sarak.sh differs from the source**: the request stays blocking after the approval. Then find who may dismiss: `curl -sS -X POST -H "Authorization: token $(cat $RT)" -H 'Content-Type: application/json' -d '{"message":"superseded","priors":false}' https://sarak.sh/api/v1/repos/<o>/<r>/pulls/<n>/reviews/<id>/dismissals`. `200` means the review account may dismiss its own request, and L6 gets a dismissal step before the approval (a follow-up bead, with this answer); `403` ("Must be repo admin") means it may not, and the Reviewer cannot clear its own request, and the user is asked how it is cleared (an admin account dismisses it, or the review account is made an admin); L14 waits for that. - Exit 12, stderr "does not count" (`official: false` on the approval itself): the review account is not on the rule's whitelist on this repository: that is L4's, not this command's. - Exit 12, "pending" or "stored it as comment": the forge did not take the event as a verdict; keep the output and stop. Clean up: close the pull request, and delete the throwaway repository. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Bead: gascitypacks-zhy
feat(forgejo): gc forgejo pr review posts a review on a head and checks the forge recorded it (gascitypacks-zhy)
All checks were successful
test / changelog (pull_request) Successful in 4s
test / lint (pull_request) Successful in 20s
test / scripts (pull_request) Successful in 39s
f398dfbbef
L6 of Landing (HQ ticket root-ons.17). The Reviewer will post its verdict
through this command, and the Operator's reviewing agents do until it
exists, so what it does and prints is a contract.

The command posts one APPROVED or REQUEST_CHANGES review on the commit it
is given, as the account the token belongs to. It refuses without posting,
each case with its own exit status (3, 4, 7, 8 as pr merge has them; 10
the account is the author, 11 a request for changes with no body), reads
the reviews back through the code of pr state --json, and fails with exit
12 and outcome not_recorded when the forge stored the review otherwise
than asked: pending, a comment, another commit, stale, dismissed, not
official, or an approval after which the account's earlier request still
blocks. Asked again for the same head and event it posts nothing.

Question 7 of docs/handoffs.md, settled from Forgejo 17.0.1's source: a new
approval clears official on the same account's earlier reviews in the same
transaction (models/issues/review.go:424), and only an official, undismissed
request blocks a merge, so the approval of a newer head lifts the account's
own earlier request without any dismissal. Dismissing takes a repository
admin (pull_review.go:1103), so the command dismisses nothing; it reports
the ids it lifted, and fails if a request is still blocking afterwards.

The fake forge gains GET /user and POST .../reviews, answering as the source
does (own-pull 422, empty-body 422, official by the rule's whitelist, stale
by commit, official cleared on the account's earlier reviews). Tests cover
every refusal, the read-back failures, idempotence over pages, question 7,
the client rules and usage. Not tried on sarak.sh: the trial is in the pull
request's description.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review left a comment

Reviewed f398dfb: gc forgejo pr review (submit.go and tests), Q7 citations checked against Forgejo v17.0.1, go vet/test/-race and changelog check on the merge result.

Reviewed f398dfb: gc forgejo pr review (submit.go and tests), Q7 citations checked against Forgejo v17.0.1, go vet/test/-race and changelog check on the merge result.
Author
Contributor

Reviewed head f398dfb (main 08a754e); squash-merged as bf3bee5.

What I checked:

  • The bead gascitypacks-zhy point by point: the command, every refusal with its own exit status (3, 4, 7, 8, 10, 11) and no post in any of them, the 422 as 9, the read-back through the reviews code of L3 with not_recorded (12) for pending, comment, other commit, stale, dismissed, not official, unlisted, or a request still blocking. Also the idempotence (latest verdict of the account, on any page), --json with all fields, and the client rules (only the forge's own 404 is missing; 5xx, proxy 404, 401/403, bad bodies and a failed read-back are exit 1 with no stdout; foreign --pr gets no request; the token goes to the forge's host only).
  • merge.go only gains three reasons and their exit statuses in the shared table; client.go only decodes user.login. pr merge and pr state behave as before, and their tests pass unchanged.
  • run.sh is the two-line exec of the Go tool, as for pr merge.
  • Question 7, checked against Forgejo v17.0.1 (363f3dc), read in a clean checkout: models/issues/pull.go:923-939, models/issues/review.go:424 and :454, services/pull/review.go:384-449, services/pull/pull.go:395-408, routers/api/v1/repo/pull_review.go:432-554, :644-691 and :1102-1105, routers/api/v1/api.go:1053-1054, routers/web/web.go:1451. Every citation holds, and I agree: a new approval by the same account clears official on its earlier request, so the request stops blocking; only a repo admin may dismiss; the command dismisses nothing and fails with 12 if a request still blocks. The fake answers as the source does (422 messages verbatim, official by whitelist, earlier reviews cleared), except that it decides stale by commit rather than by diff. The README says so.
  • The merge result (identical to the head, since main had not moved): go vet, go test and go test -race pass, offline; the changelog check (mikluko/changelog v1, built from its tag) gives valid=true; CI was green on all three checks.
  • The trial in the description: the commands and the meaning of each answer are right.

Follow-ups (not blocking):

  • The trial calls the city's account gascity-root; it is city-root.
  • After the post the command does not read the pull request's head again. A push that leaves the diff unchanged between the read and the post gives posted for the old head, which is not stale and which Forgejo counts. This is Forgejo's own rule, and the README documents it.
  • The fake does not model a pending review of the account being submitted, or the deletion of the account's review requests.

Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.

Reviewed head f398dfb (main 08a754e); squash-merged as bf3bee5. What I checked: - The bead gascitypacks-zhy point by point: the command, every refusal with its own exit status (3, 4, 7, 8, 10, 11) and no post in any of them, the 422 as 9, the read-back through the reviews code of L3 with `not_recorded` (12) for pending, comment, other commit, stale, dismissed, not official, unlisted, or a request still blocking. Also the idempotence (latest verdict of the account, on any page), `--json` with all fields, and the client rules (only the forge's own 404 is missing; 5xx, proxy 404, 401/403, bad bodies and a failed read-back are exit 1 with no stdout; foreign `--pr` gets no request; the token goes to the forge's host only). - `merge.go` only gains three reasons and their exit statuses in the shared table; `client.go` only decodes `user.login`. `pr merge` and `pr state` behave as before, and their tests pass unchanged. - `run.sh` is the two-line exec of the Go tool, as for `pr merge`. - Question 7, checked against Forgejo v17.0.1 (363f3dc), read in a clean checkout: `models/issues/pull.go:923-939`, `models/issues/review.go:424` and `:454`, `services/pull/review.go:384-449`, `services/pull/pull.go:395-408`, `routers/api/v1/repo/pull_review.go:432-554`, `:644-691` and `:1102-1105`, `routers/api/v1/api.go:1053-1054`, `routers/web/web.go:1451`. Every citation holds, and I agree: a new approval by the same account clears `official` on its earlier request, so the request stops blocking; only a repo admin may dismiss; the command dismisses nothing and fails with 12 if a request still blocks. The fake answers as the source does (422 messages verbatim, official by whitelist, earlier reviews cleared), except that it decides stale by commit rather than by diff. The README says so. - The merge result (identical to the head, since main had not moved): `go vet`, `go test` and `go test -race` pass, offline; the changelog check (mikluko/changelog v1, built from its tag) gives valid=true; CI was green on all three checks. - The trial in the description: the commands and the meaning of each answer are right. Follow-ups (not blocking): - The trial calls the city's account `gascity-root`; it is `city-root`. - After the post the command does not read the pull request's head again. A push that leaves the diff unchanged between the read and the post gives `posted` for the old head, which is not stale and which Forgejo counts. This is Forgejo's own rule, and the README documents it. - The fake does not model a pending review of the account being submitted, or the deletion of the account's review requests. Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.
Author
Contributor

Trial run by the Operator's agent on 2026-11-12 on mikluko/scratch, tool built from v0.6.0.

Tool: go build ./assets/forgejo from v0.6.0 (d9d5ad4), FORGEJO_URL=https://sarak.sh. A = city-root, R = city-root-review. Pull request: mikluko/scratch#2, branch trial-l6, H1 0c31b9f, H2 40019d4. pr open was given --summary-file (the trial omits it; the tool requires it). Commits were pushed over ssh as mikluko; the pull request's author is city-root, so nothing below changes because of that.

Protection of scratch main (R cannot read the rule, 403; found by refusals on mikluko/scratch#1): one approval required (405 not allowed to merge [reason: Does not have enough approvals]), check test / test (pull_request) required (405 ... [reason: Not all required status checks successful]), and stale approvals are not dismissed: an approval of an earlier head stayed stale: true, dismissed: false after a push, and the merge then succeeded (200, #1 merged). "Block on rejected reviews" could not be isolated (the forge checks approvals first).

Step Command Expected What happened Same?
1 A pr review --event APPROVED H1 exit 10 own_pull_request refused/own_pull_request, account: city-root, exit 10 same
2 R REQUEST_CHANGES, no body exit 11 empty_body refused/empty_body, exit 11 same
3 R REQUEST_CHANGES --body-file H1; pr state exit 0 posted, official: true posted, review 200 official: true, stale: false, dismissed: false, exit 0; pr state lists it, checks success same
4 the same again already_reviewed, no second review already_reviewed (review 200), exit 0; pr state one review same
5 push "two" as A; pr state request still official, not dismissed review 200 official: true, stale: true, dismissed: false same
6 R APPROVED H1 exit 3 head_moved refused/head_moved, head 40019d4, exit 3 same
7 R APPROVED H2; pr state posted, lifted [<id>]; request request_changes, official: false, dismissed: false; approval official: true posted, review 201 official: true, lifted: [200], exit 0; pr state: review 200 request_changes, official: false, stale: true, **dismissed: true**, review 201 approved, official: true different in one field: the forge marks the superseded request dismissed: true
8 R APPROVED H2 again already_reviewed already_reviewed (review 201), exit 0 same

Question 7 on sarak.sh: yes: R's approval of the newer head lifted R's own request without any dismissal call (lifted: [200], request official: false), so L6 and L14 need no dismissal step. The one difference: Forgejo also flags the superseded request dismissed: true, where the description (and the source reading) expected dismissed: false; the tool's outcome is unaffected.

Clean-up: #2 closed. The repository was not deleted (it is the user's, kept on purpose); no branch deleted.

Trial run by the Operator's agent on 2026-11-12 on mikluko/scratch, tool built from v0.6.0. Tool: `go build ./assets/forgejo` from v0.6.0 (`d9d5ad4`), `FORGEJO_URL=https://sarak.sh`. A = `city-root`, R = `city-root-review`. Pull request: https://sarak.sh/mikluko/scratch/pulls/2, branch `trial-l6`, H1 `0c31b9f`, H2 `40019d4`. `pr open` was given `--summary-file` (the trial omits it; the tool requires it). Commits were pushed over ssh as `mikluko`; the pull request's author is `city-root`, so nothing below changes because of that. Protection of scratch `main` (R cannot read the rule, 403; found by refusals on mikluko/scratch#1): one approval required (`405 not allowed to merge [reason: Does not have enough approvals]`), check `test / test (pull_request)` required (`405 ... [reason: Not all required status checks successful]`), and **stale approvals are not dismissed**: an approval of an earlier head stayed `stale: true, dismissed: false` after a push, and the merge then succeeded (200, #1 merged). "Block on rejected reviews" could not be isolated (the forge checks approvals first). | Step | Command | Expected | What happened | Same? | |---|---|---|---|---| | 1 | A `pr review --event APPROVED` H1 | exit 10 `own_pull_request` | `refused`/`own_pull_request`, `account: city-root`, exit 10 | same | | 2 | R `REQUEST_CHANGES`, no body | exit 11 `empty_body` | `refused`/`empty_body`, exit 11 | same | | 3 | R `REQUEST_CHANGES --body-file` H1; `pr state` | exit 0 `posted`, `official: true` | `posted`, review 200 `official: true, stale: false, dismissed: false`, exit 0; `pr state` lists it, checks success | same | | 4 | the same again | `already_reviewed`, no second review | `already_reviewed` (review 200), exit 0; `pr state` one review | same | | 5 | push "two" as A; `pr state` | request still official, not dismissed | review 200 `official: true, stale: true, dismissed: false` | same | | 6 | R `APPROVED` H1 | exit 3 `head_moved` | `refused`/`head_moved`, head `40019d4`, exit 3 | same | | 7 | R `APPROVED` H2; `pr state` | `posted`, `lifted [<id>]`; request `request_changes, official: false, dismissed: false`; approval `official: true` | `posted`, review 201 `official: true`, `lifted: [200]`, exit 0; `pr state`: review 200 `request_changes, official: false, stale: true, **dismissed: true**`, review 201 `approved, official: true` | different in one field: the forge marks the superseded request `dismissed: true` | | 8 | R `APPROVED` H2 again | `already_reviewed` | `already_reviewed` (review 201), exit 0 | same | Question 7 on sarak.sh: **yes**: R's approval of the newer head lifted R's own request without any dismissal call (`lifted: [200]`, request `official: false`), so L6 and L14 need no dismissal step. The one difference: Forgejo also flags the superseded request `dismissed: true`, where the description (and the source reading) expected `dismissed: false`; the tool's outcome is unaffected. Clean-up: #2 closed. The repository was not deleted (it is the user's, kept on purpose); no branch deleted.
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/gascitypacks!41
No description provided.