From 22983d23554071013fb9caaa3a018ff2b649718b Mon Sep 17 00:00:00 2001 From: aur-build Date: Tue, 17 Nov 2026 22:09:13 +0000 Subject: =?UTF-8?q?cli:=20operator=20command=20line=20with=20the=20approva?= =?UTF-8?q?l=20path=20(=C2=A77.2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit aur-build init/subscribe/detect/reviews/show/approve/reject/build/run/ builds/status/packages/audit. approve renders the review and then approves with the hashes it just rendered, so the CLI cannot approve a diff it did not show you; --identity/--diff reproduce the stale case explicitly and a refusal exits 2 (the web equivalent is 409). Approvals are now immutable at the schema level: migration 0006 rejects UPDATE and DELETE on the approval table, because that row is the only proof the system has of what a human actually looked at (ยง7.2, I10). Publishing also refuses when no approval is reachable, including the manual-rebuild path that inherits one. 10 tests, including two that drive the compiled binary end to end against a file:// AUR fixture. --- src/pipeline/publish.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/pipeline/publish.rs') diff --git a/src/pipeline/publish.rs b/src/pipeline/publish.rs index 639d717..5d03a06 100644 --- a/src/pipeline/publish.rs +++ b/src/pipeline/publish.rs @@ -152,19 +152,21 @@ fn commit_release(ctx: &Ctx, collect: &Collect) -> Result { }; // I1: nothing publishes without an approval. A manual rebuild inherits the // approval of the release it rebuilds. - let approval_id = match (approval_id, ctx.build.kind.as_str()) { - (Some(a), _) => Some(a), - (None, "manual_rebuild") => ctx + let inherited = match ctx.build.kind.as_str() { + "manual_rebuild" => ctx .build .release_id .and_then(|rid| db::release_by_id(&ctx.db, rid).ok().flatten()) .and_then(|r| r.approval_id), - (None, other) => { - return Err(Error::fail_closed(format!( - "refusing to publish a {other} build with no approval behind it" - ))) - } + _ => None, }; + let approval_id = approval_id.or(inherited).ok_or_else(|| { + Error::fail_closed(format!( + "refusing to publish a {} build with no approval behind it", + ctx.build.kind + )) + })?; + let build_id = ctx.build.id.clone(); let packages = collect.packages.clone(); let names: Vec = packages.iter().map(|p| p.name.clone()).collect(); -- cgit v1.2.3