Refuse chunk-pr merge while a scoring run the plan calls is unrecorded, and call one for a release cut with none
CI / tests (pull_request) Successful in 2m15s

This commit is contained in:
2026-11-10 23:45:06 +01:00
parent 0301ca01c4
commit 92867f64cd
9 changed files with 208 additions and 11 deletions
+8 -1
View File
@@ -18,7 +18,9 @@ merge merges the pull request, and only while its head is still the commit ch
push after the gate is never merged. It takes the first method the repository allows of:
a merge commit, fast-forward only, a rebase followed by a merge commit, a rebase, a squash.
GitHub offers only the merge commit, the rebase and the squash. --gate-passed says the
merge gate passed on that commit; without it, chunk-pr refuses.
merge gate passed on that commit; without it, chunk-pr refuses. It also refuses where
`larv-review scoring-run-owed` exits 1: the chunk owes a scoring run it has not recorded,
which no flag waives.
clean acts once the forge reports the branch's pull request merged at the commit checked out,
by any merge method. It fetches origin, fast-forwards the main checkout to origin's
default branch, removes the chunk's worktree, then deletes the local branch; origin's
@@ -32,6 +34,7 @@ It prints what it did, exit 0, or why it failed, exit 1.
import dataclasses
import json
import os
import pathlib
import sys
import typing
@@ -40,6 +43,7 @@ from chunk_preflight.gathered import Forge
from chunk_preflight.choices import forge_of
from deploy_release.forge import gitea, merged_pull, open_pull, Run, runner
BIN = pathlib.Path(__file__).resolve().parents[1]
USAGE = "usage: chunk-pr open <title> [<body>] | chunk-pr ready | chunk-pr merge --gate-passed | chunk-pr clean"
# Each forge's merge methods in the order merge prefers them, as the repository setting that allows the method and the method's name in the forge's merge call. A merge commit and a fast-forward keep the branch's commits as they are; a rebase or a squash rewrites them.
@@ -157,6 +161,9 @@ def merged(run: Run) -> str | Failure:
if isinstance(found, Failure):
return found
forge, number, head = found
owed = run([str(BIN / "larv-review"), "scoring-run-owed"])
if isinstance(owed, Failure):
return owed
method = merge_method(forge, run)
if isinstance(method, Failure):
return method