Tighten six guard, usage, runner and dupe-group edge cases

Item and repo writes no longer accept a PR grant; a push refuses an ask or rerun grant. Claude steps write a usage row only when a call answered. The runner checks the group and claims the job in one transaction. A duplicate close computes a missing text hash and skips when the text changed. A batch PR with no members is not in scope. safe-merge refuses an empty --head.
This commit is contained in:
aiongg committed 2026-11-04 11:56:47 +00:00
1 parent 9438f77989
commit e2ddcd6ed3
8 files changed
+29 -13

No files matched your search

+3 -1
View File
@@ -32,7 +32,7 @@ const repoName = (slug: string): string => (slug.startsWith(`${ORG}/`) ? slug.sl
const refOf = (repo: string, number: number): string => `${repo}#${number}`;
/** A grant covers writes to its own repo (and, for a PR or item grant, its own number); a write elsewhere is a bug. */
function covers(g: Grant, repo: string, number?: number): void {
function covers(g: Guarded | Grant, repo: string, number?: number): void {
if (g.repo !== repo || (number !== undefined && "number" in g && g.number !== number)) throw new Error(`the guard covers ${g.repo}${"number" in g ? `#${g.number}` : ""}, not ${repo}${number === undefined ? "" : `#${number}`}`);
}
@@ -271,6 +271,8 @@ export function ghRerunMainFailed(w: Writer, g: GuardedRepo, exec: Exec, o: { re
/** Pushes `sha` to a PR's branch `branch` of `remote` (owner/name); refused by git when the branch is no longer at the guarded head. */
export function pushBranch(w: Writer, git: Pick<Git, "git">, action: string, g: Guarded<AskKind>, o: { remote: string; branch: string; sha: string }, details: Details = {}): Promise<ExecResult> {
const b = g.action.bucket;
if ((g.action.kind === "fixup" && b === "ask") || (g.action.kind === "cifix" && b === "rerun")) throw new Error(`a ${g.action.kind}:${b} grant does not allow a push`);
return pushed(w, git, action, refOf(g.repo, g.number), o, `--force-with-lease=refs/heads/${o.branch}:${g.head}`, details);
}