summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/config.rs32
-rw-r--r--src/db/audit.rs4
-rw-r--r--src/db/builds/steps.rs1
-rw-r--r--src/db/candidates.rs6
-rw-r--r--src/db/invariants.rs2
-rw-r--r--src/db/metrics.rs2
-rw-r--r--src/db/model/build_state.rs5
-rw-r--r--src/db/model/mod.rs5
-rw-r--r--src/db/notices.rs2
-rw-r--r--src/db/packages.rs2
-rw-r--r--src/db/pkgbases.rs2
-rw-r--r--src/db/publish_writes.rs2
-rw-r--r--src/db/releases.rs2
-rw-r--r--src/db/repos.rs2
-rw-r--r--src/db/retention.rs2
-rw-r--r--src/db/settings.rs2
-rw-r--r--src/db/snapshots.rs2
-rw-r--r--src/db/stage_b.rs2
-rw-r--r--src/db/staleness.rs2
-rw-r--r--src/db/subscriptions.rs2
-rw-r--r--src/db/world.rs2
-rw-r--r--src/error.rs33
-rw-r--r--src/git.rs5
-rw-r--r--src/hash.rs4
-rw-r--r--src/http/mod.rs3
-rw-r--r--src/http/routes/mod.rs5
-rw-r--r--src/http/routes/mutations.rs2
-rw-r--r--src/http/routes/pages.rs14
-rw-r--r--src/ops.rs6
-rw-r--r--src/pipeline/dispatch.rs9
-rw-r--r--src/pipeline/mod.rs3
-rw-r--r--src/pipeline/publish.rs3
-rw-r--r--src/pipeline/steps.rs2
-rw-r--r--src/pkgver/mod.rs24
-rw-r--r--src/sandbox/kata.rs23
-rw-r--r--src/shims/mod.rs6
-rw-r--r--src/time.rs21
-rw-r--r--src/watch/mirror.rs3
-rw-r--r--src/watch/upstream.rs6
-rw-r--r--tests/approve.rs2
-rw-r--r--tests/common/mod.rs4
-rw-r--r--tests/pipeline.rs2
-rw-r--r--tests/state_machine.rs2
43 files changed, 20 insertions, 245 deletions
diff --git a/src/config.rs b/src/config.rs
index 1b9f26a..7f406a0 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -2,8 +2,7 @@ use std::path::{Path, PathBuf};
use serde::{Deserialize, Serialize};
-/// The image a build runs in when the config does not say. Only this module
-/// resolves it, so it is not part of the crate's interface.
+/// The image a build runs in when the config does not say.
const DEFAULT_SANDBOX_IMAGE: &str = "aur-build-sandbox:latest";
#[derive(Clone, Default, Serialize, Deserialize)]
@@ -91,9 +90,6 @@ impl Sandbox {
}
/// Validation consults it; the fixture-bound tests that assert it are the only outside readers.
- ///
- /// Module-internal in a production build, `pub` only under `test-support`:
- /// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn shared_workspace(&self) -> bool {
Self::shared_workspace_impl(self)
@@ -112,9 +108,8 @@ impl Sandbox {
}
}
- /// The accepted values, so a test can assert that an unknown kind names
- /// the whole valid set rather than one example of it. Serde builds the
- /// rejection message itself, so nothing in production reads this list.
+ /// The accepted values. Serde builds the rejection message itself, so
+ /// nothing in production reads this list.
#[cfg(test)]
const KINDS: [&'static str; 3] = ["loopback", "remote", "agent-sandbox"];
}
@@ -145,10 +140,8 @@ pub struct Config {
pub dispatch_tick_secs: u64,
}
-/// Test-tier only, and already half-gated: the `hooks` field that holds one and
-/// the `Default` line that fills it are both behind `test-support`, so without
-/// the gate below this type compiles into a release binary that can never
-/// construct, read, or deserialize it.
+/// Test-tier only: the `hooks` field that holds one is gated, so an ungated
+/// type here would compile into a release binary that can never construct it.
#[cfg(feature = "test-support")]
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
@@ -274,8 +267,7 @@ impl Config {
Ok(())
}
- // Everything this assembles comes from the `test-support`-gated `hooks`
- // field, so in a release build the argument and the vector are both unused.
+ // Assembled only from the `test-support`-gated `hooks` field.
#[cfg_attr(not(feature = "test-support"), allow(unused_variables))]
pub fn child_env_pairs(&self) -> Vec<(String, String)> {
#[cfg_attr(not(feature = "test-support"), allow(unused_mut))]
@@ -358,9 +350,6 @@ impl Config {
self.staging_dir().join(build_id)
}
/// The content-addressed store layout is this module's own business; a test pins where a blob lands.
- ///
- /// Module-internal in a production build, `pub` only under `test-support`:
- /// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn store_dir(&self) -> PathBuf {
Self::store_dir_impl(self)
@@ -445,10 +434,8 @@ fn slug(url: &str) -> String {
mod tests {
use super::*;
- // `Config::load` takes a directory, so parsing a config means having a file
- // on disk somewhere. The tempdir below is plumbing for that signature, not
- // something these tests are about: none of them touches the database, the
- // fixture corpus, or a subprocess.
+ // `Config::load` takes a directory, so the tempdir is plumbing for the
+ // signature, not something these parsing tests are about.
fn load_sandbox(sandbox: &str) -> Result<Config, String> {
let tmp = tempfile::tempdir().unwrap();
std::fs::write(tmp.path().join("config.json"), format!("{{\n \"sandbox\": {sandbox}\n}}\n")).unwrap();
@@ -461,9 +448,6 @@ mod tests {
Config::load(tmp.path()).map_err(|e| e.to_string())
}
- // Moved verbatim from tests/config.rs: these eleven exercise parsing,
- // validation and Debug redaction of the config itself.
-
#[test]
fn each_sandbox_kind_parses_with_its_required_fields() {
match load_sandbox(r#"{"kind":"loopback"}"#).unwrap().sandbox {
diff --git a/src/db/audit.rs b/src/db/audit.rs
index 23b20bb..433a053 100644
--- a/src/db/audit.rs
+++ b/src/db/audit.rs
@@ -4,8 +4,6 @@ use crate::db::{Db, Writer};
use crate::error::Result;
use crate::time;
-// ------------------------------------------------------------------- audit --
-
pub fn audit(
writer: &Writer,
actor_kind: &str,
@@ -80,8 +78,6 @@ pub fn audit_system(
audit(writer, "system", "", action, entity, entity_id, detail)
}
-// ------------------------------------------------------------------ audit --
-
#[derive(Debug, Clone)]
pub struct AuditRow {
pub id: i64,
diff --git a/src/db/builds/steps.rs b/src/db/builds/steps.rs
index 01faa03..bdd1d9b 100644
--- a/src/db/builds/steps.rs
+++ b/src/db/builds/steps.rs
@@ -4,7 +4,6 @@ use super::transition_in_tx;
use crate::db::{BuildState, Db, StepState};
use crate::error::{Error, Result};
use crate::time;
-// ------------------------------------------------------------- step rows --
#[derive(Debug, Clone)]
pub struct StepRow {
diff --git a/src/db/candidates.rs b/src/db/candidates.rs
index 2aca851..4bfb0bf 100644
--- a/src/db/candidates.rs
+++ b/src/db/candidates.rs
@@ -66,8 +66,6 @@ impl OpenReview {
}
}
-// ------------------------------------------------------------------ in-tx --
-
#[derive(Debug, Clone)]
pub(crate) struct ReviewSubject {
pub id: i64,
@@ -242,8 +240,6 @@ pub fn insert_in(
Ok(tx.last_insert_rowid())
}
-// ------------------------------------------------------------------ reads --
-
pub fn all(db: &Db) -> Result<Vec<CandidateRow>> {
let sql = format!("SELECT {CANDIDATE_COLS} FROM candidate c JOIN pkgbase b ON b.id = c.pkgbase_id ORDER BY c.detected_at DESC LIMIT 500");
db.read(move |c| {
@@ -278,8 +274,6 @@ pub fn by_id(db: &Db, id: i64) -> Result<Option<CandidateRow>> {
db.read(move |c| Ok(c.query_row(&sql, params![id], row_to_candidate).optional()?))
}
-// ---------------------------------------------------------------- writes --
-
pub fn mark_viewed(db: &Db, id: i64) -> Result<()> {
let at = time::now();
db.writer.tx(move |tx| {
diff --git a/src/db/invariants.rs b/src/db/invariants.rs
index 964b03c..e2e6b13 100644
--- a/src/db/invariants.rs
+++ b/src/db/invariants.rs
@@ -1,8 +1,6 @@
use crate::db::Db;
use crate::error::Result;
-// ------------------------------------------------------- invariant helpers --
-
/// Repo entries whose candidate was never approved.
///
/// Test-tier only, and deliberately so: this is an invariant the schema does
diff --git a/src/db/metrics.rs b/src/db/metrics.rs
index 6c4c519..02df6bb 100644
--- a/src/db/metrics.rs
+++ b/src/db/metrics.rs
@@ -4,8 +4,6 @@ use crate::db::Db;
use crate::error::{Error, Result};
use crate::time;
-// -------------------------------------------------------------- metrics reads --
-
fn count_rows(db: &Db, sql: &str) -> Result<i64> {
let sql = sql.to_string();
db.read(move |c| c.query_row(&sql, [], |r| r.get::<_, i64>(0)).map_err(|e| Error::db(e.to_string())))
diff --git a/src/db/model/build_state.rs b/src/db/model/build_state.rs
index 478f93a..9579f2e 100644
--- a/src/db/model/build_state.rs
+++ b/src/db/model/build_state.rs
@@ -148,11 +148,6 @@ pub const BUILD_STEPS: &[&str] =
mod tests {
use super::*;
- // Moved verbatim from tests/state_machine.rs. Both are properties of the
- // state enum itself — a column-text round trip and the shape of the
- // transition table — and neither needed the database the rest of that file
- // was built around.
-
#[test]
fn every_state_round_trips_through_its_column_text() {
for s in BuildState::ALL {
diff --git a/src/db/model/mod.rs b/src/db/model/mod.rs
index df861da..706cb48 100644
--- a/src/db/model/mod.rs
+++ b/src/db/model/mod.rs
@@ -220,11 +220,6 @@ pub use state::{candidate_kind, notice_kind, CandidateState, SubscriptionState};
mod tests {
use super::*;
- // Moved verbatim from tests/hash.rs, where it sat next to the canonical
- // JSON tests but asserted nothing about hashing: it pins the contract that
- // the identity digest is a pure function of the identity's own fields.
- // That is a property of `Identity`, so it lives with `Identity`.
-
#[test]
fn the_identity_digest_is_a_function_of_the_identity_alone() {
let base = Identity {
diff --git a/src/db/notices.rs b/src/db/notices.rs
index 795f736..45638b3 100644
--- a/src/db/notices.rs
+++ b/src/db/notices.rs
@@ -4,8 +4,6 @@ use crate::db::{Db, Writer};
use crate::error::Result;
use crate::time;
-// ----------------------------------------------------------------- notice --
-
pub fn put_notice_once(
writer: &Writer,
pkgbase_id: i64,
diff --git a/src/db/packages.rs b/src/db/packages.rs
index 3f1f96e..8612b35 100644
--- a/src/db/packages.rs
+++ b/src/db/packages.rs
@@ -3,8 +3,6 @@ use rusqlite::{params, OptionalExtension};
use crate::db::{Db, Recipe, ReleaseRow};
use crate::error::Result;
-// ---------------------------------------------------------------- package --
-
#[derive(Debug, Clone)]
// PackageRow stays `pub`: what `index_packages` hands back to `http`, the publish step and the `aur-build` binary, which bind it without naming it.
pub struct PackageRow {
diff --git a/src/db/pkgbases.rs b/src/db/pkgbases.rs
index 909291f..1513928 100644
--- a/src/db/pkgbases.rs
+++ b/src/db/pkgbases.rs
@@ -3,8 +3,6 @@ use rusqlite::{params, OptionalExtension, Row};
use crate::db::{release_by_id, Db, ReleaseRow, Writer};
use crate::error::Result;
-// ---------------------------------------------------------------- pkgbase --
-
#[derive(Debug, Clone)]
pub struct Pkgbase {
pub id: i64,
diff --git a/src/db/publish_writes.rs b/src/db/publish_writes.rs
index 11679cf..aa054e2 100644
--- a/src/db/publish_writes.rs
+++ b/src/db/publish_writes.rs
@@ -3,8 +3,6 @@ use rusqlite::{params, params_from_iter, OptionalExtension};
use crate::db::Db;
use crate::error::Result;
-// ------------------------------------------------------------ publish writes --
-
pub fn artifact_path(db: &Db, id: i64) -> Result<Option<String>> {
db.read(|c| {
Ok(c.query_row("SELECT path FROM artifact WHERE id=?1", params![id], |r| r.get::<_, String>(0)).optional()?)
diff --git a/src/db/releases.rs b/src/db/releases.rs
index 78215cc..feb22f9 100644
--- a/src/db/releases.rs
+++ b/src/db/releases.rs
@@ -3,8 +3,6 @@ use rusqlite::{params, OptionalExtension, Row};
use crate::db::{Db, ReleaseRow, ReleaseState};
use crate::error::{Error, Missing, Refused, Result};
-// ---------------------------------------------------------------- release --
-
fn row_to_release(r: &Row<'_>) -> rusqlite::Result<ReleaseRow> {
Ok(ReleaseRow {
id: r.get(0)?,
diff --git a/src/db/repos.rs b/src/db/repos.rs
index 1423bdc..fd55ba2 100644
--- a/src/db/repos.rs
+++ b/src/db/repos.rs
@@ -3,8 +3,6 @@ use rusqlite::{params, OptionalExtension};
use crate::db::{Db, Writer};
use crate::error::{Error, Missing, Result};
-// -------------------------------------------------------------------- repo --
-
pub fn ensure_repo(writer: &Writer, name: &str, path: &str, arch: &str, key: &str) -> Result<i64> {
let (n, p, a, k) = (name.to_string(), path.to_string(), arch.to_string(), key.to_string());
writer.tx(move |tx| {
diff --git a/src/db/retention.rs b/src/db/retention.rs
index 75d9c29..ab16c07 100644
--- a/src/db/retention.rs
+++ b/src/db/retention.rs
@@ -4,8 +4,6 @@ use crate::db::{Db, Writer};
use crate::error::Result;
use crate::time;
-// -------------------------------------------------------------- retention reads --
-
pub fn pkgbase_release_pointers(db: &Db) -> Result<Vec<(i64, Option<i64>)>> {
db.read(|c| {
let mut st = c.prepare("SELECT id, current_accepted_release_id FROM pkgbase ORDER BY id")?;
diff --git a/src/db/settings.rs b/src/db/settings.rs
index a8104a7..39190c8 100644
--- a/src/db/settings.rs
+++ b/src/db/settings.rs
@@ -3,8 +3,6 @@ use rusqlite::{params, OptionalExtension};
use crate::db::{Db, Writer};
use crate::error::Result;
-// ---------------------------------------------------------------- settings --
-
pub fn all_settings(db: &Db) -> Result<Vec<(String, String)>> {
db.read(|c| {
let mut st = c.prepare("SELECT key, value FROM settings ORDER BY key")?;
diff --git a/src/db/snapshots.rs b/src/db/snapshots.rs
index 144cb0d..e9e1e12 100644
--- a/src/db/snapshots.rs
+++ b/src/db/snapshots.rs
@@ -4,8 +4,6 @@ use crate::db::{Db, Writer};
use crate::error::Result;
use crate::time;
-// ---------------------------------------------------------------- snapshot --
-
#[allow(clippy::too_many_arguments)]
pub fn put_snapshot(
writer: &Writer,
diff --git a/src/db/stage_b.rs b/src/db/stage_b.rs
index 7dd1129..833dbf1 100644
--- a/src/db/stage_b.rs
+++ b/src/db/stage_b.rs
@@ -3,8 +3,6 @@ use rusqlite::params;
use crate::db::{Db, StageBCacheRow};
use crate::error::Result;
-// --------------------------------------------------------- stage B cache --
-
pub fn stage_b_cache_get(
db: &Db,
pkgbase_id: i64,
diff --git a/src/db/staleness.rs b/src/db/staleness.rs
index 58be227..da07cc0 100644
--- a/src/db/staleness.rs
+++ b/src/db/staleness.rs
@@ -4,8 +4,6 @@ use crate::db::{Db, Writer};
use crate::error::Result;
use crate::time;
-// ------------------------------------------------------------ staleness reads --
-
pub fn published_world_members(db: &Db) -> Result<Vec<(String, String)>> {
db.read(|c| {
let mut st = c.prepare(
diff --git a/src/db/subscriptions.rs b/src/db/subscriptions.rs
index 5b31f48..903e1de 100644
--- a/src/db/subscriptions.rs
+++ b/src/db/subscriptions.rs
@@ -4,8 +4,6 @@ use crate::db::{Db, SubscriptionState, Writer};
use crate::error::Result;
use crate::time;
-// ------------------------------------------------------------- subscriptions --
-
#[derive(Debug, Clone)]
// Subscription stays `pub`: what `get_subscription` and `list_subscriptions` hand back to `watch`, `usecase`, the binary and tests/detect.rs.
pub struct Subscription {
diff --git a/src/db/world.rs b/src/db/world.rs
index 19a28f1..3a7bb9e 100644
--- a/src/db/world.rs
+++ b/src/db/world.rs
@@ -4,8 +4,6 @@ use crate::db::{json_or, Db, WorldMember, Writer};
use crate::error::Result;
use crate::time;
-// --------------------------------------------------------- world snapshots --
-
pub fn put_world_snapshot(writer: &Writer, members: &[WorldMember]) -> Result<i64> {
let mut sorted = members.to_vec();
sorted.sort();
diff --git a/src/error.rs b/src/error.rs
index 737dce1..51a2c24 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -1,12 +1,6 @@
use std::fmt;
/// What a lookup asked for and did not get.
-///
-/// Carried as data rather than a sentence, because "not found" is not one
-/// failure: a pkgbase nobody subscribed to is a 404 page, while a missing repo
-/// row means the install was never initialised and every page is wrong. A
-/// caller can tell those apart from the variant instead of re-reading prose the
-/// call site wrote for it.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Missing {
Pkgbase(String),
@@ -36,12 +30,6 @@ impl fmt::Display for Missing {
}
/// An operation the current state of the world refuses.
-///
-/// The three shapes are the ones the state machines and the publish path
-/// actually produce. `IllegalTransition` is a bug in the caller — it asked for
-/// a move no edge permits; `WrongState` is a stale view — the caller was right
-/// once and the row moved; `PointerMoved` is a lost race, which is the one a
-/// client can safely retry.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Refused {
/// No edge in the state machine leads from `from` to `to`.
@@ -73,10 +61,6 @@ impl fmt::Display for Refused {
/// A guard the code holds against itself: a value that was checked once must
/// still be that value where it is used.
-///
-/// These are not user errors. Nothing downstream recovers from one; the point
-/// of naming them is that a build that trips one stops rather than publishing
-/// bytes nobody approved.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Guard {
/// A hash recomputed at use time differs from the one approved.
@@ -122,10 +106,7 @@ impl fmt::Display for WorldGap {
}
}
-/// The sandbox pool is at its quota.
-///
-/// Carries which backend said so, because the two have different remedies: a
-/// Kubernetes quota needs an operator, a local cap clears when a build exits.
+/// The sandbox pool is at its quota, and which backend said so.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PoolFull {
Backend { backend: &'static str, detail: String },
@@ -142,9 +123,6 @@ impl fmt::Display for PoolFull {
}
/// A failure a retry is allowed to treat as worth another attempt.
-///
-/// The variant is the whole of the retry decision — `is_transient` reads it
-/// directly — so it carries where the failure came from rather than a message.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum TransientCause {
/// An upstream fetch that a moment might fix.
@@ -349,8 +327,6 @@ mod tests {
#[test]
fn the_six_behavioural_variants_carry_data_not_prose() {
- // Each of these is branched on somewhere, so the branch must be able to
- // read a field rather than re-parse a sentence it wrote itself.
match Error::not_found(Missing::RepoRow) {
Error::NotFound(Missing::RepoRow) => {}
other => panic!("repo row not-found came back as {other:?}"),
@@ -387,8 +363,6 @@ mod tests {
#[test]
fn a_typed_refusal_keeps_the_text_the_ui_and_tests_match_on() {
- // These strings are load-bearing: tests assert on them and a reviewer
- // reads them. Typing the payload must not silently reword them.
let e = Error::conflict(Refused::IllegalTransition {
entity: "candidate",
id: "7".into(),
@@ -408,8 +382,6 @@ mod tests {
#[test]
fn a_missing_thing_is_distinguishable_from_a_refused_one() {
- // Both were `Variant(String)`; a handler could only tell them apart by
- // prefix. Now the shape decides.
assert!(matches!(Error::not_found(Missing::RepoRow), Error::NotFound(_)));
assert!(!matches!(Error::not_found(Missing::RepoRow), Error::Conflict(_)));
assert!(matches!(Error::conflict(Refused::Other("no".into())), Error::Conflict(_)));
@@ -417,9 +389,6 @@ mod tests {
#[test]
fn a_call_site_that_cannot_structure_its_reason_still_compiles() {
- // The `From<&str>` arms exist so typing is incremental: a guard that is
- // genuinely just a sentence lands in Invariant/Other rather than
- // blocking the refactor.
assert!(matches!(
Error::fail_closed("no aur_commit on the source identity"),
Error::FailClosed(Guard::Invariant(_))
diff --git a/src/git.rs b/src/git.rs
index a14ac50..addc4a0 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -34,10 +34,7 @@ fn git_ok(cwd: Option<&Path>, args: &[&str]) -> bool {
pub fn ls_remote_head(url: &str) -> Result<Option<String>> {
match git(None, &["ls-remote", url, "HEAD"]) {
- Ok(out) => {
- let sha = out.split_whitespace().next().filter(|s| s.len() >= 7).map(std::string::ToString::to_string);
- Ok(sha)
- }
+ Ok(out) => Ok(out.split_whitespace().next().filter(|s| s.len() >= 7).map(std::string::ToString::to_string)),
Err(e) if is_missing_remote(&e) => Ok(None),
Err(e) => Err(e),
}
diff --git a/src/hash.rs b/src/hash.rs
index ff7f41f..3ca0f39 100644
--- a/src/hash.rs
+++ b/src/hash.rs
@@ -69,10 +69,6 @@ mod tests {
}
}
- // Moved verbatim from tests/hash.rs. Both tests are a function of their
- // argument alone; the third test that file held was about `Identity`, not
- // about hashing, and moved to db::model where it belongs.
-
#[test]
fn a_value_that_cannot_be_serialized_is_an_error_not_an_empty_object() {
let err = canonical_json(&Unserializable).unwrap_err();
diff --git a/src/http/mod.rs b/src/http/mod.rs
index a437978..aea21dc 100644
--- a/src/http/mod.rs
+++ b/src/http/mod.rs
@@ -35,9 +35,6 @@ impl Req {
self.query_pairs.iter().find(|(k, _)| k == key).map(|(_, v)| v.clone())
}
/// Reading a cookie off a request is internal plumbing; the auth tests need it in order to forge one.
- ///
- /// Module-internal in a production build, `pub` only under `test-support`:
- /// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn cookie(&self, name: &str) -> Option<String> {
Self::cookie_impl(self, name)
diff --git a/src/http/routes/mod.rs b/src/http/routes/mod.rs
index 1affabf..301fe89 100644
--- a/src/http/routes/mod.rs
+++ b/src/http/routes/mod.rs
@@ -50,9 +50,6 @@ fn logout(req: &Req) -> Res {
}
/// The router dispatches to it. The login tests drive a live listener, so they cannot move into the module.
-///
-/// Module-internal in a production build, `pub` only under `test-support`:
-/// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn login(state: &State, req: &Req) -> Res {
login_impl(state, req)
@@ -195,8 +192,6 @@ fn flash_sub(state: &State, req: &Req, msg: &str, err: bool) -> Res {
page_to_res(Subscriptions { page, rows }, 200)
}
-// ------------------------------------------------------------ rendering --
-
fn page_to_res<T: askama::Template>(t: T, status: u16) -> Res {
match askama::Template::render(&t) {
Ok(body) => Res::html(status, body),
diff --git a/src/http/routes/mutations.rs b/src/http/routes/mutations.rs
index 0d3b188..508bf48 100644
--- a/src/http/routes/mutations.rs
+++ b/src/http/routes/mutations.rs
@@ -7,8 +7,6 @@ use super::{
Packages, ReviewDetail, ReviewsPage,
};
-// -------------------------------------------------------------- approve --
-
pub(crate) fn review_approve(state: &State, req: &Req, id: &str) -> Res {
let db = &state.db;
let Some(id) = id.parse::<i64>().ok() else {
diff --git a/src/http/routes/pages.rs b/src/http/routes/pages.rs
index 9081180..1500804 100644
--- a/src/http/routes/pages.rs
+++ b/src/http/routes/pages.rs
@@ -11,8 +11,6 @@ use super::{
UnbuiltRow,
};
-// ------------------------------------------------------------- dashboard --
-
pub(crate) fn dashboard(state: &State, req: &Req) -> Res {
let db = &state.db;
let page = chrome(state, req, "Dashboard", "");
@@ -45,8 +43,6 @@ pub(crate) fn dashboard(state: &State, req: &Req) -> Res {
)
}
-// ---------------------------------------------------------------- inbox --
-
pub(crate) fn review_rows(db: &Db) -> Vec<ReviewRow> {
let mut rows: Vec<ReviewRow> = candidates::pending_candidates(db)
.unwrap_or_default()
@@ -167,8 +163,6 @@ pub(crate) fn review_body(state: &State, c: &CandidateRow) -> (ReviewHead, Vec<P
(head, shown, recipe_text, srcinfo, sources_resolved, deps_resolved)
}
-// -------------------------------------------------------- subscriptions --
-
pub(crate) fn subscriptions(state: &State, req: &Req) -> Res {
let db = &state.db;
let page = chrome(state, req, "Subscriptions", "nav_subscriptions");
@@ -191,8 +185,6 @@ pub(crate) fn subscriptions(state: &State, req: &Req) -> Res {
page_to_res(Subscriptions { page, rows }, 200)
}
-// ------------------------------------------------------------ attention --
-
pub(crate) fn attention(state: &State, req: &Req) -> Res {
let db = &state.db;
let page = chrome(state, req, "Attention", "nav_attention");
@@ -247,8 +239,6 @@ pub(crate) fn attention(state: &State, req: &Req) -> Res {
page_to_res(Attention { page, empty, notices, unbuilt, outdated, missing, downgrades, blocked }, 200)
}
-// ------------------------------------------------------------- packages --
-
pub(crate) fn packages(state: &State, req: &Req) -> Res {
let db = &state.db;
let page = chrome(state, req, "Index", "nav_packages");
@@ -350,8 +340,6 @@ pub(crate) fn package_detail(state: &State, req: &Req, name: &str) -> Res {
)
}
-// --------------------------------------------------------------- builds --
-
fn build_version(db: &Db, b: &builds::BuildRow) -> String {
if let Some(cid) = b.candidate_id {
if let Some(c) = candidates::candidate_by_id(db, cid).ok().flatten() {
@@ -487,8 +475,6 @@ pub(crate) fn build_log_stream(state: &State, req: &Req, id: &str) -> Res {
res
}
-// ----------------------------------------------------------- ops, config --
-
pub(crate) fn audit(state: &State, req: &Req) -> Res {
let page = chrome(state, req, "Ops", "nav_audit");
let rows = db::list_audit(&state.db, 200)
diff --git a/src/ops.rs b/src/ops.rs
index a54ab69..ef680e9 100644
--- a/src/ops.rs
+++ b/src/ops.rs
@@ -44,9 +44,6 @@ pub struct Metrics {
impl Metrics {
/// The metrics report computes it internally; a test checks the arithmetic.
- ///
- /// Module-internal in a production build, `pub` only under `test-support`:
- /// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn build_success_rate(&self) -> f64 {
Self::build_success_rate_impl(self)
@@ -355,9 +352,6 @@ pub fn release_files(cfg: &Config, db: &Db, release_id: i64) -> Result<Vec<PathB
}
/// The maintenance pass calls it; a test pins what it sweeps without running the whole pass.
-///
-/// Module-internal in a production build, `pub` only under `test-support`:
-/// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn sweep_staging(cfg: &Config, db: &Db, grace_secs: i64) -> Result<(usize, u64)> {
sweep_staging_impl(cfg, db, grace_secs)
diff --git a/src/pipeline/dispatch.rs b/src/pipeline/dispatch.rs
index b2d3933..ad2d627 100644
--- a/src/pipeline/dispatch.rs
+++ b/src/pipeline/dispatch.rs
@@ -78,9 +78,6 @@ fn dispatcher(cfg: &Config, db: &Db, stop: &AtomicBool, tx: &Sender<String>) {
}
/// The scheduler loop calls it; a test drives single ticks and needs it directly.
-///
-/// Module-internal in a production build, `pub` only under `test-support`:
-/// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn dispatch_once(cfg: &Config, db: &Db, tx: &Sender<String>) -> Vec<String> {
dispatch_once_impl(cfg, db, tx)
@@ -114,9 +111,6 @@ fn dispatch_once_impl(cfg: &Config, db: &Db, tx: &Sender<String>) -> Vec<String>
}
/// Production reaches this through `dispatch_once`, which is the only thing that acts on the answer.
-///
-/// Module-internal in a production build, `pub` only under `test-support`:
-/// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn admissible(cfg: &Config, db: &Db) -> usize {
admissible_impl(cfg, db)
@@ -141,9 +135,6 @@ fn admissible_impl(cfg: &Config, db: &Db) -> usize {
}
/// Production reaches this through `admissible`, which is the only thing that acts on the number.
-///
-/// Module-internal in a production build, `pub` only under `test-support`:
-/// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn free_disk_mb(path: &std::path::Path) -> u64 {
free_disk_mb_impl(path)
diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs
index 5bc7cdb..5a74355 100644
--- a/src/pipeline/mod.rs
+++ b/src/pipeline/mod.rs
@@ -177,9 +177,6 @@ pub fn run(cfg: &Config, db: &Db, build_id: &str) -> Result<Outcome> {
}
/// Production calls `run`, which supplies the real sandbox; a test injects a fake, which is the point of the seam.
-///
-/// Module-internal in a production build, `pub` only under `test-support`:
-/// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn run_with(ctx: &Ctx) -> Result<Outcome> {
run_with_impl(ctx)
diff --git a/src/pipeline/publish.rs b/src/pipeline/publish.rs
index 24b7cdb..4bb60fb 100644
--- a/src/pipeline/publish.rs
+++ b/src/pipeline/publish.rs
@@ -19,9 +19,6 @@ fn lock_repo() -> std::sync::MutexGuard<'static, ()> {
}
/// Publishing calls it; a test checks what landed in the index.
-///
-/// Module-internal in a production build, `pub` only under `test-support`:
-/// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn index_world(db: &Db) -> Result<Vec<WorldMember>> {
index_world_impl(db)
diff --git a/src/pipeline/steps.rs b/src/pipeline/steps.rs
index 9703d54..e04ad98 100644
--- a/src/pipeline/steps.rs
+++ b/src/pipeline/steps.rs
@@ -426,8 +426,6 @@ fn publish(ctx: &Ctx) -> Result<StepResult> {
Ok(StepResult::Done(Some(format!("release:{release_id}"))))
}
-// ---------------------------------------------------------------- helpers --
-
use std::path::PathBuf;
fn recipe_at(dir: &Path) -> Result<Recipe> {
diff --git a/src/pkgver/mod.rs b/src/pkgver/mod.rs
index 5abb5c0..876f436 100644
--- a/src/pkgver/mod.rs
+++ b/src/pkgver/mod.rs
@@ -21,10 +21,7 @@ fn split_full_version(v: &str) -> (String, String, String) {
}
}
-/// The real definition. The module is private, so this `pub`
-/// is not a nameable path from outside; the alias below is the
-/// only way to reach it, and the alias is what carries the
-/// feature-conditional visibility.
+/// The real definition; the alias below carries the feature-conditional visibility.
mod version {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Version {
@@ -34,11 +31,8 @@ mod version {
}
}
-/// a parsed epoch-ver-rel. Every caller uses the value `parse` hands back without naming the type; the tests that pin the ordering do name it.
-///
-/// `pub` only under `test-support`. Production reaches the type
-/// through its own module and never names it from outside; the
-/// outside reader that needs the name is a test.
+/// A parsed epoch-ver-rel. Only tests name the type; production uses the value
+/// `parse` hands back.
#[cfg(feature = "test-support")]
pub use version::Version;
@@ -186,8 +180,6 @@ pub fn is_downgrade(current: &str, new: &str) -> bool {
vercmp(current, new) == Ordering::Greater
}
-// ------------------------------------------------------------- dep strings --
-
#[derive(Debug, Clone, PartialEq, Eq)]
enum DepOp {
Any,
@@ -240,8 +232,7 @@ impl Dep {
Some(Dep { name: s.trim().to_string(), op: DepOp::Any, version: None })
}
- /// Only the tests inside this module ask for a `Dep`'s name; production
- /// reads the field. Gated so the release build does not compile it.
+ /// Asked for only by this module's tests; production reads the field.
#[cfg(test)]
fn name(&self) -> &str {
&self.name
@@ -335,13 +326,6 @@ mod tests {
assert!(Dep::parse("foo").unwrap().satisfied_by("anything"));
}
- // ---------------------------------------------------------------------
- // Moved verbatim from tests/versions.rs: every test here is a function of
- // its arguments alone — no database, no fixture, no temporary directory —
- // which is what makes it a unit test of this module rather than a consumer
- // of it.
- // ---------------------------------------------------------------------
-
const ORDERED: &[(&str, &str)] = &[
("v1.2.3", "v1.2.4"),
("1.0", "1.1"),
diff --git a/src/sandbox/kata.rs b/src/sandbox/kata.rs
index ca39c6b..e035fd6 100644
--- a/src/sandbox/kata.rs
+++ b/src/sandbox/kata.rs
@@ -358,21 +358,6 @@ mod tests {
assert!(args.windows(2).any(|w| w[0] == "--token" && w[1] == "t0ken"));
}
- // ------------------------------------------------------------------
- // Moved verbatim from tests/kata.rs. Neither test builds a fixture or
- // touches a database: one asserts the shape of the container record a
- // lease provisions, the other that a sandbox which never dials in expires
- // by TTL rather than hanging. Both are about this module's own machinery,
- // which is what let `KataBackend`, `sandbox_cr`, `provision_request`,
- // `shared_for` and `for_config` stop being part of the crate's interface.
- //
- // `Provisioner` and `ProvisionRequest` stayed public, and not by
- // oversight: a `pub` implementor cannot implement a `pub(crate)` trait,
- // and a `pub` trait method cannot take a `pub(crate)` parameter. Narrowing
- // them would force `LocalAgentProvisioner` private, and the two tests that
- // construct it drive a real sandbox agent through a fixture.
- // ------------------------------------------------------------------
-
fn agent_sandbox_config() -> Config {
let tmp = tempfile::tempdir().unwrap();
std::fs::write(
@@ -452,14 +437,6 @@ mod tests {
assert!(err.to_string().contains("never dialed in"), "{err}");
}
- // ------------------------------------------------------------------
- // Moved verbatim from tests/kata.rs. It is an opt-in live tier, not a
- // fixture test: it records its own absence when there is no /dev/kvm or no
- // AUR_KATA_API, exactly as the vercmp live tier does. It constructs the
- // provisioner field by field, which is the only reason that struct was
- // nameable from outside; with the test here, it no longer needs to be.
- // ------------------------------------------------------------------
-
#[test]
fn the_live_kata_tier_is_recorded_not_silently_absent() {
if !std::path::Path::new("/dev/kvm").exists() {
diff --git a/src/shims/mod.rs b/src/shims/mod.rs
index b605229..675d69d 100644
--- a/src/shims/mod.rs
+++ b/src/shims/mod.rs
@@ -90,9 +90,6 @@ impl Default for Manifest {
}
/// The shim reads its own manifest while dispatching a tool; tests read it to assert what a build did.
-///
-/// Module-internal in a production build, `pub` only under `test-support`:
-/// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn manifest() -> Manifest {
manifest_impl()
@@ -491,9 +488,6 @@ fn installed_db() -> Option<std::path::PathBuf> {
const DB_SUFFIXES: [&str; 5] = [".db.tar", ".db.tar.gz", ".db.tar.zst", ".db.tar.bz2", ".db.tar.xz"];
/// The shim validates its own `--db` argument; tests check the verdicts.
-///
-/// Module-internal in a production build, `pub` only under `test-support`:
-/// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn valid_db_arg(p: &Path) -> bool {
valid_db_arg_impl(p)
diff --git a/src/time.rs b/src/time.rs
index 4abb3f9..a05c0e7 100644
--- a/src/time.rs
+++ b/src/time.rs
@@ -39,11 +39,8 @@ thread_local! {
/// Freeze the clock for this thread, returning the previous pin if any.
///
-/// Test-tier only, together with `unpin` — the two are one capability and
-/// gating half of it would leave a release binary able to freeze time and
-/// unable to release it. The census never reported `pin` as test-only because
-/// its name match also fires inside `upstream_pins` and `source_digests`; the
-/// only callers in the crate are tests.
+/// Gated with `unpin`: they are one capability, and gating half would leave a
+/// release binary able to freeze time and unable to release it.
#[cfg(feature = "test-support")]
pub fn pin(ts: &str) -> Option<String> {
CLOCK.with(|c| {
@@ -52,7 +49,7 @@ pub fn pin(ts: &str) -> Option<String> {
})
}
-/// Release a pin set by `pin`. See the note there about why both are gated.
+/// Release a pin set by `pin`.
#[cfg(feature = "test-support")]
pub fn unpin() {
CLOCK.with(|c| *c.borrow_mut() = None);
@@ -76,8 +73,6 @@ pub fn secs_ahead(secs: i64) -> String {
fmt(base() + chrono::Duration::seconds(secs))
}
-// ---- waiting ----
-
/// Wait for `d`, checking `stop` every `slice`. Returns false if `stop` was set
/// before the wait finished, so a control loop can leave instead of doing one
/// more pass.
@@ -105,8 +100,8 @@ pub fn sleep(d: Duration) {
}
/// Wrap a closure about to be spawned so the child thread inherits this one's
-/// clock setting. Without it a control loop spawned by a test runs on wall time
-/// while the test itself runs on the virtual clock, and the two disagree.
+/// clock setting; a spawned control loop on wall time would disagree with a
+/// test on the virtual clock.
pub fn inherit<F, T>(f: F) -> impl FnOnce() -> T
where
F: FnOnce() -> T + Send + 'static,
@@ -138,7 +133,7 @@ mod clock {
static AT: Mutex<Option<DateTime<Utc>>> = Mutex::new(None);
static OWNER: Mutex<()> = Mutex::new(());
- // VirtualClock stays `pub`: lives in the `test-support`-gated clock module, behind the gated `virtualize()` that returns it.
+ // `pub` only because the gated `virtualize()` that returns it is `pub`.
pub struct VirtualClock {
// Held, never read: owning the mutex *is* the virtual clock's lease,
// and dropping this guard is what releases it.
@@ -216,10 +211,6 @@ mod clock {
mod tests {
use super::*;
- // Moved verbatim from tests/time.rs. These two are arithmetic on the
- // clock itself and need nothing else; the third test in that file pins a
- // lease against a pinned clock, which needs a database, so it stayed.
-
#[cfg(feature = "test-support")]
#[test]
fn a_pinned_clock_moves_relative_arithmetic_with_it() {
diff --git a/src/watch/mirror.rs b/src/watch/mirror.rs
index 0eb9a77..5a42a11 100644
--- a/src/watch/mirror.rs
+++ b/src/watch/mirror.rs
@@ -15,9 +15,6 @@ pub enum Sync {
}
/// Detection calls it to move the mirror; the test that pins it drives a real sync.
-///
-/// Module-internal in a production build, `pub` only under `test-support`:
-/// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn sync_mirror(cfg: &Config, db: &Db, name: &str, url: &str) -> Result<Sync> {
sync_mirror_impl(cfg, db, name, url)
diff --git a/src/watch/upstream.rs b/src/watch/upstream.rs
index 523574a..3faeacc 100644
--- a/src/watch/upstream.rs
+++ b/src/watch/upstream.rs
@@ -23,9 +23,6 @@ pub struct StageA {
impl StageA {
/// Detection consults it; the VCS test that asserts it needs a real mirror.
- ///
- /// Module-internal in a production build, `pub` only under `test-support`:
- /// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn needs_stage_b(&self) -> bool {
Self::needs_stage_b_impl(self)
@@ -42,9 +39,6 @@ impl StageA {
}
/// Detection calls it on every expensive poll; the tests that pin it need a fixture.
-///
-/// Module-internal in a production build, `pub` only under `test-support`:
-/// one body behind two visibility declarations, exactly one of which compiles.
#[cfg(feature = "test-support")]
pub fn probe(recipe: &Recipe, accepted: &[UpstreamPin]) -> Result<StageA> {
probe_impl(recipe, accepted)
diff --git a/tests/approve.rs b/tests/approve.rs
index 97423b3..5133b46 100644
--- a/tests/approve.rs
+++ b/tests/approve.rs
@@ -211,8 +211,6 @@ fn reject_requires_a_reason_and_records_it() {
assert!(detail.contains(&c.identity_hash), "the audit row does not say which review bytes were rejected: {detail}");
}
-// ------------------------------------------------------------- the CLI path --
-
#[test]
fn cli_end_to_end_approves_and_queues_a_build() {
let tmp = tempfile::tempdir().unwrap();
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index fa0beea..5194035 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -217,8 +217,6 @@ impl Drop for Env {
}
}
-// ------------------------------------------------------------- fixtures ----
-
pub fn corpus_root() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("testcorpus")
}
@@ -566,8 +564,6 @@ pub fn git(dir: &Path, args: &[&str]) -> String {
String::from_utf8_lossy(&out.stdout).trim().to_string()
}
-// ------------------------------------------------------------- web driver --
-
pub struct Web {
pub env: Env,
pub fx: Fixture,
diff --git a/tests/pipeline.rs b/tests/pipeline.rs
index 1f62203..74edb53 100644
--- a/tests/pipeline.rs
+++ b/tests/pipeline.rs
@@ -448,8 +448,6 @@ fn a_stale_accepted_pointer_refuses_to_publish() {
assert_eq!(in_index(&env), [] as [(std::string::String, std::string::String); 0]);
}
-// ------------------------------------------------------- withdrawal and cleanup --
-
#[test]
fn withdrawing_a_release_twice_is_refused_the_second_time() {
let (env, _fx) = env_with_fixture("plain-make");
diff --git a/tests/state_machine.rs b/tests/state_machine.rs
index f355e8f..d90bf20 100644
--- a/tests/state_machine.rs
+++ b/tests/state_machine.rs
@@ -109,8 +109,6 @@ fn a_failed_build_is_resumed_on_its_own_row() {
assert_eq!(state(&env, &id), BuildState::Succeeded);
}
-// ---------------------------------------------------------- the other machines --
-
fn candidate(env: &Env, state: &str) -> i64 {
env.exec(
"INSERT OR IGNORE INTO pkgbase (name, aur_url, created_at) VALUES ('x', 'u', '2026-01-01T00:00:00Z')",