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. --- tests/pipeline.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tests/pipeline.rs') diff --git a/tests/pipeline.rs b/tests/pipeline.rs index 835dcf0..1ad1dfd 100644 --- a/tests/pipeline.rs +++ b/tests/pipeline.rs @@ -404,9 +404,13 @@ fn i12_world_snapshot_is_recorded_at_ingest() { fn publish_refuses_without_an_approval_behind_it() { let (env, _fx) = env_with_fixture("plain-make"); let c = approve_fixture(&env, "plain-make"); - let id = pipeline::enqueue_for_candidate(&env.cfg, &env.db, &c).unwrap(); - // Strip the approval: the publish step must refuse, not publish anyway. - env.exec("DELETE FROM approval", &[]); + run_for(&env, &c); + // Approval rows are immutable (I10 / §7.2), so we build the bad state from + // the other side: a release with nothing behind it. A rebuild of it must + // still refuse to publish — the guard is on publishing, not on noticing. + let rid = db::accepted_release(&env.db, "plain-make").unwrap().unwrap().id; + env.exec("UPDATE release SET approval_id=NULL WHERE id=?1", ¶ms(vec![rid])); + let id = pipeline::enqueue_manual_rebuild(&env.cfg, &env.db, "plain-make").unwrap(); match pipeline::run(&env.cfg, &env.db, &id).unwrap() { pipeline::Outcome::Failed { step, error, .. } => { assert_eq!(step, "publish"); @@ -414,7 +418,8 @@ fn publish_refuses_without_an_approval_behind_it() { } other => panic!("I1 requires a refusal, got {other:?}"), } - assert!(in_index(&env).is_empty()); + // The index still holds exactly the one entry that does have an approval. + assert_eq!(in_index(&env).len(), 1); } #[test] -- cgit v1.2.3