Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) #62

Merged
merge-queue merged 2 commits from mq-11-batch-anvil into main 2026-12-01 05:21:15 -08:00
Owner

Step 5c of anvil stage 6b (https://openproject.home.romaine.life/wp/MQ-11): a landing's apps, built ahead by the prebuild, end their release runs as complete drafts and are delivered together in one pipeline-templates deliver.yml run, so each PC installs the batch in one at-update pass. This is anvil's half of the contract pipeline-templates' release/batch.mjs already holds (pipeline-templates v0.1.6).

Added: batch.go.

  • A landing's batch holds each app (app topic) whose planned commit the landing pushes, or writes with the plan's message after its branch moved. Not held: an app with an external part (release-external: a callback run completes its draft and never batches), and the library's own merge (it carries no trailer, so its run never batches).
  • The race, closed: Forgejo refuses a status on a commit it doesn't have (404), so before each push the member is kept on the volume, the commit is pushed to refs/anvil/delivery/<commit> on Forgejo (a ref outside branches and tags: no push event, webhook or workflow), the pending merge-queue / delivery status ("delivered with 's batch") goes on it, and only then is the branch pushed. No release run of the commit can exist before its status. The staging ref is deleted once the branch has it. A post that answers an error is read back: if Forgejo kept it the commit stays held. A push that races or fails takes the commit out of the batch and settles its status success.
  • Each member's release run is followed: held (succeeded, its release a finalized draft), self (its run published it), none (no release), failed (failed or cancelled, or abandoned: jobs left blocked behind a failed one, the queue's markAbandoned). A run that never starts is ended by POST /landings/clear, which settles the batch too.
  • Each member's status is posted until Forgejo takes it (the batch keeps which one it took), so no commit is left pending by a lost write; a batch is done only once every status is final.
  • Once no member can join (every bump of the landing written, or the landing done) and none is unsettled: deliver.yml on pipeline-templates' main with {"version":1,"landing","releases":[{"repo","tag"}]} (held ones only). A run already started for the landing (found by its batch input in its event) is adopted instead, so a lost dispatch answer or a restart never starts two. Held statuses go pending linking the run, the landing's PR gets a comment; the result is the run's deliver job's (its prune job is cleanup). No held member: nothing dispatched.
  • Kept on the volume (DATA_DIR/batches), each write whole and one at a time; a file that can't be read is set aside (.unreadable), the rest read. Every step re-reads each run a batch waits on; steps come from member release run events, any run event in pipeline-templates while a batch goes, and each landings step. Metrics merge_queue_batches_total{outcome}, merge_queue_batch_members_total{outcome}, merge_queue_batch_size; GET /batches inside the cluster.

Changed:

  • landing.go: the planned push and the written bump hold the delivery before their push and report how it went; each landings step pokes the batches; closedTo (no bump left to write, from the lines' snapshot); ReleaseRunOf gives the release run's number; writeWhole writes beside its place under a name of its own, so two writes never share one (landings and plans use it too).
  • landingview.go: a hand clear tells the batch.
  • webhook.go: a run event in a batch member's repository, or in pipeline-templates while a batch goes, steps the batches.
  • metrics.go: histograms can be registered beside the decide one.
  • main.go: the batches start after the prepared landings; /batches route.
  • README: a Batched delivery section, the events table, observability and DATA_DIR.

Tests (batch_test.go), each failing with its fix reverted: three apps (draft, self-published, failed) give one dispatch naming only the draft, each pending status posted while main was still the parent on a commit Forgejo already had; a failed status post is posted again; the deliver job's success delivers while its run prunes or its prune fails; a restart before the runs end and after the dispatch dispatches once, and a lost dispatch answer is adopted, not repeated; an abandoned member run fails and the batch goes out while the landing still waits, on a step brought by a pipeline-templates run event; a cleared landing settles its batch; a status Forgejo kept despite an error stays held; no hold for non-apps, an app with an external part, or the library's merge; concurrent saves leave the last state and an unreadable file is set aside. The prepared-landing fixture runs with batches, and the main-moved test checks the written bump is held.

Left alone: prepare.go and the plan format, the queue's lines and merges, the module proxy, the k8s/ route (/batches is in-cluster only).

Needs before it does anything live: pipeline-templates' write integration must admit deliver.yml (nelsong6/openbao#112), or the batch's run gets no token to publish the drafts.

🤖 Generated with Claude Code

Step 5c of anvil stage 6b (https://openproject.home.romaine.life/wp/MQ-11): a landing's apps, built ahead by the prebuild, end their release runs as complete drafts and are delivered together in one pipeline-templates `deliver.yml` run, so each PC installs the batch in one at-update pass. This is anvil's half of the contract pipeline-templates' `release/batch.mjs` already holds (pipeline-templates v0.1.6). **Added: `batch.go`.** - A landing's batch holds each app (`app` topic) whose planned commit the landing pushes, or writes with the plan's message after its branch moved. Not held: an app with an external part (`release-external`: a callback run completes its draft and never batches), and the library's own merge (it carries no trailer, so its run never batches). - **The race, closed:** Forgejo refuses a status on a commit it doesn't have (404), so before each push the member is kept on the volume, the commit is pushed to `refs/anvil/delivery/<commit>` on Forgejo (a ref outside branches and tags: no push event, webhook or workflow), the pending `merge-queue / delivery` status ("delivered with <landing>'s batch") goes on it, and only then is the branch pushed. No release run of the commit can exist before its status. The staging ref is deleted once the branch has it. A post that answers an error is read back: if Forgejo kept it the commit stays held. A push that races or fails takes the commit out of the batch and settles its status `success`. - Each member's release run is followed: `held` (succeeded, its release a finalized draft), `self` (its run published it), `none` (no release), `failed` (failed or cancelled, or abandoned: jobs left blocked behind a failed one, the queue's `markAbandoned`). A run that never starts is ended by `POST /landings/clear`, which settles the batch too. - Each member's status is posted until Forgejo takes it (the batch keeps which one it took), so no commit is left pending by a lost write; a batch is done only once every status is final. - Once no member can join (every bump of the landing written, or the landing done) and none is unsettled: `deliver.yml` on pipeline-templates' `main` with `{"version":1,"landing","releases":[{"repo","tag"}]}` (held ones only). A run already started for the landing (found by its `batch` input in its event) is adopted instead, so a lost dispatch answer or a restart never starts two. Held statuses go pending linking the run, the landing's PR gets a comment; the result is the run's `deliver` job's (its `prune` job is cleanup). No held member: nothing dispatched. - Kept on the volume (`DATA_DIR/batches`), each write whole and one at a time; a file that can't be read is set aside (`.unreadable`), the rest read. Every step re-reads each run a batch waits on; steps come from member release run events, any run event in pipeline-templates while a batch goes, and each landings step. Metrics `merge_queue_batches_total{outcome}`, `merge_queue_batch_members_total{outcome}`, `merge_queue_batch_size`; `GET /batches` inside the cluster. **Changed:** - `landing.go`: the planned push and the written bump hold the delivery before their push and report how it went; each landings step pokes the batches; `closedTo` (no bump left to write, from the lines' snapshot); `ReleaseRunOf` gives the release run's number; `writeWhole` writes beside its place under a name of its own, so two writes never share one (landings and plans use it too). - `landingview.go`: a hand clear tells the batch. - `webhook.go`: a run event in a batch member's repository, or in pipeline-templates while a batch goes, steps the batches. - `metrics.go`: histograms can be registered beside the decide one. - `main.go`: the batches start after the prepared landings; `/batches` route. - README: a Batched delivery section, the events table, observability and `DATA_DIR`. **Tests (`batch_test.go`), each failing with its fix reverted:** three apps (draft, self-published, failed) give one dispatch naming only the draft, each pending status posted while `main` was still the parent on a commit Forgejo already had; a failed status post is posted again; the deliver job's success delivers while its run prunes or its prune fails; a restart before the runs end and after the dispatch dispatches once, and a lost dispatch answer is adopted, not repeated; an abandoned member run fails and the batch goes out while the landing still waits, on a step brought by a pipeline-templates run event; a cleared landing settles its batch; a status Forgejo kept despite an error stays held; no hold for non-apps, an app with an external part, or the library's merge; concurrent saves leave the last state and an unreadable file is set aside. The prepared-landing fixture runs with batches, and the main-moved test checks the written bump is held. **Left alone:** prepare.go and the plan format, the queue's lines and merges, the module proxy, the `k8s/` route (`/batches` is in-cluster only). **Needs before it does anything live:** pipeline-templates' write integration must admit `deliver.yml` (https://forgejo.romaine.life/nelsong6/openbao/pulls/112), or the batch's run gets no token to publish the drafts. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c)
All checks were successful
Suite default / check-fetches (pull_request) Has been skipped
Suite cluster-service / check-manifests (pull_request) Has been skipped
Suite go / check-test-windows (pull_request) Has been skipped
Suite go / check-services (pull_request) Has been skipped
Suite default / reused-checks (pull_request) Successful in 7s
Suite cluster-service / scope (pull_request) Successful in 10s
Suite go / check-format (pull_request) Successful in 10s
Suite cluster-service / scope (push) Has been skipped
Suite cluster-service / check-manifests (push) Has been skipped
Suite cluster-service / check-image (push) Has been skipped
Suite cluster-service / check-smoke (push) Has been skipped
Suite cluster-service / publish (push) Has been skipped
Suite cluster-service / reused-checks (push) Has been skipped
Suite go / scope (pull_request) Successful in 9s
Suite default / scope (pull_request) Successful in 10s
Suite cluster-service / check-smoke (pull_request) Has been skipped
Suite cluster-service / publish (pull_request) Has been skipped
Suite go / check-test-linux (pull_request) Successful in 1m54s
Suite go / reused-checks (pull_request) Successful in 5s
Suite default / check-rules (pull_request) Successful in 8s
Suite default / check-logs (pull_request) Successful in 8s
Suite cluster-service / check-image (pull_request) Successful in 1m4s
Suite cluster-service / reused-checks (pull_request) Successful in 7s
3d1556ef3a
Batched delivery after review: statuses posted until taken, holds kept when Forgejo kept them, ordered batch writes, abandoned runs and a closed landing settle a batch, no library or external-part holds, the deliver job's result, a lost dispatch adopted (MQ-11 step 5c)
All checks were successful
Suite default / scope (pull_request) Successful in 4s
Suite go / scope (pull_request) Successful in 4s
Suite go / check-test-windows (pull_request) Has been skipped
Suite go / check-services (pull_request) Has been skipped
Suite default / check-logs (pull_request) Successful in 5s
Suite go / check-format (pull_request) Successful in 6s
Suite default / reused-checks (pull_request) Successful in 5s
Suite cluster-service / publish (push) Has been skipped
Suite cluster-service / scope (push) Has been skipped
Suite cluster-service / check-manifests (push) Has been skipped
Suite cluster-service / check-image (push) Has been skipped
Suite cluster-service / check-smoke (push) Has been skipped
Suite cluster-service / reused-checks (push) Has been skipped
Suite go / check-test-linux (pull_request) Successful in 1m18s
Suite default / check-fetches (pull_request) Has been skipped
Suite cluster-service / check-manifests (pull_request) Has been skipped
Suite cluster-service / check-smoke (pull_request) Has been skipped
Suite cluster-service / publish (pull_request) Has been skipped
Suite cluster-service / scope (pull_request) Successful in 5s
Suite default / check-rules (pull_request) Successful in 5s
Suite go / reused-checks (pull_request) Successful in 3s
merge-queue landed on main
Suite cluster-service / check-image (pull_request) Successful in 42s
Suite cluster-service / reused-checks (pull_request) Successful in 4s
43bf8c8c1a
merge-queue deleted branch mq-11-batch-anvil 2026-12-01 05:21:15 -08:00
Sign in to join this conversation.
No reviewers
No labels
queue
No milestone
No project
No assignees
1 participant
Notifications
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
romaine-life/merge-queue!62
No description provided.