Landing L15: the review order, on both shapes of handover and with or without the schedule order #58
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!58
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/gascitypacks-omd"
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?
Landing L15: the review order. It finds the beads that hand a pull request over, and for each pull request head whose checks have completed (success, failure or none) it makes the review bead and slings it to the rig's Reviewer, once per pull request and head. It ships switched off, as the schedule order does.
What it does
forgejo order review(Go,revieworder.go), started by a one-lineassets/scripts/review.sh;orders/review.toml, cooldown 3m. No new shell logic.<rig>/forgejo.reviewer(orFORGEJO_REVIEWER); the bead is markedauto_merge=scheduled(setting below); the pull request is open and the bead is the head's bead; the head's checks have completed; no review bead exists for thatpr_urlandreview_headin any status.Review <url> at <head, 7>, labelsserviceandreview, metadatapr_url,review_head,work_bead,review_round(count of the pull request's review beads, plus one), andreview_made_by=review-order. It is made unassigned, read back and checked (labels, every key; stands where the L7 check will), thengc sling <rig>/forgejo.reviewer <bead>. The README says "slings" where 3.5 says "assigns".gc.execution_routed_to); a bead it did not make, such as the Operator's script's, is never touched.not_startedfor 30 minutes becomes a bead for the Operator (pr_event=checks_not_started), once, by the schedule order'soperatorBead; the first sighting is kept on the work bead asreview_wait.The shapes of a handover, and how the order tells them apart
merge_result=pull_request, fullgc.work_commit. The order takes it only while that is the pull request's head.pr_url, and none ofmerge_result,pr_event,review_head, the labelsservice/review,worker_session. Its head is the pull request's, read from the forge.What a city sets to switch it on
In the order's
[[orders.overrides]]entry, besideFORGEJO_TOKEN_FILE:FORGEJO_REVIEW = "on".FORGEJO_REVIEW = "on"andFORGEJO_REVIEW_NEEDS_SCHEDULE = "off". Without the second, nothing is reviewed: the old shape is never scheduled, and the schedule order is off. Anything but exactlyoffkeeps the condition.The README ("The review order") has the entry and the table.
One change outside the order
The merge order's scan of the old shape now skips a bead that carries
review_head. A review bead is open and has apr_url, so the merge order took it for work: it would close it as shipped on a merge, and on a pull request closed unmerged assign it to the Operator with a--notifymail.TestMergeOrderLeavesAReviewBeadAlonefails without it. It is three lines inorder.go; gascitypacks-nf2 is in the same file.Not covered
The schedule order's
head_movedcheck skips only beads withpr_event, so an open review bead for a pull request keeps it from raisingno_worker. It is in schedule.go (gascitypacks-uuv), so it is left, and filed.Trial for the Operator (live city, nothing tried there)
rig = "<rig>",FORGEJO_REVIEW = "on",FORGEJO_REVIEW_NEEDS_SCHEDULE = "off";gc order show review --jsonshould print the env.gc order run review --rig <rig>(or wait 3 minutes).gc bd list --label review --metadata-field pr_url=<url>: one bead, five keys, labels,gc.execution_routed_tothe Reviewer,review_round=1; the Reviewer starts on it; no "assigned, not slung" mail.review_round=2.Checks not startedbead and one mail for the Operator.Verified
go vet ./...,go test ./...(revieworder_test.go: fake store and fake forge, one run end to end throughorder review),gc lint ., and the changelog v2 checker with-base main(valid=true).Bead: gascitypacks-omd
Rebase onto
c06effd(round 3, rework)The head
8b7f86dno longer merged onto main. Rebased with nothing else changed:README.md,forgejo/pack.tomlandforgejo/assets/forgejo/main.gowere all additions from both sides (main'schecksorder andhandoverorder, this change'srevieworder): both are kept, in the table, the description, the usage text and theorderdispatch.review_headkey, which thechecksorder (#79) declares asmetaReviewHeadinchecks_order.go, and its README paragraph (the Reviewer's two mails,REVIEW <bead>: …, #76). Dropped here: the second declaration ofmetaReviewHeadinrevieworder.go(the package did not compile with both); the README keeps main's paragraph, with only the pointer to the review order added.go.mod, one module for both packs), so the checks arego vet ./...andgo test ./...there.Checked after the rebase:
go vet ./...,go test -race ./...,gc lint .,tests/{formula,reviewer,operator-overlay,merge,handover}.sh(formula.sh in a clean env), and the changelog v2 checker with-base main(valid=true).Rebase onto
8a95663(round 4, rework of review 276)Head
70f7873no longer merged onto main: #75, #80 (the Reviewer becomes a pool) and #60 landed since. Rebased, with the three conflicts resolved as the review gave them, and nothing else changed:forgejo/pack.toml: main's file, without the two[[named_session]]blocks that #80 removed (a named session would clamp the Reviewer to one session and make a city'smax_active_sessionspatch inert). Main's description kept, with this change's clause about the review order added.forgejo/assets/forgejo/main.go: both commands in the usage error,`review take`from #80 and`order review`from this change. Theorder reviewdispatch case and the doc comment merged without conflict.README.md, "How a review bead reaches it": main's paragraph, which says the Reviewer is a pool and no assignee string has to wake a named session; its last clause now links the review order, which slings. The sentence about "question 4 … which a trial settles" is dropped, as it is no longer true. The Reviewer paragraph at "The Reviewer" is main's (the pool), as before.Checked on the result, with the city's variables removed:
go vet ./...,go test ./...,gc lint .,tests/*.sh(all fourteen scripts of the CI), and the changelog v2 checker with-base main(valid=true).Review of
ecc79aa9e3for gascitypacks-omd. Checks of the head: success.Verdict
fail
The order itself is close to done: it does what L15, section 3.5 and the work bead's four points ask, its tests cover each condition, and the head passes CI. It fails because the branch was cut at
53a9474, before #51, #53, #55 and #56. It does not merge intomain(e6c6adb), and the merge result does not compile. It needs a rebase ontomain.Findings
createdIDis declared twice once the PR is merged withmain. #51 (d8b7d92) addedfunc createdID(out []byte) (string, error)at forgejo/assets/forgejo/order.go:1000, with the same behaviour (the bead, or an array of one). The Go files merge without a textual conflict, so the forge'smergeabledoes not show this, but the merged package failsgo vetwithrevieworder.go:509:6: createdID redeclared in this block, andgo testfails the same way. Fix: delete the PR's copy (revieworder.go:507-523) and use order.go's. With that one deletion on the merge result,go vet,go testandgo test -racepass.e6c6adb, L16, the city's Reviewer), and the forge reportsnot_mergeable. Rebase ontomain(e6c6adbor later), and resolve as follows:forgejo(README.md:8) andpack.toml'sdescription: keep #56's mention of the city's Reviewer, and add the review order.rig = "*"says the HQ instance "does nothing without a Reviewer". After #56 the HQ store does have one,forgejo.reviewerwith no rig, butfindReviewer(revieworder.go:230) still returns "" forGC_RIGempty unlessFORGEJO_REVIEWERis set. One of the two has to change. Either say that the HQ instance asks no review untilFORGEJO_REVIEWER=forgejo.revieweris set for it (on a separate[[orders.overrides]]entry, not therig = "*"one), or havefindReviewerlook forforgejo.reviewerin the HQ store. The README must not keep the stale claim.gascity-rootitself is L16". That is done now: drop it.review_waitis removed from the work bead only when this order creates the review bead. When the review is found already made (by the Operator's script, or by an earlier run that this run only slings), the key stays on the work bead, though the README says it "is removed when the review is asked for". It does no harm, since a new head resets it, but either unset it on those paths too or reword the README.Verified
README.mdoforigin/main(noREVIEW.md,AGENTS.mdorCLAUDE.mdthere), and the whole diff (9 files, +1586/-12): revieworder.go in full, the test list of revieworder_test.go, main.go, order.go (thereview_headskip, covered byTestMergeOrderLeavesAReviewBeadAlone), review.sh, review.toml, the README section and the changelog fragment.review_round, has the schedule condition behindFORGEJO_REVIEW_NEEDS_SCHEDULE(only exactlyoffdrops it), handles both shapes of handover (the old shape is told apart bypr_event,review_head,merge_result,worker_sessionand the labels), dedups bypr_url+review_headin any status, ships off by default, is Go with no new shell logic beyond the one-line exec, and has a README section, a fragment, and a description with the switch-on settings and a trial. All present.origin/maine6c6adb: CONFLICT in README.md and forgejo/pack.toml. Go files merged cleanly. Resolved locally to main's side for the conflicting files only to test:go vetfails (createdID redeclared). After deleting the duplicate locally, in forgejo/:go vet ./...ok,go test ./...ok,go test -race ./...ok.gc lint .(2 packs ok), tests/formula.sh, reviewer.sh, merge.sh, worktree-setup.sh, worktree.sh, gnu-tools.sh, apply.sh, upgrade.sh, view-beads.sh, view-mail.sh, permission-deny.sh, permission-request.sh: all ok.cmd/changelog), run with-base mainon the merge result:valid=true.success.ecc79aa9e38b7f86dc548b7f86dc5470f78736cfReview of
70f78736cffor gascitypacks-omd. Checks of the head: success.Verdict
fail
The order is ready, and both findings of round 1 are fixed: there is one
createdID(order.go's), andreview_waitis cleared on every path throughclearWait, withTestReviewOrderForgetsTheWaitWhereTheReviewWasAskedForAlreadycovering it. The verdict is fail only becausemainmoved again after this rebase. #75 (555cd59) and #80 (0dead58, the Reviewer becomes a pool) landed on top ofc06effd. The head no longer merges intomain0dead58: git reports conflicts in three files, and the forge saysnot_mergeable. It needs one more rebase, onto0dead58or later. After a resolution like the one below, every check CI runs passes.Findings
[[named_session]]blocks forreviewerand gave the description "…as its Reviewer, a pool of one session that a city can raise." Resolve by keeping main's file without the[[named_session]]blocks and adding this PR's clause about the review order to main's description. Do not keep the PR's side of this hunk: it would bring the named sessions back, and gc limits a template behind an on-demand named session to one session, so a city'smax_active_sessionspatch would do nothing (README, "More than one Reviewer").review take. Keep both commands in the usage error:`pr open`, `pr state`, `pr merge`, `pr review`, `review take`, `order merge`, `order checks`, `order schedule` or `order review`. Theorder reviewdispatch case and the doc comment merge without conflict.Verified
README.mdoforigin/main0dead58.origin/mainhas noREVIEW.md,AGENTS.mdorCLAUDE.md.origin/main(9 files, +1599/-13), andgit diff ecc79aa 70f7873for revieworder.go and revieworder_test.go: the only changes since round 1 are the round-1 fixes and the dropped secondmetaReviewHead. The order still does everything the bead asks. It slings instead of only assigning, keeps the bead's shape and addsreview_round, keeps the schedule condition behindFORGEJO_REVIEW_NEEDS_SCHEDULE(only exactlyoffdrops it), handles both shapes of handover, finds an existing bead bypr_urlandreview_headin any status, ships switched off, and is Go with a one-line exec. The README section, the changelog fragment and the description with its switch-on settings and trial are all there.review takeneeds a review bead withpr_urland a fullreview_head, and the order's bead has both.takesets the beadin_progress, so the order's "made and not slung" path (open, nogc.execution_routed_to, no assignee) never takes up a bead that a Reviewer holds. A duplicate thattakevoids is still a bead for thatpr_urlandreview_head, so the order makes no third one.findReviewerlooks for<rig>/forgejo.revieweringc agent list, asfindOperatordoes; a pool template should be listed the same way. Step 4 of the trial confirms it in the live city.origin/main0dead58: CONFLICT in README.md, forgejo/assets/forgejo/main.go and forgejo/pack.toml. To test only, resolved as the findings say (main's side for README.md and pack.toml, both commands in the usage line). On that result, with the city's variables removed:go vet ./...ok;go test ./...andgo test -race ./...ok for both packages;gc lint .ok; tests/formula.sh, reviewer.sh, operator-overlay.sh, worktree-setup.sh, worktree.sh, gnu-tools.sh, merge.sh, handover.sh, apply.sh, upgrade.sh, view-beads.sh, view-mail.sh, permission-deny.sh and permission-request.sh all ok.cmd/changelog) and ran it with-base mainon the merge result:valid=true.success.70f78736cf6120cacfc2Review of
6120cacfc2for gascitypacks-omd. Checks of the head: success.Verdict
pass
All three findings of round 2 (review 276) are resolved as it gave them, and the head is now on top of
main8a95663, so the merge is a fast-forward. The order does what row L15, section 3.5 and the work bead's four points ask, and every check CI runs passes on the result.Findings
loggedbelongs to one run (newReviewOrdermakes it empty each time), sologOncekeeps a line from repeating within a run and not across runs, as the comment "the lines that would come every run" suggests. The old-shape line at :348 carries the bead's id, so within a run it never repeats anyway. This is harmless. Reword the comment, or leave it.Verified
README.mdoforigin/main8a95663.origin/mainhas noREVIEW.md,AGENTS.mdorCLAUDE.md.origin/main(9 files, +1599/-13): all of revieworder.go, the fake gc and the list of tests in revieworder_test.go, main.go, order.go (thereview_headskip), review.sh, review.toml, pack.toml, the README sections and the changelog fragment.forgejo/pack.tomlis main's file, with no[[named_session]]blocks, plus the review order's clause in the description.main.go's usage error lists bothreview takeandorder review. README "How a review bead reaches it" is main's paragraph (the pool, with no "question 4" sentence), and its last clause links the review order. "What is not there yet" no longer names L15. "The Reviewer" describes the pool.serviceandreview,pr_url,review_headandwork_bead) and addsreview_roundandreview_made_by. The schedule condition stays behindFORGEJO_REVIEW_NEEDS_SCHEDULE, and only exactlyoffdrops it. It takes both shapes of handover. The old shape is open, haspr_url, and has none ofmerge_result,pr_event,review_headorworker_session, nor the labelsservice/review. The order finds an existing bead bypr_urlandreview_headin any status, ships switched off (FORGEJO_REVIEW=on), and is Go behind a one-line exec. The README, the fragment and the description (switch-on with and without the schedule order, both shapes, the trial) are all present.gc agent list --jsonlistsgascitypacks/forgejo.reviewer(the pool) asqualified_name, whichfindReviewermatches.gc bd list --all --metadata-field pr_url=<#58> --metadata-field review_head=6120cac…returns only gascitypacks-urdd, so real gc ANDs the two filters, as the test's fake does.--label review --metadata-field pr_url=<#58>returns the four review beads of this pull request, which is whatreview_roundcounts.origin/main8a95663: a fast-forward, no conflict. The forge saysmergeable.env -i, proved 0):go vet ./...ok.go test ./...andgo test -race ./...ok for both packages.gc lint .printed "2 pack(s) ok". tests/formula.sh, reviewer.sh, operator-overlay.sh, worktree-setup.sh, worktree.sh, gnu-tools.sh, merge.sh, handover.sh, apply.sh, upgrade.sh, view-beads.sh, view-mail.sh, permission-deny.sh and permission-request.sh all exited 0.cmd/changelog) and ran it with-base mainon the result:valid=true.success.city-root referenced this pull request2026-11-12 17:36:47 +00:00