summaryrefslogtreecommitdiffstats
path: root/src/review/candidates.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/review/candidates.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/review/candidates.rs')
-rw-r--r--src/review/candidates.rs21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/review/candidates.rs b/src/review/candidates.rs
index 7cedf4b..d4c49e8 100644
--- a/src/review/candidates.rs
+++ b/src/review/candidates.rs
@@ -1,15 +1,3 @@
-//! Candidate creation and the collapse-in-place rule (§7.1).
-//!
-//! One review object per pkgbase at a time. A newer detection **collapses into**
-//! the open review rather than queueing beside it, and the review's `base` is
-//! fixed at creation to the pkgbase's `current_accepted_release` — that is what
-//! makes "diff against the last accepted version, never the last seen one" (I2)
-//! true no matter how many detections arrive while nobody is looking.
-//!
-//! This module is the *rule*, not the SQL: every statement it needs lives in
-//! `db::candidates` and is called through the transaction handle, so the whole
-//! decision is atomic and the schema still has one owner.
-
use crate::db::{self, candidates as sql, Db, Pkgbase, ReleaseRow};
use crate::error::Result;
@@ -49,22 +37,20 @@ pub fn upsert_candidate(db: &Db, pb: &Pkgbase, accepted: Option<&ReleaseRow>, nc
return Ok(Upsert::Unchanged);
}
if !open.viewed() {
- // Collapse in place: same base, no new row, revision bumped.
let revision = sql::collapse_in(tx, &open, &nc)?;
return Ok(Upsert::Collapsed { id: open.id, revision });
}
- // A human saw the old diff: freeze it for the audit trail and open a
- // fresh review against the same base.
+ // A human saw the old diff: freeze it for the audit trail and open
+ // a fresh review against the same base.
sql::supersede_in(tx, open.id)?;
let new_id = sql::insert_in(tx, pkgbase_id, base, kind, &nc)?;
return Ok(Upsert::Superseded { old: open.id, new: new_id });
}
- // No open review. A previously rejected identity must not be re-raised.
+ // A previously rejected identity must not be re-raised.
if sql::rejected_before_in(tx, pkgbase_id, &nc.identity_hash)? {
return Ok(Upsert::PreviouslyRejected);
}
- // Same identity already approved/recorded: nothing to do.
if sql::recorded_before_in(tx, pkgbase_id, &nc.identity_hash)? {
return Ok(Upsert::Unchanged);
}
@@ -73,7 +59,6 @@ pub fn upsert_candidate(db: &Db, pb: &Pkgbase, accepted: Option<&ReleaseRow>, nc
})
}
-/// Convenience used by the watcher: the accepted release of a pkgbase row.
pub fn accepted_for(db: &Db, pb: &Pkgbase) -> Result<Option<ReleaseRow>> {
match pb.current_accepted_release_id {
Some(id) => db::release_by_id(db, id),