The merge order's first run reports old pull requests as news: 29 beads and mails for the Operator #51
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!51
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/gascitypacks-nf2"
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 the merge order's first run in rexcity's store, which on 2026-11-12 made 29 beads and 29 notifying mails for pull requests another city had closed days before, and set
merge_result=closedon their beads.Why the forge answers 404
I read the forge with the city's token (nothing written). For rexcity#39 the API, the web page and the issues API (
/repos/mikluko/rexcity/issues/39) all answer 404, and the forge's listing of pull requests (state=all, 49 of them) has no #16, #25 and #31 to #60. So these pull requests are gone from the forge, together with their issue rows, and are not closed: pull requests and issues share one numbering, and a pull request whose head repository was deleted would still be there. #61 onward, opened by the city that works the rig now, are all present. The order was right that the forge has no such pull request; it was wrong to call that "closed" and to call it news.What the order does now
pr_event=baseline. In it, a pull request that has ended (merged, closed unmerged, gone) is history: its beads are recorded as it ended, with one log line and no bead or mail for the Operator. The run then leaves the marker, a closed bead "Merge order: first run in this store" that says how many it found of each kind. Every later run finds the marker and tells the Operator of every pull request that ends.FirstRunHidesNoPullRequestThatEndsLater); one the baseline could not read is left and is news later, even though the marker is written (FirstRunLeavesAPullRequestItCannotRead); a marker that cannot be written fails the run and the next is a baseline again. What is hidden is only a pull request that closed unmerged in the minutes before the order's first run in a store, which no earlier run could have told the Operator of. I chose a first-seen marker over bead age because a pull request can stay open for days and close unmerged long after its bead closed at the opening: age cannot tell that from history. Beads of the old shape (open, with apr_url) are not history and are handed over whenever found closed. The baseline marker is an ordinary closed bead: if something removes it, the next run is a baseline again and settles quietly what ended since the previous run (the README says so).gc bd kvis refused on this city's split storage, and the order has no other state.merge_result=missing, neverclosed. Can a 404 be the answer for a live pull request? The tool already took only the forge's own error object as "not found" (a proxy's or a restarting forge's 404 is an error). But Forgejo answers the same "not found" for a pull request in a repository the token cannot read, so the order now also reads the repository: when that answers, the pull request is missing; when it is "not found" too, or fails, nothing is settled and the run fails with the reason (tests: unreadable repository, proxy 404, repository 500). A deleted repository therefore fails the run every two minutes until someone looks: I took that over a silent settlement.gc forgejo pr stateis unchanged.pr_event=closed_batchormissing_batch,pr_batchthe hash of the URLs) and one mail; merges are one mail. Up to three, each has its own bead and mail as before. The old shape is under the same limit: more than three open beads of one kind (closed unmerged, or gone) are all still assigned to the Operator, withpr_closedrecorded, but one mail lists the kind. If a run fails after making the listing bead, the next run finds it and makes no second, but the pull request whose records failed to write is then a kind of one and gets a bead of its own: one possible duplicate, tested and documented.The 29 beads of rexcity marked
closedThe order corrects them itself: its baseline run rereads the beads recorded as
merge_result=closed, reads each pull request once, and recordsmissingon those the forge does not have, with no mail; a bead whose pull request really closed staysclosed. Since no earlier version left the marker, every store's baseline run is the first run after this version is imported, in rexcity's too, so no one-time command is needed. The two minutes before the import are the exposure noted above. I did not touch any store's data: the tests run against a fake city.Checks
go vetandgo test ./...inforgejopass. New Go tests: history (merged, closed, gone; 29 at once), the baseline's limits, 404 with a readable repository, with an unreadable one, from a proxy and with a failing one, the flood of each kind, the listing bead made once, the correction of wrongly closed beads, and no reread on later runs.tests/merge.shhas its stub answer the marker lookup.tests/formula.sh,gc lint .and the v1 changelog check pass. Changelog note as a fragment,.changelog/merge-order-history.md(Fixed); README's merge-order section describes the baseline, the 404 and the flood. No shell logic added.Bead: gascitypacks-nf2
Rework, round 1 (review 203)
50455b6, #49);CHANGELOG.mdkeeps both entries, and--from controlleris on every mail of the new code, with the tests reading subject and body at indexes 7 and 9.go vet,go test -race,tests/merge|apply|upgrade|permission-request|formula|reviewer.sh, the v1 changelog check.Rework, round 2 (review 212)
forgejo/forgejo, a compiled binary ago buildleft in the checkout, is out of every commit of the branch (the rebase dropped it from the commit that added it), and nothing in the diff is a binary now.53a9474, #52). The changelog note moved, unchanged, fromCHANGELOG.mdto the fragment.changelog/merge-order-history.md;CHANGELOG.mdis as on main, so the merge does not start thereleaseworkflow.go vet,go test -race ./...inforgejo,tests/merge.sh,tests/formula.sh, andgo run sarak.sh/mikluko/changelog/v2/cmd/changelog@latest -base main(valid=true).Review of
30b5df7e72for gascitypacks-nf2. Checks of the head: success.Verdict
fail
Findings
main; the forge saysnot_mergeable.maingained50455b6("Mail from an order shows human as its sender", #49) after this branch was cut, and merging the head intoorigin/mainconflicts inCHANGELOG.md(both add an entry under[Unreleased]/ Fixed; keep both) and inforgejo/assets/forgejo/order.goatrecordMerge(~line 460 on main, 625 here). Rebase ontoorigin/main(50455b6). #49 changes more than the text of the conflict, so the rebase has to carry its convention into the new code:gc mail sendof the order passes--from mailSender(controller). Git will carry it intohandOver(order.go:420) andmailOperatorBead(order.go:942). It will not reach the newrecordMergedMany(order.go:640), and the rewrittenrecordMerge(order.go:626) has to keep it;order_test.gofails every mail that lacks exactly one--from controller. It also moves the subject and body of a recorded mail from indexes 5 and 7 to 7 and 9. The new tests readr.city.mails[0][5]and[7](e.g.TestMergeOrderFirstRunHidesNoPullRequestThatEndsLater,TestMergeOrderTellsOfManyClosedPullRequestsInOneBeadAndOneMail,...ManyMissing...,...ManyMerges...), so they need the new indexes.settleOpenBead/handOver): done-when 3 of the work bead ("When a run would hand the Operator more than a few beads of one kind, it files one bead that lists them and sends one mail") is met for the closed shape only. Beads of the old shape (open, with apr_url) are still handed over one by one: N such beads whose pull requests closed unmerged or are gone mean N assignments and N--notifymails in one run. They are also, by design, never history. So a store adopted with many open beads pointing at deleted pull requests floods the Operator exactly as rexcity's did. The PR description and the README section "One run cannot flood the Operator" claim the property without that limit. Fix: put the old shape's hand-overs underfloodLimittoo (above it, still assign or mark each bead, but send one mail, or file one listing bead, for the run). Or, if the old shape is meant to stay out of scope, get that decided on the work bead and say it in the README and the description.firstRun: the baseline marker is an ordinary closed bead. If it is ever removed (a cleanup or compaction of closed beads, or a person deleting it), the next run is a baseline again and quietly settles whatever ended since the previous run. The bead's description asks people to leave it closed. The README should name this exposure next to the "minutes before the first run" one.Verified
README.mdoforigin/main(the repository has noREVIEW.md,AGENTS.mdorCLAUDE.md). Read the whole diff (7 files, +853/-62) and the unchanged parts oforder.goit relies on (orderMerge,settleOpen,handOver,operatorBead).missing, and the repository read inconfirmMissingthat settles nothing on an unreadable repository, a proxy 404 or a 5xx), 4 (the baseline run'scorrectClosedcorrects the 29, no store touched by the tests) and 5 (Go tests for each case, CHANGELOG under[Unreleased]Fixed, no new shell logic;tests/merge.shonly teaches its stub the marker lookup) are met in the code as I read it. Done-when 3 is met for the closed shape only (above).origin/mainin a scratch clone: conflicts inCHANGELOG.mdandforgejo/assets/forgejo/order.go. Merge aborted.go vet ./...,go test ./...andgo test -race ./...inforgejopass.tests/merge.sh,worktree-setup.sh,worktree.sh,gnu-tools.sh,apply.sh,upgrade.sh,view-beads.sh,view-mail.sh,permission-deny.sh,formula.shandreviewer.shpass. The changelog checker built from mikluko/changelogv1(7ec45bb, 1.6.0) exits 0.gc lint .was not run locally; the head's own CI checks aresuccess.30b5df7e72cae43251caReview of
cae43251cafor gascitypacks-nf2. Checks of the head: success.Verdict
fail
Findings
forgejo/forgejo(new, 10,180,194 bytes, mode 755): commitcae4325adds a compiled binary to the repository, a Mach-O arm64 executable (magiccffaedfe), apparently left behind by ago buildrun inforgejo/. It is not part of the change,.gitignoredoes not cover it, and once merged it ships in theforgejopack to every city that imports the pack and stays in the history for good. Fix: drop it from the branch (git rm --cached forgejo/forgejoand amend or fix upcae4325, so that no commit of the pull request carries it), and build somewhere outside the checkout from now on (or add/forgejo/forgejoto.gitignore).CHANGELOG.md:13(the new line under[Unreleased]/ Fixed):mainhas moved again since the rebase onto #49.53a9474("Take changelog notes as fragments in .changelog/, on changelog v2", #52) changed the repository's convention. The README's "Releases" section onmainnow says: "A pull request notes its change in a file of its own in.changelog/, a fragment, and never editsCHANGELOG.md". The merge is clean as text, and the v2 checker accepts the line, because it reads a note added toCHANGELOG.mdas a release does. But the line breaks the convention, and since the merge changesCHANGELOG.md, it also starts thereleaseworkflow onmain. Fix: rebase ontoorigin/main(53a9474). Move the entry, unchanged, into a fragment such as.changelog/merge-order-history.md(### Fixed, then the bullet), and leaveCHANGELOG.mdas it is onmain. The work bead's "CHANGELOG entry under [Unreleased], Fixed" was written before #52, and a fragment is how that note is made now. Check withgo run sarak.sh/mikluko/changelog/v2/cmd/changelog@latest -base main.Verified
30b5df7) is addressed. The branch is rebased onto50455b6(#49). Everygc mail sendinorder.gopasses--from mailSender(lines 458, 485, 703, 717, 1019; none without it), and the tests read the subject and body at indexes 7 and 9. The old shape is now under the flood limit:settleOpencollects what is owed, andhandOverAll/handOverMany(order.go:419-506) assign each bead and recordpr_closedbut send one mail per kind abovefloodLimit, with--dedup handover:<hash>. Below the limit the per-bead path is the same as before. A failed mail leaves every bead for the next run, and a failed update leaves only that bead. The new testTestMergeOrderTellsOfManyOpenBeadsInOneMailForEachKindchecks two mails, every bead assigned and open withpr_closed, and a quiet second run. The README names the marker's exposure and describes the old shape under the limit. The PR description has a rework section.README.mdoforigin/main(noREVIEW.md,AGENTS.mdorCLAUDE.mdthere). Read the diff ofcae4325in full and the parts of the whole diff it touches (recordMerge,recordMergedMany,tellOperator,handOver,batchKey,main.go,main_test.go,tests/merge.sh). Done-when 1, 2, 4 and 5 stand as reviewed in round 1. Done-when 3 now holds for both shapes.origin/main(53a9474) in a scratch clone: clean, no conflicts. The forge also saysmergeable.go vet ./...,go test ./...andgo test -race ./...inforgejopass.tests/formula.sh,reviewer.sh,worktree-setup.sh,worktree.sh,gnu-tools.sh,merge.sh,apply.sh,upgrade.sh,view-beads.sh,view-mail.sh,permission-deny.shandpermission-request.shall exit 0. The changelog checker built from mikluko/changelog v2.0.1 source with-base maingivesvalid=true(the line inCHANGELOG.mdcounts as a note, see above).gc lint .was not run locally; the head's own CI checks aresuccess.cae43251ca21b3195d21Review of
21b3195d21for gascitypacks-nf2. Checks of the head: success.Verdict
pass
Findings
confirmMissing,GET /repos/<owner>/<repo>), which the new "A 404 is not closed" paragraph describes. Fix: add "and, when the forge answers 'not found' for it, one for its repository".TestMergeOrderSettlesNothingOnA404OfAProxy: the failure is keyed/api/v1/repos/o/r, and the fake forge matches failures by path prefix (main_test.go:125), so the HTML 404 answers the read of the pull request itself. That case was already an error before this change. The test does not cover a forge 404 for the pull request followed by a proxy 404 for the repository. The code is safe there, sinceconfirmMissingtakes any 404 on the repository as unknown whether or not the forge wrote it, but the PR description lists "proxy 404" among the new tests of the repository read. ArepoFailurewith an HTML body afterr.missingURL()would test that path.Verified
cae4325) is addressed. No commit of the branch (fceec86,adf7cb0,21b3195) hasforgejo/forgejoin its tree, and the diff has no binary file. The note is the fragment.changelog/merge-order-history.md(### Fixed, one bullet, in the same form aschangelog-fragments.mdon main), andCHANGELOG.mdis not in the diff againstmain. Round 1's findings stand as fixed:--from mailSenderis on every mail, the old shape is underfloodLimit(handOverAll/handOverMany), and the README names the marker's exposure.README.mdoforigin/main(there is noREVIEW.md,AGENTS.mdorCLAUDE.md). Read the whole diff (7 files, +976/-78). Also read the code it relies on:pull(one read per URL per run, cached, socorrectClosedin the baseline run makes no second request for a URL already read),client.defaultBranch(the repository read),handOver,list,operatorBead(lookup with--all), andschedule.goon main. Nothing there readsmerge_result=closed, and the schedule order lists onlymerge_result=pull_request, so the newmissingvalue does not reach it.gc bd list --helpconfirms--allincludes closed beads and--metadata-field key=valuefilters, asfirstRunandcorrectClosedneed.recordHistorywith no bead or mail; a pull request that is open, or that cannot be read, at the baseline is news later; a marker that cannot be written fails the run. 2:missingcomes only after the repository reads fine, and a 404 or other failure on the repository settles nothing and fails the run. 3:tellOperatorandhandOverAll, with one listing bead and one mail per kind above three. 4:correctClosedin the baseline run, and the tests use a fake city. 5: Go tests for each case, a fragment under Fixed, and no new shell logic (tests/merge.shonly teaches its stub the marker lookup).origin/main(739c65a, #53, which landed after the rebase and touchesschedule.go,schedule_test.go,README.mdandCHANGELOG.md): clean. The forge also saysmergeable.go vet ./...,go test ./...andgo test -race ./...inforgejo/assets/forgejopass.tests/formula.sh,reviewer.sh,worktree-setup.sh,worktree.sh,gnu-tools.sh,merge.sh,apply.sh,upgrade.sh,view-beads.sh,view-mail.sh,permission-deny.shandpermission-request.shall exit 0. The changelog checker built from mikluko/changelog v2.0.1 source (what thevalidate@v2tag points to) with-base maingivesvalid=true.gc lint .was not run locally; the head's own CI checks aresuccess.