summaryrefslogtreecommitdiffstats
path: root/src/review
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-18 18:02:43 +0000
committeraur-build <aur-build@localhost>2026-11-18 18:02:43 +0000
commitc712124f214fc53a57b23c10ed98e8e869cbf7c2 (patch)
tree0f117b9643ffeaba883913a5e4e64609dd26c5d2 /src/review
parent7587284ae48fb59c59da33af928322e8a621f4b0 (diff)
downloadaur-build-c712124f214fc53a57b23c10ed98e8e869cbf7c2.tar.gz
aur-build-c712124f214fc53a57b23c10ed98e8e869cbf7c2.zip
watch, review, config: the clarity minors — no-ops, dead params, one error type
m-5. `mark_approved_but_unbuilt` was a function that did nothing, called from the failure path with a comment explaining that it did nothing. The mechanism is real — a failed build leaves the accepted pointer alone, and "approved, build failed, index still serving the old version" is what the derived query reads back — but a no-op in the failure path is a trap for whoever traces a build failure at 3am. Deleted; the explanation moved to the call site that needs it. m-6. The step loop extended the lease by a hardcoded 90 seconds while `Config` carried `lease_secs`, so an operator who raised the lease got leases that were silently reset to 90s after the first step. m-8. Dead parameters and `let _ =` debris: `upstream::run` took a `Db` it never used (and a `let _ = local;` after the value's only use), `risk::assess` took a `Pkgbase` it never used, `accepted_pins` took a `Db`, `detect::schedule_next` took a `Pkgbase` it discarded, `diff::version_delta` computed a `vercmp` and threw the answer away, and two HTTP handlers took arguments they ignored. All gone, with the callers following. m-11. `schedule_next` re-queried the subscription for `poll_interval_secs` that its caller had read moments earlier to decide whether the pkgbase was paused — two queries, and two chances to get different answers. The interval is now an argument, and the scheduler's own tick (which already holds the row) was already doing it the right way. m-15. `Config::load`/`save`/`ensure_dirs` returned `anyhow::Result` while the rest of the crate returns `error::Error`, which put two vocabularies on either side of one boundary and turned "there is no config yet, run init" — the one thing a caller can branch on — into an opaque string. They return the crate's error now; `main` keeps `anyhow` at the CLI edge, where it belongs. m-19. `skip_declared` was hardcoded `true` for VCS entries, so the field that means "the recipe gave us no checksum to trust" also meant "this is a git source", and a new `-git` source was rendered to a reviewer as `sha256sums=SKIP` — a warning about a recipe that had done nothing wrong. The field now means one thing everywhere, `SourceDigest::is_vcs()` says which integrity mechanism protects an entry, and the diff panel prints "pinned commit" for those. n-6. `recipe_at` was `pub` for no reason; it is `pub(crate)`.
Diffstat (limited to 'src/review')
-rw-r--r--src/review/diff.rs4
-rw-r--r--src/review/risk.rs13
2 files changed, 6 insertions, 11 deletions
diff --git a/src/review/diff.rs b/src/review/diff.rs
index 629258c..3eecc4e 100644
--- a/src/review/diff.rs
+++ b/src/review/diff.rs
@@ -205,7 +205,6 @@ fn version_delta(base: Option<&ReleaseRow>, c: &CandidateRow) -> Panel {
Some(b) => {
let (bv, cv) = (b.version(), c.version());
body.push_str(&format!("{bv} -> {cv}\n"));
- let ord = crate::pkgver::vercmp(&bv, &cv);
if b.epoch != c.epoch {
body.push_str(&format!("epoch bump: {} -> {}\n", b.epoch, c.epoch));
}
@@ -215,7 +214,6 @@ fn version_delta(base: Option<&ReleaseRow>, c: &CandidateRow) -> Panel {
if crate::pkgver::is_downgrade(&bv, &cv) {
body.push_str("DOWNGRADE: AUR now offers a lower version than we serve\n");
}
- let _ = ord;
}
None => body.push_str(&format!("first introduction: {}\n", c.version())),
}
@@ -240,7 +238,7 @@ fn digest_delta(base: &ReleaseRow, c: &CandidateRow) -> Panel {
n.index,
n.url,
n.kind,
- if n.skip_declared { ", sha256sums=SKIP" } else { "" }
+ if n.skip_declared && !n.is_vcs() { ", sha256sums=SKIP" } else if n.is_vcs() { ", pinned commit" } else { "" }
)),
}
}
diff --git a/src/review/risk.rs b/src/review/risk.rs
index 73f9be7..cf7069d 100644
--- a/src/review/risk.rs
+++ b/src/review/risk.rs
@@ -10,7 +10,7 @@
//! what the candidate records now — the same "never last seen" rule that makes
//! I2 true for the diff panels.
-use crate::db::{self, model::*, Db, Pkgbase};
+use crate::db::{self, model::*, Db};
use crate::error::Result;
use crate::pkgver;
@@ -48,7 +48,6 @@ impl Assessment {
pub fn assess(
db: &Db,
cfg: &crate::config::Config,
- pb: &Pkgbase,
new: &Recipe,
new_digests: &[SourceDigest],
accepted: Option<&ReleaseRow>,
@@ -93,12 +92,12 @@ pub fn assess(
// Upstream movement that touches the build system (§6): the diff is in a
// language ecosystem we cannot inspect, so say so.
if let Some(a) = accepted {
- for pin in accepted_pins(db, accepted) {
+ for pin in accepted_pins(accepted) {
if let Some(old_pin) = a.pins().into_iter().find(|p| p.index == pin.index) {
if !old_pin.commit.is_empty()
&& !pin.commit.is_empty()
&& old_pin.commit != pin.commit
- && upstream_touches_build_system(cfg, pb, &old_pin.commit, &pin.commit)
+ && upstream_touches_build_system(cfg, &old_pin.commit, &pin.commit)
{
s.add("upstream-build-system", level::MEDIUM);
}
@@ -109,8 +108,7 @@ pub fn assess(
Ok(Assessment { level: s.level(), signals: s.signals })
}
-fn accepted_pins(db: &Db, accepted: Option<&ReleaseRow>) -> Vec<UpstreamPin> {
- let _ = db;
+fn accepted_pins(accepted: Option<&ReleaseRow>) -> Vec<UpstreamPin> {
accepted.map(|a| a.pins()).unwrap_or_default()
}
@@ -193,7 +191,7 @@ fn compare_digests(
}
-fn upstream_touches_build_system(cfg: &crate::config::Config, pb: &Pkgbase, from: &str, to: &str) -> bool {
+fn upstream_touches_build_system(cfg: &crate::config::Config, from: &str, to: &str) -> bool {
// Best-effort: if we have the upstream clone cached we can ask it directly.
let cache = cfg.vcs_cache_dir();
if !cache.exists() {
@@ -204,7 +202,6 @@ fn upstream_touches_build_system(cfg: &crate::config::Config, pb: &Pkgbase, from
let path = dir.path();
if let Ok(files) = crate::git::git(Some(&path), &["diff", "--name-only", &range]) {
if files.lines().any(|f| BUILD_SYSTEM_FILES.iter().any(|b| f.ends_with(b))) {
- let _ = pb;
return true;
}
}