summaryrefslogtreecommitdiffstats
path: root/src/review/candidates.rs
diff options
context:
space:
mode:
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),