summaryrefslogtreecommitdiffstats
path: root/src/watch/upstream.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 17:09:59 +0000
committeraur-build <aur-build@localhost>2026-11-19 17:09:59 +0000
commite757979f1a2afdbe7146066345bb9acd19d3b151 (patch)
tree30d5f5fbccd25ea7bf01c5202684af463b74e7d3 /src/watch/upstream.rs
parent94c318f13264bb3c00a9f3057ba2e1aafb57c9e4 (diff)
downloadaur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.tar.gz
aur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.zip
comments: say why, not what
Every module-level `//!` header is gone, and the comments that remained either re-explained the line below them or had grown into paragraphs. Density went from one comment line per 6.7 lines of code to one per 10. 827 insertions against 2194 deletions across 86 files. What survived: the invariants (I1-I12), the design cross-references into DESIGN.md, and the notes recording a bug that was found and fixed — those are the comments that carry weight, because they answer a question the code cannot answer about itself. What did not: restating a function signature in prose, and narration of the statement underneath.
Diffstat (limited to 'src/watch/upstream.rs')
-rw-r--r--src/watch/upstream.rs28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/watch/upstream.rs b/src/watch/upstream.rs
index c2772a2..507d734 100644
--- a/src/watch/upstream.rs
+++ b/src/watch/upstream.rs
@@ -1,20 +1,3 @@
-//! The two-stage VCS watcher (§5.2) — the expensive path, made cheap.
-//!
-//! For a `-git` package the `pkgver=` field is frozen and the real version is
-//! computed by `pkgver()` at build time, so detection cannot read it off the
-//! recipe. Running the real thing every poll would be absurd, so:
-//!
-//! **Stage A** asks each upstream where its tip is now (`git ls-remote`, which
-//! costs one network round trip and no clone). If the set of tips is identical
-//! to the set recorded on the accepted release, *nothing can have changed* and
-//! we stop. This is the common case: most days, nothing moves.
-//!
-//! **Stage B** runs only when Stage A saw movement: clone/fetch into the
-//! persistent cache, run `makepkg --vercheck` against the recipe, and read back
-//! the computed `epoch:pkgver-pkgrel` — the only correct answer, because
-//! `pkgver()` can do arbitrary things. The clone is already there, so this is
-//! also where the pins are captured.
-
use std::collections::BTreeSet;
use std::path::PathBuf;
use std::process::Command;
@@ -148,9 +131,8 @@ impl StageB {
}
}
-/// A process-wide cap on concurrent Stage B resolutions (§5.2 "a global
-/// concurrency cap"). Each one clones repositories and runs a chroot-less
-/// makepkg; letting twenty run at once would be silly.
+/// A process-wide cap on concurrent Stage B resolutions (§5.2). Each one clones
+/// repositories and runs a chroot-less makepkg.
static RUNNING: AtomicUsize = AtomicUsize::new(0);
static SLOT_FREE: Condvar = Condvar::new();
static SLOT_LOCK: Mutex<()> = Mutex::new(());
@@ -205,9 +187,9 @@ pub fn resolve(
return Ok(Some(StageB::from_cache(hit)));
}
- // Per-pkgbase cooldown: even if the tips moved again, we do not re-resolve
- // the same pkgbase more than once per cooldown window. The previous answer
- // is reused, so a chatty upstream cannot turn detection into a build loop.
+ // Per-pkgbase cooldown: even if the tips moved again, we do not re-resolve the
+ // same pkgbase more than once per window, so a chatty upstream cannot turn
+ // detection into a build loop.
let cooldown = db::setting_i64(db, "stage_b_cooldown", 86400);
if let Some(recent) = db::stage_b_recent(db, pb.id, cooldown)? {
return Ok(Some(StageB::from_cache(recent)));