From 4304b0f336ddba7b4ec6780795059ff2066d105b Mon Sep 17 00:00:00 2001 From: aur-build Date: Thu, 19 Nov 2026 17:33:17 +0000 Subject: comments: keep only what the code cannot show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stripped every comment that described what an item does, documented its arguments or fields, or cited the design docs (§n, I-n, m-n, decision n). 2247 comments down to 83. What survives: the section dividers that segment the large modules, the secret-handling warnings, the agent wire-frame directions, and the few notes without which the code they attach to reads as redundant, reorderable, or unsound. --- src/watch/detect.rs | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) (limited to 'src/watch/detect.rs') diff --git a/src/watch/detect.rs b/src/watch/detect.rs index de1285e..800c157 100644 --- a/src/watch/detect.rs +++ b/src/watch/detect.rs @@ -8,28 +8,16 @@ use crate::time; use crate::watch::digests::resolve_sources; use crate::watch::mirror::{read_tree, sync_mirror, Sync}; -/// What one check of one pkgbase resulted in. -/// -/// Four variants mirror [`Upsert`] deliberately (n-2): `Upsert` answers the storage -/// question, `Outcome` the watcher's. `outcome_of` is the only place that knows both. #[derive(Debug, Clone)] pub enum Outcome { NoChange, - /// The subscription is paused: we look at nothing and change nothing. Paused, - /// A new review was opened. Candidate { id: i64, kind: String }, - /// The open review was updated in place (I7). Collapsed { id: i64, revision: i64 }, - /// The seen-but-unresolved review was frozen and a new one opened. Superseded { old: i64, new: i64 }, - /// Identical to something a human already rejected. PreviouslyRejected, - /// Something changed but nothing is publishable (I11). Notice { kind: String, detail: serde_json::Value }, - /// The package vanished from AUR. Gone, - /// Detection could not complete; the watcher will back off. Blocked(String), } @@ -40,12 +28,9 @@ pub struct CheckReport { pub outcome: Outcome, } -/// One full detection pass for a subscribed pkgbase. pub fn check_pkgbase(cfg: &Config, db: &Db, name: &str) -> Result { let pb = get_pkgbase(db, name)? .ok_or_else(|| crate::error::Error::not_found(format!("pkgbase {name}")))?; - // A paused subscription is not observed at all: pausing must not keep opening - // reviews nobody will act on, nor keep polling AUR. let sub = db::get_subscription(db, name)?;; let paused = sub.as_ref().map(|s| s.state == SubscriptionState::Paused).unwrap_or(false); if paused { @@ -64,8 +49,6 @@ pub fn check_pkgbase(cfg: &Config, db: &Db, name: &str) -> Result { db::set_subscription_state(&db.writer, name, SubscriptionState::Orphaned)?; return Ok(CheckReport { pkgbase: name.into(), head: String::new(), outcome: Outcome::Gone }); } - // The cheap poll saved a fetch, but we still have to look: a source can - // change its bytes without the recipe moving (§5.3). Sync::Unchanged { head } => head.clone(), Sync::Fetched { head, .. } | Sync::Cloned { head } => head.clone(), }; @@ -74,24 +57,16 @@ pub fn check_pkgbase(cfg: &Config, db: &Db, name: &str) -> Result { r } -/// When to look at this pkgbase again: its own interval if the subscription -/// carries one, otherwise the global default. The interval is an argument because -/// the caller already read the subscription row (m-11). fn schedule_next(db: &Db, name: &str, poll_interval: Option) { let interval = poll_interval.unwrap_or_else(|| crate::db::setting_i64(db, "poll_interval", 86400)); let next = time::secs_ahead(interval); - // Best-effort: a missed stamp means the scheduler looks again a tick early, - // not that a change goes unnoticed. let _ = db::note_check(&db.writer, name, &next, None); } -/// Everything after the mirror is up to date. fn analyse(cfg: &Config, db: &Db, pb: &Pkgbase, head: &str) -> Result { let mirror = cfg.mirror_path(&pb.name); let report = |outcome: Outcome| CheckReport { pkgbase: pb.name.clone(), head: head.to_string(), outcome }; - // §16 mirror divergence: if the accepted pin has vanished from our own - // mirror, hard-fail this pkgbase rather than silently re-pinning. let accepted = crate::review::candidates::accepted_for(db, pb)?; if let Some(a) = &accepted { if !crate::git::has_commit(&mirror, &a.aur_commit) { @@ -113,12 +88,8 @@ fn analyse(cfg: &Config, db: &Db, pb: &Pkgbase, head: &str) -> Result = accepted.as_ref().map(|a| a.pins()).unwrap_or_default(); - // A recipe with no VCS sources states its own version. let stage_a = if has_vcs { Some(crate::watch::upstream::probe(&recipe, &accepted_pins)?) } else { @@ -129,8 +100,6 @@ fn analyse(cfg: &Config, db: &Db, pb: &Pkgbase, head: &str) -> Result Result (r.epoch.clone(), r.pkgver.clone(), r.pkgrel.clone(), r.pins.clone()), None => (recipe.epoch.clone(), recipe.pkgver.clone(), recipe.pkgrel.clone(), Vec::new()), @@ -176,13 +143,11 @@ fn analyse(cfg: &Config, db: &Db, pb: &Pkgbase, head: &str) -> Result Result Option { } } -/// Advisory risk scoring (§6). Best-effort: a scoring failure must never lose a -/// candidate, so this logs rather than propagates. fn score( db: &Db, cfg: &Config, @@ -239,13 +200,10 @@ fn score( if let Ok(a) = crate::review::risk::assess(db, cfg, recipe, digests, accepted) { let _ = crate::review::candidates::set_risk(db, id, &a.level, &a.signals); } - // Record now what would block the build later, using the same rule the plan - // step uses, so a reviewer sees it before approving (§10.4). let missing = missing_deps(db, pb, recipe); let _ = crate::review::candidates::set_missing_deps(db, id, &missing); } -/// Dependencies that are ours to publish but are not in the index yet. fn missing_deps(db: &Db, pb: &Pkgbase, recipe: &Recipe) -> Vec { let ours = match db::our_package_names(db) { Ok(o) => o, @@ -278,8 +236,6 @@ fn outcome_of(up: Upsert) -> Outcome { } } -/// The version string did not move, so there is no review to open — but the change -/// is recorded, because a silently drifting tarball must not be invisible (§5.3). fn non_publishable( db: &Db, pb: &Pkgbase, @@ -289,9 +245,6 @@ fn non_publishable( ) -> Result { let old_digests: Vec = base.digests(); let new_digests: Vec = serde_json::from_str(&nc.source_digests_json).unwrap_or_default(); - // A local source is part of the recipe: when its bytes move, that *is* the - // recipe drift. A VCS source's digest is its pin, so upstream moving shows up - // there too, but that is ordinary drift (§5.3). let vcs_indices: std::collections::BTreeSet = recipe .source_entries .iter() @@ -312,9 +265,6 @@ fn non_publishable( let pins_changed = old_pins != new_pins; if digest_changed { - // The single most valuable detection in the system: the artifact in the - // index was built from bytes upstream no longer serves, and the version is - // unchanged. An approval would be useless, so this is an alert. let changed: Vec = changed_remote .iter() .map(|n| { @@ -350,8 +300,6 @@ fn non_publishable( )?; return Ok(Outcome::Notice { kind: notice_kind::PIN_DRIFT.into(), detail: serde_json::json!({}) }); } - // The recipe drifted under a static version: the maintainer probably forgot - // to bump pkgrel, and the user should know. db::put_notice_once( &db.writer, pb.id, -- cgit v1.2.3