summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-21 11:05:43 +0000
committeraur-build <aur-build@localhost>2026-11-21 11:05:43 +0000
commit7ccfb9a8f96b6f3000f36bdf76d95a4f6afd2826 (patch)
tree710a12ec5cc6e2e93d717787dccc7660ddc4b5ba /src
parentd3da3a1882999a80db34089153f9684fd8d7bbee (diff)
downloadaur-build-7ccfb9a8f96b6f3000f36bdf76d95a4f6afd2826.tar.gz
aur-build-7ccfb9a8f96b6f3000f36bdf76d95a4f6afd2826.zip
db: delete two candidate queries nothing in production calls
`open_reviews_for` and `reopen_rejected` were both declared in `db`, both re-exported by `review::candidates`, and both reached by nobody in `src`. The auditor found them; the reason they stayed invisible is in the next commit. `reopen_rejected` is simply gone: no caller, no test, nothing to lose. `open_reviews_for` was a test convenience — `tests/detect.rs` used it to fetch "the pending candidate for this pkgbase". The production query `pending` already returns pending candidates and `CandidateRow` carries `pkgbase_id`, so the test now filters that instead. Same assertion, same rows, one fewer public function that existed only because a test wanted it.
Diffstat (limited to 'src')
-rw-r--r--src/db/candidates.rs30
-rw-r--r--src/review/candidates.rs4
2 files changed, 2 insertions, 32 deletions
diff --git a/src/db/candidates.rs b/src/db/candidates.rs
index 10d39bf..e2f011c 100644
--- a/src/db/candidates.rs
+++ b/src/db/candidates.rs
@@ -288,22 +288,6 @@ pub fn by_id(db: &Db, id: i64) -> Result<Option<CandidateRow>> {
})
}
-pub fn open_reviews_for(db: &Db, pkgbase_id: i64) -> Result<Vec<CandidateRow>> {
- let sql = format!(
- "SELECT {CANDIDATE_COLS} FROM candidate c JOIN pkgbase b ON b.id = c.pkgbase_id \
- WHERE c.pkgbase_id=?1 AND c.state='pending_review'"
- );
- db.read(move |c| {
- let mut stmt = c.prepare(&sql)?;
- let rows = stmt.query_map(params![pkgbase_id], row_to_candidate)?;
- let mut out = Vec::new();
- for r in rows {
- out.push(r?);
- }
- Ok(out)
- })
-}
-
// ---------------------------------------------------------------- writes --
pub fn mark_viewed(db: &Db, id: i64) -> Result<()> {
@@ -317,20 +301,6 @@ pub fn mark_viewed(db: &Db, id: i64) -> Result<()> {
})
}
-pub fn reopen_rejected(db: &Db, id: i64) -> Result<()> {
- let at = time::now();
- db.writer.tx(move |tx| {
- let n = tx.execute(
- "UPDATE candidate SET state='superseded', resolved_at=?1 WHERE id=?2 AND state='rejected'",
- params![at, id],
- )?;
- if n == 0 {
- return Err(Error::conflict("candidate is not rejected"));
- }
- Ok(())
- })
-}
-
pub fn set_risk(db: &Db, id: i64, level: &str, signals: &[String]) -> Result<()> {
let lvl = level.to_string();
let sig = serde_json::to_string(signals)?;
diff --git a/src/review/candidates.rs b/src/review/candidates.rs
index 59db99b..236f85b 100644
--- a/src/review/candidates.rs
+++ b/src/review/candidates.rs
@@ -2,8 +2,8 @@ use crate::db::{self, candidates as sql, Db, Pkgbase, ReleaseRow};
use crate::error::Result;
pub use crate::db::candidates::{
- all as all_candidates, by_id as candidate_by_id, mark_viewed, open_reviews_for, pending as pending_candidates,
- reopen_rejected, set_diff_digest, NewCandidate,
+ all as all_candidates, by_id as candidate_by_id, mark_viewed, pending as pending_candidates,
+ set_diff_digest, NewCandidate,
};
#[derive(Debug, Clone, PartialEq, Eq)]