summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-18 07:29:07 +0000
committeraur-build <aur-build@localhost>2026-11-18 07:29:07 +0000
commit04b40812f3366c71bf1c99779f880cc74b7f9efa (patch)
tree79586843b34b5a1cf703e18f2b5a35dd6814e9d6 /src/db
parent0b3cb443e70b46ec61455255c3ddfc2a26997613 (diff)
downloadaur-build-04b40812f3366c71bf1c99779f880cc74b7f9efa.tar.gz
aur-build-04b40812f3366c71bf1c99779f880cc74b7f9efa.zip
review: advisory risk scoring and non-publishable change handling (§6, §5.3, I11)
Every candidate is scored against the recipe the accepted release was actually built from (release -> candidate -> snapshot), never against 'last seen'. Signals: SKIP on a non-VCS source, a sum changed to SKIP, new source host, --skippgpcheck, removed validpgpkeys, new makedepends and fetching build tools (cargo/npm/go/pip), .install scripts, weakened options, removed checkdepends, pkgrel reset, epoch bump, downgrade, a diff touching build()/package() bodies rather than metadata, upstream ranges that touch a build-system file, and first introduction. Advisory only — there is no auto-approval, so a wrong score costs attention and never safety (§7.3). Fixes a fixture bug the new tests exposed: digest-drift and skip-checksum declared bare paths as sources, which parse as local recipe files rather than remote downloads, so the drift path never fired. They now use file:// URLs like a real remote would. tests/notices.rs: integrity_alert is high severity and leaves no candidate, pin_drift is informational, recipe drift under a static version is a warning, SKIP-on-non-VCS is a high risk signal, repeated polling of one drift is one notice, and an I11 sweep over twelve fixtures proving a change is never silently dropped.
Diffstat (limited to 'src/db')
-rw-r--r--src/db/queries.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/db/queries.rs b/src/db/queries.rs
index fe3109a..2bbd4c1 100644
--- a/src/db/queries.rs
+++ b/src/db/queries.rs
@@ -575,6 +575,28 @@ pub fn our_package_names(db: &Db) -> Result<std::collections::BTreeSet<String>>
})
}
+/// The recipe the accepted release was actually built from, by walking
+/// release -> candidate -> snapshot. Risk scoring compares against this, which
+/// is why "last seen" can never leak into a review (§6, I2).
+pub fn accepted_recipe(db: &Db, release: &ReleaseRow) -> Result<Option<Recipe>> {
+ let cid = match release.candidate_id {
+ Some(c) => c,
+ None => return Ok(None),
+ };
+ db.read(move |c| {
+ use rusqlite::OptionalExtension;
+ Ok(c.query_row(
+ "SELECT s.srcinfo_json FROM snapshot s
+ JOIN candidate cnd ON cnd.snapshot_id = s.id
+ WHERE cnd.id = ?1",
+ params![cid],
+ |r| r.get::<_, String>(0),
+ )
+ .optional()?
+ .and_then(|j| serde_json::from_str::<Recipe>(&j).ok()))
+ })
+}
+
// --------------------------------------------------------- stage B cache --
/// Exact cache hit: same recipe, same upstream tips (§5.2).