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/review/candidates.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/review') diff --git a/src/review/candidates.rs b/src/review/candidates.rs index 4dc6c4f..566434b 100644 --- a/src/review/candidates.rs +++ b/src/review/candidates.rs @@ -142,6 +142,26 @@ impl NewCandidate { } } +/// Every candidate regardless of state, newest first (`aur-build reviews --all`). +pub fn all_candidates(db: &Db) -> Result> { + db.read(|c| { + let mut stmt = c.prepare( + "SELECT c.id, c.pkgbase_id, c.base_release_id, c.kind, c.snapshot_id, c.epoch, c.pkgver, + c.pkgrel, c.upstream_pins_json, c.source_digests_json, c.identity_hash, + c.diff_digest, c.revision, c.viewed_at, c.risk_level, c.risk_signals_json, + c.missing_deps_json, c.state, c.detected_at, c.resolved_at, b.name + FROM candidate c JOIN pkgbase b ON b.id = c.pkgbase_id + ORDER BY c.detected_at DESC LIMIT 500", + )?; + let rows = stmt.query_map([], row_to_candidate)?; + let mut out = Vec::new(); + for r in rows { + out.push(r?); + } + Ok(out) + }) +} + /// Mark a candidate `viewed` the first time a human opens it. That timestamp is /// what decides whether a later detection collapses or supersedes (§7.1). pub fn mark_viewed(db: &Db, id: i64) -> Result<()> { -- cgit v1.2.3