From f3e4c1496d2ddcdae535132427fdb499181f1695 Mon Sep 17 00:00:00 2001 From: aur-build Date: Wed, 18 Nov 2026 17:25:41 +0000 Subject: review: one host rule, one body rule, one audit constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit m-2. `hosts` existed twice, verbatim, in `review::diff` and `review::risk`. The duplication that matters is the other one: "did the executable part of the recipe change" also existed twice, with *different* semantics. The risk scorer compared everything from the first function definition onward; the diff panel compared only the lines that name a function, so a `build()` rewritten to `curl … | sh` under the same function names told the risk scorer "code changed, high" and told the reviewer nothing at all — the one reader who could have caught it. Both questions now have one answer: `urlutil::hosts` (which also strips the `git@` from ssh URLs, so a scheme change stops crying "new source host" wolf) and `recipe::bodies_changed`, in the module that owns the recipe. m-4. The three review decisions each hand-built an `AuditEntry` literal, and their `detail` shapes drifted: approve recorded the identity hash, reject recorded only the note, withdraw only the reason — so for two of the three the log cannot answer which candidate bytes the decision was about. `AuditEntry` is built by `::human` / `::system` now, and reject records the identity hash it rejected. m-3, the four-times-copied 21-column candidate `SELECT`, was already gone: the `CANDIDATE_COLS` constant came with moving the candidate SQL into `db/` in an earlier commit. Tests: the body rule is pinned at the unit level with the exact drift case (same function names, different body), `tests/production_surface.rs` fails if either module grows a private copy again or if an audit row is hand-built, and the reject test reads its own audit row back and requires the identity in it. --- tests/approve.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/approve.rs') diff --git a/tests/approve.rs b/tests/approve.rs index 1f61182..f1fc762 100644 --- a/tests/approve.rs +++ b/tests/approve.rs @@ -245,6 +245,25 @@ fn reject_requires_a_reason_and_records_it() { }) .unwrap(); assert!(note.contains("license"), "{note}"); + + // And the audit row says *which review* was rejected, not only why (§6 m-4): + // the three review actions each hand-built their own `detail`, and two of + // them recorded no identity at all. + let (actor_kind, detail): (String, String) = env + .db + .read(|c| { + Ok(c.query_row( + "SELECT actor_kind, detail_json FROM audit WHERE action='reject' AND entity_id=?1", + rusqlite::params![cid.to_string()], + |r| Ok((r.get(0)?, r.get(1)?)), + )?) + }) + .unwrap(); + assert_eq!(actor_kind, "human"); + assert!( + detail.contains(&c.identity_hash), + "the audit row does not say which review bytes were rejected: {detail}" + ); } // ------------------------------------------------------------- the CLI path -- -- cgit v1.2.3