diff options
| author | aur-build <aur-build@localhost> | 2026-11-19 17:33:17 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-19 17:33:17 +0000 |
| commit | 4304b0f336ddba7b4ec6780795059ff2066d105b (patch) | |
| tree | 10edea744a1c2bf3fc363b4dc7f64abac8b1a0d3 /src/review/approve.rs | |
| parent | e757979f1a2afdbe7146066345bb9acd19d3b151 (diff) | |
| download | aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.tar.gz aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.zip | |
comments: keep only what the code cannot show
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.
Diffstat (limited to 'src/review/approve.rs')
| -rw-r--r-- | src/review/approve.rs | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/src/review/approve.rs b/src/review/approve.rs index c8cd99d..23afee3 100644 --- a/src/review/approve.rs +++ b/src/review/approve.rs @@ -2,8 +2,6 @@ use crate::db::{self, approvals, candidates, CandidateState, *}; use crate::error::{Error, Result}; use crate::time; -/// Why an approval was refused (§7.1a). Rendered as HTTP 409 with the current -/// diff, plus a CLI message. #[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)] pub enum Stale { #[error("review is no longer pending (state: {state})")] @@ -12,7 +10,6 @@ pub enum Stale { Identity { expected: String, actual: String }, #[error("the diff changed while you were looking (shown {expected}, now {actual})")] Diff { expected: String, actual: String }, - /// The base moved: a newer version was accepted while the review was open. #[error("a newer version was accepted since this review was opened")] Base { expected: Option<i64>, actual: Option<i64> }, } @@ -27,24 +24,14 @@ pub struct Approval { pub identity_hash: String, } -/// Why a decision did not happen (§7.1a, §6 M-3). -/// -/// Two families, and the difference is the whole point: `Stale` means the -/// reviewer's screen no longer matches the database, so the answer is to look -/// again; `System` means the database itself refused, and looking again changes -/// nothing. #[derive(Debug, thiserror::Error)] pub enum ApproveError { - /// What is stored is not what was displayed. #[error(transparent)] Stale(#[from] Stale), - /// The write itself failed; nothing about the review is at fault. #[error("the decision could not be recorded: {0}")] System(#[from] Error), } -/// Approve a candidate. Returns the approval row on success, or the reason the -/// approval was refused. pub fn approve( db: &Db, actor: &str, @@ -75,7 +62,6 @@ pub fn approve( if subject.diff_digest != dd { return Ok(Err(ApproveError::Stale(Stale::Diff { expected: dd.clone(), actual: subject.diff_digest }))); } - // Base is still the accepted release (I2, end to end). if base != current_base { return Ok(Err(ApproveError::Stale(Stale::Base { expected: base, actual: current_base }))); } @@ -114,12 +100,9 @@ pub fn approve( identity_hash: ih, })) }) - // A failed transaction is a system failure, never a stale review. .map_err(ApproveError::System)? } -/// Reject a candidate. Rejection is remembered per identity so the watcher stops -/// nagging about the same version (§7.1), and can be re-opened later. pub fn reject(db: &Db, actor: &str, candidate_id: i64, note: &str) -> Result<()> { let actor = actor.to_string(); let note = note.to_string(); @@ -149,11 +132,8 @@ pub fn reject(db: &Db, actor: &str, candidate_id: i64, note: &str) -> Result<()> }) } -/// One item of a bulk decision, and what happened to it (§7.4). #[derive(Debug)] pub struct BulkItem { - /// `None` when the id matched nothing — which a caller must be able to - /// report, so the row cannot be the key. pub candidate: Option<CandidateRow>, pub outcome: BulkOutcome, } @@ -164,47 +144,31 @@ impl BulkItem { } } -/// What a bulk decision did with one item (§7.4). #[derive(Debug)] pub enum BulkOutcome { - /// Approved; the approval row is here so the caller can queue the build. Approved(Approval), - /// A rejection records no approval, so there is no row to hand back. Rejected, - /// Not decided, and why. Refused(BulkRefusal), } -/// Why a bulk decision skipped one of its items (§7.4). Each reason is its own -/// variant because they are different answers to give a human. #[derive(Debug, thiserror::Error)] pub enum BulkRefusal { - /// High-risk items need their own confirmation, per item (§7.4). #[error("high risk: confirm it individually")] HighRiskUnconfirmed, - /// The form said neither approve nor reject. #[error("unknown decision `{0}`")] UnknownDecision(String), - /// The review is gone — deleted, or never existed. #[error("no such review")] NotFound, - /// The review no longer matches what was displayed. #[error(transparent)] Stale(Stale), - /// The write itself failed. #[error("{0}")] System(Error), } -/// §7.4 bulk decision. High-risk items are refused unless confirmed -/// individually, and one refused item never rolls back the ones that were -/// decided. `items` carries the identity and diff each review was displayed -/// with, so the approval-echo rule applies to bulk exactly as to a single -/// approval. pub fn bulk( db: &Db, actor: &str, - items: &[(i64, String, String)], // (candidate_id, identity_hash, diff_digest) + items: &[(i64, String, String)], decision: &str, confirmed: &[i64], ) -> Result<Vec<BulkItem>> { @@ -240,8 +204,6 @@ pub fn approval_for(db: &Db, candidate_id: i64) -> Result<Option<(i64, String)>> approvals::for_candidate(db, candidate_id) } -/// Withdraw a published release (§9 `repo-remove` path, decision 23: warns, -/// does not block). pub fn withdraw(db: &Db, actor: &str, release_id: i64, reason: &str) -> Result<()> { let actor = actor.to_string(); let reason = reason.to_string(); |
