summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-22 10:51:45 +0000
committeraur-build <aur-build@localhost>2026-11-22 10:51:45 +0000
commit053dfbca8a4955a616e9b2c0f5a5d664c0db7aef (patch)
tree969777fa32845f49723c52b1889c4870c98134cf
parent1e1e12e7220a3fd288782ae40f0823db32acf6cb (diff)
downloadaur-build-053dfbca8a4955a616e9b2c0f5a5d664c0db7aef.tar.gz
aur-build-053dfbca8a4955a616e9b2c0f5a5d664c0db7aef.zip
src,tests: retire the census commentary from the source
A gated item used to carry its own defence: why it is `pub` only under `test-support`, which census once mistook a filename for a caller, why a wrapper is compiled out rather than deleted. The budget file already holds those claims and the ratchet already checks them, so the source keeps the one line that says what the item is. The module headers stop narrating the refactor that produced them. What survives is the wire protocol, the git pipe, the poisoned lock that must be recovered rather than unwedged.
-rw-r--r--src/db/builds/mod.rs11
-rw-r--r--src/db/invariants.rs10
-rw-r--r--src/db/migrations.rs1
-rw-r--r--src/db/mod.rs18
-rw-r--r--src/db/model/state.rs16
-rw-r--r--src/db/packages.rs1
-rw-r--r--src/db/pkgbases.rs16
-rw-r--r--src/db/subscriptions.rs1
-rw-r--r--src/http/mod.rs9
-rw-r--r--src/http/render.rs18
-rw-r--r--src/http/sse.rs9
-rw-r--r--src/pkginfo.rs2
-rw-r--r--src/review/approve.rs26
-rw-r--r--src/review/diff.rs12
-rw-r--r--src/review/intake.rs23
-rw-r--r--src/review/reads.rs8
-rw-r--r--src/sandbox/kata.rs34
-rw-r--r--src/sandbox/loopback.rs11
-rw-r--r--src/sandbox/mod.rs11
-rw-r--r--src/sandbox/remote.rs26
-rw-r--r--src/shims/mod.rs24
-rw-r--r--src/usecase/detect.rs1
-rw-r--r--src/usecase/maintenance.rs1
-rw-r--r--src/usecase/reviews.rs1
-rw-r--r--src/watch/detect.rs1
-rw-r--r--src/watch/mirror.rs4
-rw-r--r--src/watch/sources.rs21
-rw-r--r--src/watch/staleness.rs11
-rw-r--r--src/watch/upstream.rs12
29 files changed, 60 insertions, 279 deletions
diff --git a/src/db/builds/mod.rs b/src/db/builds/mod.rs
index e31543e..50aee63 100644
--- a/src/db/builds/mod.rs
+++ b/src/db/builds/mod.rs
@@ -119,13 +119,8 @@ pub fn queued(db: &Db, limit: i64) -> Result<Vec<String>> {
})
}
-/// Lease one named build to a worker.
-///
-/// Test-tier only. Production leases a *batch* — `claim_batch` is what the
-/// dispatcher runs — and nothing in the crate calls this single-build form.
-/// It stays because three test files lease one build at a time on purpose,
-/// and a test that wants to reason about one lease should not have to
-/// arrange for the batch form to hand back exactly one.
+/// Lease one named build to a worker. Production leases batches through
+/// `claim_batch`.
#[cfg(feature = "test-support")]
pub fn claim(db: &Db, owner: &str, id: &str, lease_secs: i64) -> Result<bool> {
let (owner, id) = (owner.to_string(), id.to_string());
@@ -267,8 +262,6 @@ pub fn cancel_requested(db: &Db, id: &str) -> Result<bool> {
})
}
-// The step machine is its own concern: same build, one row per step, its own
-// legal moves.
mod steps;
pub use steps::{
diff --git a/src/db/invariants.rs b/src/db/invariants.rs
index e2e6b13..d768c76 100644
--- a/src/db/invariants.rs
+++ b/src/db/invariants.rs
@@ -1,13 +1,8 @@
use crate::db::Db;
use crate::error::Result;
-/// Repo entries whose candidate was never approved.
-///
-/// Test-tier only, and deliberately so: this is an invariant the schema does
-/// not enforce and production does not check, so the only thing that keeps it
-/// true is that a test asserts it on every run. It is gated rather than moved
-/// to `tests/common` because reading it needs this module's private helpers,
-/// and widening those to let a test out would be the wrong trade.
+/// Repo entries whose candidate was never approved — an invariant only a test
+/// keeps true, so nothing in production asks for it.
#[cfg(feature = "test-support")]
pub fn unapproved_index_entries(db: &Db) -> Result<Vec<String>> {
db.read(|c| {
@@ -27,7 +22,6 @@ pub fn unapproved_index_entries(db: &Db) -> Result<Vec<String>> {
}
#[derive(Debug, Clone)]
-// Unbuilt stays `pub`: the attention row `approved_but_unbuilt` returns to the web UI and to tests/crash.rs.
pub struct Unbuilt {
pub pkgbase: String,
pub approved: String,
diff --git a/src/db/migrations.rs b/src/db/migrations.rs
index 2e552f2..c41adc6 100644
--- a/src/db/migrations.rs
+++ b/src/db/migrations.rs
@@ -1,4 +1,3 @@
-// Migration stays `pub`: the row type of `MIGRATIONS`, which is `pub` only under `test-support`; production walks the table through `db::migrate` without naming it.
pub struct Migration {
pub version: u32,
pub name: &'static str,
diff --git a/src/db/mod.rs b/src/db/mod.rs
index 27d1bfb..6f15c88 100644
--- a/src/db/mod.rs
+++ b/src/db/mod.rs
@@ -4,9 +4,7 @@ pub mod candidates;
pub mod migrations;
pub mod model;
-// The queries this module owns, one module per aggregate. They are private:
-// the interface is what `pub use` names below, not the file layout, so a
-// caller cannot reach a query that was not chosen for export.
+// One private module per aggregate; the interface is the `pub use` below.
mod audit;
mod invariants;
mod metrics;
@@ -24,9 +22,7 @@ mod staleness;
mod subscriptions;
mod world;
-/// The alias is only ever used from outside `db`, and only by the test tier;
-/// `db::migrate` walks `migrations::MIGRATIONS` by its own path, so there is
-/// no crate-internal alias to keep in a production build.
+/// Aliased only for the test tier; `db::migrate` walks `MIGRATIONS` by its own path.
#[cfg(feature = "test-support")]
pub use migrations::MIGRATIONS;
/// Its only caller is the test-tier `world_members`, so it is gated with it.
@@ -43,8 +39,7 @@ pub use metrics::{
count_subscriptions, count_unacknowledged_notices, last_gc_age_secs, last_poll_age_secs, oldest_queued_age_secs,
pending_review_ages_secs,
};
-/// `ReleaseState` is a column type on the release row. Nothing outside `db`
-/// names it, so the alias out of `db` exists only for the test tier.
+/// A column type on the release row; nothing outside `db` names it.
#[cfg(feature = "test-support")]
pub use model::ReleaseState;
#[cfg(not(feature = "test-support"))]
@@ -249,11 +244,8 @@ impl Writer {
self.tx.send(Msg::Call(f)).map_err(|_| Error::db("writer actor gone"))
}
- /// Stop the writer actor.
- ///
- /// Test-tier only: the server runs until the process ends and never
- /// quiesces the writer deliberately. Tests use it to prove a worker
- /// that dies mid-write leaves the database consistent.
+ /// Stop the writer actor. The server never quiesces it; tests use this to
+ /// prove a worker that dies mid-write leaves the database consistent.
#[cfg(feature = "test-support")]
pub fn shutdown(&self) {
let _ = self.tx.send(Msg::Shutdown);
diff --git a/src/db/model/state.rs b/src/db/model/state.rs
index 4057652..0eb9b6e 100644
--- a/src/db/model/state.rs
+++ b/src/db/model/state.rs
@@ -68,10 +68,7 @@ pub mod candidate_kind {
pub const FIRST_INTRODUCTION: &str = "first_introduction";
}
-/// 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 visibility.
mod release_state {
use super::{Deserialize, Serialize};
@@ -84,11 +81,7 @@ mod release_state {
}
}
-/// The state column of a release row. `ReleaseRow` is public and its `state` field is typed here, so the type stays reachable in a release build only through this alias.
-///
-/// `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.
+/// The state column of a release row.
#[cfg(feature = "test-support")]
pub use release_state::ReleaseState;
@@ -189,10 +182,7 @@ impl std::fmt::Display for SubscriptionState {
mod tests {
use super::*;
- // The three enums declared here keep their `ALL` private, so the round trip
- // through column text — the property that makes a stored row readable back
- // — is checked here rather than from outside. BuildState and StepState are
- // covered in build_state.rs.
+ // `ALL` is private, so the round trip through column text is checked here.
#[test]
fn every_state_declared_here_round_trips_through_its_column_text() {
diff --git a/src/db/packages.rs b/src/db/packages.rs
index 8612b35..14ab270 100644
--- a/src/db/packages.rs
+++ b/src/db/packages.rs
@@ -4,7 +4,6 @@ use crate::db::{Db, Recipe, ReleaseRow};
use crate::error::Result;
#[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 {
pub id: i64,
pub release_id: i64,
diff --git a/src/db/pkgbases.rs b/src/db/pkgbases.rs
index 1513928..ba52472 100644
--- a/src/db/pkgbases.rs
+++ b/src/db/pkgbases.rs
@@ -45,10 +45,7 @@ pub fn get_pkgbase_by_id(db: &Db, id: i64) -> Result<Option<Pkgbase>> {
})
}
-/// The release a pkgbase currently points at, if it points at one. This is a
-/// pointer stored on the pkgbase row, so reading it is a persistence question,
-/// not a review one — the watcher needs it to decide what a change is a change
-/// *from*, and review must not be the only way to ask.
+/// The release a pkgbase currently points at, if it points at one.
pub fn accepted_release_for(db: &Db, pb: &Pkgbase) -> Result<Option<ReleaseRow>> {
match pb.current_accepted_release_id {
Some(id) => release_by_id(db, id),
@@ -64,15 +61,8 @@ pub fn set_aur_head(writer: &Writer, pkgbase_id: i64, head: &str, mirror: &str)
})
}
-/// Compare-and-set the accepted-release pointer.
-///
-/// Test-tier only, and the reason is worth keeping next to it: production
-/// performs this CAS inside a transaction through `cas_accepted_release_in`,
-/// which is what `pipeline::publish` calls at publish.rs:208. This standalone
-/// form takes a `Writer` and is called by nothing in the crate — `tests/db.rs`
-/// alone pins that the pointer moves once and refuses the second time. The two
-/// names differ by three characters, which is exactly how a name-match census
-/// once credited this function with a production caller it never had.
+/// Compare-and-set the accepted-release pointer. Production does its CAS inside
+/// a transaction through `cas_accepted_release_in`.
#[cfg(feature = "test-support")]
pub fn cas_accepted_release(writer: &Writer, pkgbase_id: i64, expected: Option<i64>, new_id: i64) -> Result<bool> {
writer.tx(move |tx| {
diff --git a/src/db/subscriptions.rs b/src/db/subscriptions.rs
index 903e1de..a95e51b 100644
--- a/src/db/subscriptions.rs
+++ b/src/db/subscriptions.rs
@@ -5,7 +5,6 @@ use crate::error::Result;
use crate::time;
#[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 {
pub id: i64,
pub pkgbase: String,
diff --git a/src/http/mod.rs b/src/http/mod.rs
index aea21dc..715b448 100644
--- a/src/http/mod.rs
+++ b/src/http/mod.rs
@@ -107,10 +107,7 @@ impl Res {
}
}
-/// 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 visibility.
mod server {
pub struct Server {
pub addr: String,
@@ -118,10 +115,6 @@ mod server {
}
/// the handle to a running HTTP listener. `spawn` returns it and `main` holds it without naming the type; the test harness stores it in a field because it needs the bound address.
-///
-/// `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.
#[cfg(feature = "test-support")]
pub use server::Server;
diff --git a/src/http/render.rs b/src/http/render.rs
index 316988a..bc2ad3d 100644
--- a/src/http/render.rs
+++ b/src/http/render.rs
@@ -1,9 +1,6 @@
use askama::Template;
-/// 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 visibility.
mod page {
#[derive(Debug, Clone)]
pub struct Page {
@@ -27,10 +24,6 @@ mod page {
}
/// The render model's shared header. Every template and route handler that fills it lives inside `http`; the outside readers are the page tests.
-///
-/// `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.
#[cfg(feature = "test-support")]
pub use page::Page;
@@ -157,10 +150,7 @@ pub(crate) struct ReviewHead {
pub diff_digest: 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 visibility.
mod panel {
#[derive(Debug, Clone)]
pub struct Panel {
@@ -172,10 +162,6 @@ mod panel {
}
/// A diff panel in the render model. The tests that assert on its body drive a real review and cannot move into the module.
-///
-/// `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.
#[cfg(feature = "test-support")]
pub use panel::Panel;
diff --git a/src/http/sse.rs b/src/http/sse.rs
index 36a9d42..098a2fc 100644
--- a/src/http/sse.rs
+++ b/src/http/sse.rs
@@ -8,10 +8,7 @@ const MAX_LIFETIME: Duration = Duration::from_secs(30 * 60);
const KEEPALIVE: Duration = Duration::from_secs(10);
const POLL: Duration = Duration::from_millis(200);
-/// 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 visibility.
mod log_tail {
use super::{builds, io, read_from, Duration, Instant, PathBuf, Read, KEEPALIVE, MAX_LIFETIME, POLL};
@@ -110,10 +107,6 @@ mod log_tail {
}
/// The SSE tail handle. The live test that names it drives a real server, so it cannot move into the module.
-///
-/// `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.
#[cfg(feature = "test-support")]
pub use log_tail::LogTail;
diff --git a/src/pkginfo.rs b/src/pkginfo.rs
index 470ccf7..2cf449e 100644
--- a/src/pkginfo.rs
+++ b/src/pkginfo.rs
@@ -1,7 +1,6 @@
use std::io::Read;
#[derive(Debug, Clone, Default, PartialEq, Eq)]
-// PkgInfo stays `pub`: what `parse_pkginfo` answers with; `pipeline`, `shims` and tests/world.rs read its fields, never its name.
pub struct PkgInfo {
pub name: String,
pub version: String,
@@ -20,7 +19,6 @@ pub struct PkgInfo {
}
#[derive(Debug, Clone, PartialEq, Eq)]
-// Installed stays `pub`: what `parse_installed` answers with, read line by line by `pipeline` and tests/world.rs.
pub struct Installed {
pub name: String,
pub version: String,
diff --git a/src/review/approve.rs b/src/review/approve.rs
index 26963d6..afda51b 100644
--- a/src/review/approve.rs
+++ b/src/review/approve.rs
@@ -142,7 +142,6 @@ pub fn reject(db: &Db, actor: &str, candidate_id: i64, note: &str) -> Result<()>
}
#[derive(Debug)]
-// BulkItem stays `pub`: one outcome of `approve::bulk`, which tests/approve.rs drives directly.
pub struct BulkItem {
pub candidate: Option<CandidateRow>,
pub outcome: BulkOutcome,
@@ -161,10 +160,7 @@ pub enum BulkOutcome {
Refused(BulkRefusal),
}
-/// 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 visibility.
mod bulk_refusal {
use super::{Error, Stale};
@@ -183,11 +179,7 @@ mod bulk_refusal {
}
}
-/// The payload of one `BulkOutcome::Refused` arm. The bulk tests construct it to assert which approval was refused.
-///
-/// `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.
+/// The payload of one `BulkOutcome::Refused` arm.
#[cfg(feature = "test-support")]
pub use bulk_refusal::BulkRefusal;
@@ -229,17 +221,9 @@ pub fn bulk(
Ok(out)
}
-/// Withdraw a published release and unpublish its files.
-///
-/// Nothing in production reaches this today: the CLI and the web UI both go
-/// through `usecase::withdraw_package`, which withdraws a *package* and
-/// republishes the repo. This is the single-release operation underneath what
-/// that path will eventually use, and `tests/pipeline.rs` is what pins its
-/// invariants — a second withdraw is refused, an unknown release is refused.
-///
-/// So it is compiled only under `test-support`. A release build does not carry
-/// an operation nothing invokes; when production grows the call, the gate comes
-/// off and the test that already exists becomes the regression cover.
+/// Withdraw a published release and unpublish its files. The user-facing path
+/// is `usecase::withdraw_package`; this is the single-release operation under
+/// it, and nothing in production calls it yet.
#[cfg(feature = "test-support")]
pub fn withdraw(db: &Db, actor: &str, release_id: i64, reason: &str) -> Result<()> {
let actor = actor.to_string();
diff --git a/src/review/diff.rs b/src/review/diff.rs
index f997b3c..afe2a43 100644
--- a/src/review/diff.rs
+++ b/src/review/diff.rs
@@ -293,17 +293,7 @@ pub fn diff_digest(ps: &[Panel]) -> String {
}
/// Render a candidate's diff, store its digest on the row, and return it.
-///
-/// Test-tier only, and that is worth stating plainly because the number says
-/// something alarming at first glance: zero callers in `src/`, seventeen test
-/// files. Intake renders through `review::intake::record`, which is the single
-/// entry point the pipeline and both front ends use; this is the older,
-/// uncomposed form that says "render and store" in two steps. It stays because
-/// a test that wants a digest without running intake wants exactly this, and it
-/// is gated rather than moved to `tests/common` because it needs this module's
-/// private `panels`/`render_text` and `candidates::set_diff_digest` — widening
-/// those to let a test out would undo the narrowing this crate just spent a
-/// dozen commits doing.
+/// Production renders through `review::intake::record`.
#[cfg(feature = "test-support")]
pub fn render_and_store(db: &Db, cfg: &Config, c: &CandidateRow) -> Result<String> {
let base = match c.base_release_id {
diff --git a/src/review/intake.rs b/src/review/intake.rs
index 78e4eb6..48620aa 100644
--- a/src/review/intake.rs
+++ b/src/review/intake.rs
@@ -1,14 +1,5 @@
-//! Turning a detected change into a scored candidate is one operation.
-//!
-//! The watcher used to perform review's write protocol itself: look up the
-//! accepted release, upsert the candidate, assess the risk, store the risk,
-//! work out the missing dependencies, store those. Six calls that only make
-//! sense in that order, issued by a module that has no business knowing the
-//! order — and if it got the order wrong, or skipped the scoring because it was
-//! in a hurry, nothing would have complained.
-//!
-//! `record` is the protocol. The watcher calls it once with what it observed,
-//! and review decides what a candidate means.
+//! Turning a detected change into a scored candidate is one operation:
+//! `record`, so the watcher never has to know the order of review's writes.
use crate::config::Config;
use crate::db::{
@@ -20,9 +11,8 @@ use crate::error::Result;
use crate::review::candidates::{self, NewCandidate, Upsert};
use crate::review::risk;
-/// Record a detected change as a candidate, scored. Returns what the upsert
-/// decided so the caller can report it; a change that collapsed or was already
-/// rejected is recorded as such and scored only when a candidate row exists.
+/// Record a detected change as a candidate, scored. A change that collapsed or
+/// was already rejected is recorded as such and scored only if a row exists.
pub fn record(
db: &Db,
cfg: &Config,
@@ -47,9 +37,8 @@ pub fn record(
Ok(up)
}
-/// Dependencies this recipe needs that we build ourselves but have not
-/// published yet — the reason a build would fail on a missing dep, said before
-/// it runs.
+/// Dependencies we build ourselves but have not published yet, so a build that
+/// would fail on one says so before it runs.
fn missing_deps(db: &Db, pb: &Pkgbase, recipe: &Recipe) -> Vec<String> {
let Ok(ours) = db::our_package_names(db) else { return Vec::new() };
let mut out = Vec::new();
diff --git a/src/review/reads.rs b/src/review/reads.rs
index 0f91f74..c82d90b 100644
--- a/src/review/reads.rs
+++ b/src/review/reads.rs
@@ -1,9 +1,5 @@
-//! Reading review's state without reaching into its tables.
-//!
-//! The pipeline needs two facts about a candidate: the row itself, and whether
-//! a human approved it. It used to fetch them by calling through review's
-//! re-exports of db's query functions, which meant the step machine knew the
-//! shape of review's storage. These two calls are the whole of what it needs.
+//! The two facts the pipeline needs about a candidate: the row, and whether a
+//! human approved it.
use crate::db::{self, approvals, model::CandidateRow, Db};
use crate::error::Result;
diff --git a/src/sandbox/kata.rs b/src/sandbox/kata.rs
index e035fd6..2bdc472 100644
--- a/src/sandbox/kata.rs
+++ b/src/sandbox/kata.rs
@@ -18,7 +18,6 @@ use crate::sandbox::wire::{self, Frame};
use crate::sandbox::{Sandbox, SandboxBackend, SandboxInfo, SandboxSpec};
#[derive(Debug, Clone)]
-// ProvisionRequest stays `pub`: the argument of `Provisioner::provision`, the trait the public `LocalAgentProvisioner` implements.
pub struct ProvisionRequest {
pub sandbox_id: String,
pub profile: String,
@@ -28,7 +27,6 @@ pub struct ProvisionRequest {
pub image: String,
}
-// Provisioner stays `pub`: implemented by the test-gated public `LocalAgentProvisioner`; a private trait on a public impl is E0445.
pub trait Provisioner: Send + Sync {
fn provision(&self, req: &ProvisionRequest) -> Result<()>;
fn reclaim(&self, sandbox_id: &str) -> Result<()>;
@@ -36,10 +34,9 @@ pub trait Provisioner: Send + Sync {
}
/// The agent-sandbox-style CR: one disposable Sandbox per build, Kata for the
-/// VM boundary, `activeDeadlineSeconds` so the *orchestrator* enforces the
-/// TTL even if the hub dies. The token rides in args for v1; a production
-/// deployment should mount it from a Secret, and this comment is the honest
-/// place that says so.
+/// VM boundary, `activeDeadlineSeconds` so the orchestrator enforces the TTL
+/// even if the hub dies. The token rides in args; a production deployment
+/// should mount it from a Secret.
fn sandbox_cr(req: &ProvisionRequest) -> serde_json::Value {
serde_json::json!({
"apiVersion": "agents.x-k8s.io/v1alpha1",
@@ -123,13 +120,8 @@ impl Provisioner for K8sSandboxProvisioner {
}
}
-/// Provisions sandboxes by running the local `sandbox-agent` binary.
-///
-/// Test-tier only. Production selects `K8sSandboxProvisioner` when the config
-/// names an agent-sandbox backend (kata.rs:193); nothing in the crate ever
-/// constructs this type. It exists so tests can drive the real agent protocol
-/// against the shim binary without a cluster, which is a more valuable test
-/// than the absence of one — so it is gated rather than deleted.
+/// Provisions sandboxes by running the local `sandbox-agent` binary, so tests
+/// can drive the real agent protocol without a cluster.
#[cfg(feature = "test-support")]
pub struct LocalAgentProvisioner {
pub bin: PathBuf,
@@ -176,9 +168,7 @@ impl Provisioner for LocalAgentProvisioner {
}
}
-/// The real definition and its impls. 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 and its impls; the alias below carries the visibility.
mod kata_backend {
use super::{
bounded, route_dial_in, wire, Arc, AtomicU64, Config, Duration, Error, Frame, HashMap, K8sSandboxProvisioner,
@@ -252,13 +242,6 @@ mod kata_backend {
})
}
- // NOTE: `KataBackend::reclaim` used to sit here and called nothing but
- // `self.provisioner.reclaim`, which the pool already calls itself at the
- // reaping site. Nothing — not a test — ever called the wrapper, so it is
- // gone rather than gated. The census had credited it to `tests/kata.rs`,
- // where the TTL test implements the *trait's* `reclaim` on a null
- // provisioner: same word, different function.
-
fn nonce(&self) -> String {
let n = self.counter.fetch_add(1, Ordering::SeqCst);
let nanos = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map_or(0, |d| d.as_nanos());
@@ -298,10 +281,7 @@ mod kata_backend {
}
}
-/// Selected by `backend_for`. The kata tests drive it directly and need a
-/// fixture, so they cannot move into the module.
-/// `pub` only under `test-support`. Production reaches the backend through
-/// `backend_for` and never names the type from outside `sandbox`.
+/// Selected by `backend_for`; the kata tests drive it directly.
#[cfg(feature = "test-support")]
pub use kata_backend::KataBackend;
diff --git a/src/sandbox/loopback.rs b/src/sandbox/loopback.rs
index fb97660..5433ee6 100644
--- a/src/sandbox/loopback.rs
+++ b/src/sandbox/loopback.rs
@@ -7,10 +7,7 @@ use crate::config::Config;
use crate::error::{Error, Result};
use crate::sandbox::{Cmd, Exit, Sandbox, SandboxBackend, SandboxInfo, SandboxSpec};
-/// 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 visibility.
mod loopback_backend {
use super::Config;
// `pub` fields inside a private module are not nameable from
@@ -21,11 +18,7 @@ mod loopback_backend {
}
}
-/// The default backend, built by `backend_for`. A failure test builds one to inject a fault.
-///
-/// `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.
+/// The default backend, built by `backend_for`.
#[cfg(feature = "test-support")]
pub use loopback_backend::LoopbackBackend;
diff --git a/src/sandbox/mod.rs b/src/sandbox/mod.rs
index 1c73e40..22bf062 100644
--- a/src/sandbox/mod.rs
+++ b/src/sandbox/mod.rs
@@ -72,10 +72,7 @@ impl SandboxSpec {
}
}
-/// 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 visibility.
mod sandbox_info {
#[derive(Debug, Clone)]
pub struct SandboxInfo {
@@ -84,11 +81,7 @@ mod sandbox_info {
}
}
-/// The return type of `SandboxBackend::status`. No production module outside `sandbox` names it; the backend tests do.
-///
-/// `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.
+/// The return type of `SandboxBackend::status`.
#[cfg(feature = "test-support")]
pub use sandbox_info::SandboxInfo;
diff --git a/src/sandbox/remote.rs b/src/sandbox/remote.rs
index f881eb0..08474d4 100644
--- a/src/sandbox/remote.rs
+++ b/src/sandbox/remote.rs
@@ -9,14 +9,10 @@ use crate::error::{Error, Result};
use crate::sandbox::wire::{self, Frame};
use crate::sandbox::{Exit, Sandbox, SandboxBackend, SandboxInfo, SandboxSpec};
-/// 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 visibility.
mod remote_backend {
use super::{Config, Receiver};
- // `pub` fields inside a private module are not nameable from
- // outside; they stay readable by the impls below.
+ // `pub` inside a private module is still unreadable from outside it.
pub struct RemoteBackend {
pub cfg: Config,
@@ -26,11 +22,7 @@ mod remote_backend {
}
}
-/// The remote backend, built by `backend_for`. A fixture test builds one to drive the agent protocol.
-///
-/// `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.
+/// The remote backend, built by `backend_for`.
#[cfg(feature = "test-support")]
pub use remote_backend::RemoteBackend;
@@ -43,16 +35,8 @@ impl RemoteBackend {
Ok(Self { cfg: cfg.clone(), token: token.to_string(), addr: bound.local, queue: bound.rx })
}
- /// The address the rendezvous listener actually bound to.
- ///
- /// Test-tier only. Production binds through `bound_listener` and hands the
- /// address to the agent itself, so nothing in the crate asks for it back;
- /// `tests/remote_agent.rs` needs it to point a real agent at the socket.
- /// It is gated rather than left public because the census believed it had
- /// production callers at two `listener.local_addr()` calls — std's method
- /// on a `TcpListener`, in sibling files, which a name match cannot tell
- /// apart from this one. That confusion is what `dotted_only` confirmation
- /// in `tools/test-surface.py` now forces a human to resolve.
+ /// The address the rendezvous listener actually bound to, so a test can
+ /// point a real agent at the socket.
#[cfg(feature = "test-support")]
pub fn local_addr(&self) -> &str {
&self.addr
diff --git a/src/shims/mod.rs b/src/shims/mod.rs
index 675d69d..b56b067 100644
--- a/src/shims/mod.rs
+++ b/src/shims/mod.rs
@@ -7,7 +7,6 @@ use crate::hash;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default)]
-// FakePackage stays `pub`: the whole `shims` module is `test-support`-gated, so a release build never compiles it.
pub struct FakePackage {
pub name: String,
pub version: String,
@@ -53,7 +52,6 @@ impl FakePackage {
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
-// FakeInstalled stays `pub`: the whole `shims` module is `test-support`-gated, so a release build never compiles it.
pub struct FakeInstalled {
pub name: String,
pub version: String,
@@ -62,7 +60,6 @@ pub struct FakeInstalled {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default)]
-// Manifest stays `pub`: returned by `manifest()`, which the shim tests read; the module is `test-support`-gated.
pub struct Manifest {
pub name: String,
pub build: String,
@@ -141,13 +138,7 @@ fn forced_fail(tool: &str) -> bool {
std::env::var("AUR_SHIM_FAIL").is_ok_and(|v| v == tool)
}
-/// Read back the shim's invocation log.
-///
-/// Test-tier only. The shim *appends* to `invocations.jsonl` in production —
-/// that is how a fake tool leaves evidence — but nothing in the crate reads the
-/// file back; `called_with` below is the only reader and it is gated with this.
-/// The census credited this function with production callers at the two lines
-/// that name the *filename* in a string, which is not a call.
+/// Read back the shim's invocation log; the shim only ever appends to it.
#[cfg(feature = "test-support")]
pub fn invocations(dir: &Path) -> Vec<serde_json::Value> {
let path = dir.join("invocations.jsonl");
@@ -157,12 +148,7 @@ pub fn invocations(dir: &Path) -> Vec<serde_json::Value> {
}
}
-/// How many times the shim recorded `tool` being called with `needle` in its
-/// arguments.
-///
-/// Test-tier only. The shim *writes* the invocation log in production — that is
-/// how a fake tool leaves evidence — but nothing in the crate reads it back;
-/// only tests ask what a build actually did.
+/// How many times the shim recorded `tool` being called with `needle`.
#[cfg(feature = "test-support")]
pub fn called_with(dir: &Path, tool: &str, needle: &str) -> usize {
invocations(dir)
@@ -197,7 +183,7 @@ pub fn run(tool: &str) -> i32 {
}
}
-/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
+/// Reached only through `run`, which matches the tool name to it.
fn mkarchroot(args: &[String]) -> Result<i32, String> {
let mut target = None;
let mut skip = false;
@@ -221,7 +207,6 @@ fn mkarchroot(args: &[String]) -> Result<i32, String> {
Ok(0)
}
-/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
fn makechrootpkg(args: &[String], m: &Manifest) -> Result<i32, String> {
if !args.iter().any(|a| a == "-r") {
return Err("makechrootpkg: expected -r <chroot>".into());
@@ -397,7 +382,6 @@ fn fake_sig(bytes: &[u8]) -> Vec<u8> {
format!("-----BEGIN FAKE PGP SIGNATURE-----\n{}\n-----END FAKE PGP SIGNATURE-----\n", hash::hex(bytes)).into_bytes()
}
-/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
fn makepkg(args: &[String], m: &Manifest) -> Result<i32, String> {
if args.iter().any(|a| a == "--vercheck" || a == "-V-check") {
let v = m.vercheck.clone().unwrap_or_else(|| "1.0-1".into());
@@ -447,7 +431,6 @@ fn makepkg(args: &[String], m: &Manifest) -> Result<i32, String> {
}
}
-/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
fn pacman(args: &[String]) -> Result<i32, String> {
if args.iter().any(|a| a == "-U") {
for path in args.iter().filter(|a| !a.starts_with('-')) {
@@ -598,7 +581,6 @@ fn pkginfo_fields(pkg_bytes: &[u8]) -> Result<(String, String, String, String),
Ok((info.name, info.version, info.arch, extra))
}
-/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
fn gpg(args: &[String]) -> Result<i32, String> {
let out = args.iter().position(|a| a == "--output" || a == "-o").and_then(|i| args.get(i + 1)).cloned();
let target = args.iter().rev().find(|a| !a.starts_with('-') && Some(*a) != out.as_ref());
diff --git a/src/usecase/detect.rs b/src/usecase/detect.rs
index 81042f7..67cc83c 100644
--- a/src/usecase/detect.rs
+++ b/src/usecase/detect.rs
@@ -11,7 +11,6 @@ use crate::watch::detect::{self, Outcome};
/// subscription should not stop at the first pkgbase whose mirror is
/// unreachable, and the caller decides whether a failure is a line on stderr
/// or a row in a table.
-// Checked stays `pub`: what `usecase::detect` returns to the `aur-build` binary, which is a separate crate.
pub struct Checked {
pub pkgbase: String,
pub outcome: Result<Outcome>,
diff --git a/src/usecase/maintenance.rs b/src/usecase/maintenance.rs
index 8c66ee2..4276016 100644
--- a/src/usecase/maintenance.rs
+++ b/src/usecase/maintenance.rs
@@ -8,7 +8,6 @@ use crate::error::Result;
use crate::ops;
/// What a garbage collection would do, before anything is deleted.
-// GcPlan stays `pub`: what `usecase::plan_gc` returns to the `aur-build` binary, which is a separate crate.
pub struct GcPlan {
pub keep: usize,
/// Releases whose files survive.
diff --git a/src/usecase/reviews.rs b/src/usecase/reviews.rs
index c58e39b..8cbb534 100644
--- a/src/usecase/reviews.rs
+++ b/src/usecase/reviews.rs
@@ -7,7 +7,6 @@ use crate::pipeline;
use crate::review::{approve as ap, candidates, diff};
/// The diff a reviewer is being asked to look at, already recorded.
-// Prepared stays `pub`: what `prepare_review` and `view_review` return to the `aur-build` binary, which is a separate crate.
pub struct Prepared {
pub candidate: CandidateRow,
pub text: String,
diff --git a/src/watch/detect.rs b/src/watch/detect.rs
index d51ca03..454a9a7 100644
--- a/src/watch/detect.rs
+++ b/src/watch/detect.rs
@@ -26,7 +26,6 @@ pub enum Outcome {
}
#[derive(Debug, Clone)]
-// CheckReport stays `pub`: what `detect::check_pkgbase` returns; the test tier drives it and binds the value without naming it.
pub struct CheckReport {
pub pkgbase: String,
pub head: String,
diff --git a/src/watch/mirror.rs b/src/watch/mirror.rs
index 5a42a11..f38d7f8 100644
--- a/src/watch/mirror.rs
+++ b/src/watch/mirror.rs
@@ -111,10 +111,6 @@ mod tests {
use super::*;
/// A throwaway repo with these files committed, and its tip.
- ///
- /// Deliberately minimal: `read_tree` only ever needs a directory git will
- /// answer for, so the test does not stand up a mirror, a database or a
- /// config to ask it a question about one tree.
fn repo(files: &[(&str, &[u8])]) -> (std::path::PathBuf, String) {
let nonce = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos();
let dir = std::env::temp_dir().join(format!("aur-read-tree-{}-{}", std::process::id(), nonce));
diff --git a/src/watch/sources.rs b/src/watch/sources.rs
index 9767cef..a437a2b 100644
--- a/src/watch/sources.rs
+++ b/src/watch/sources.rs
@@ -1,15 +1,5 @@
-//! The source interface the build pipeline asks watch for.
-//!
-//! The step machine used to reach into two of watch's internals and reassemble
-//! the rules itself: `mirror::read_tree` plus `Tree::recipe_hash` to re-derive
-//! the hash a reviewer approved, and `digests::cached_path` plus
-//! `digests::download_and_cache` plus its own comparison to check a payload.
-//! That put the fail-closed test — the one thing that must never be skipped —
-//! in whichever step happened to want a file, and left the pipeline knowing how
-//! watch caches.
-//!
-//! Two calls cover what it actually needs: what a tree hashes to, and a
-//! guarantee that a cached source is the bytes its name claims.
+//! The source interface the build pipeline asks watch for: what a tree hashes
+//! to, and a guarantee that a cached source is the bytes its name claims.
use std::path::Path;
@@ -25,11 +15,8 @@ pub fn recipe_hash(mirror: &Path, commit: &str) -> Result<String> {
Ok(read_tree(mirror, commit)?.recipe_hash())
}
-/// Ensure `url` is cached and that what is cached hashes to `digest`.
-///
-/// Fails closed on a mismatch rather than handing back bytes that are not what
-/// was approved: a source that quietly changed is exactly the case the whole
-/// approval chain exists to catch.
+/// Ensure `url` is cached and that what is cached hashes to `digest`, failing
+/// closed on a mismatch.
pub fn verify_cached(cfg: &Config, db: &Db, url: &str, digest: &str) -> Result<()> {
let found = match cached_path(db, url, digest) {
Some(p) => crate::hash::digest_file(&p)?.0,
diff --git a/src/watch/staleness.rs b/src/watch/staleness.rs
index 6b83032..d3eed58 100644
--- a/src/watch/staleness.rs
+++ b/src/watch/staleness.rs
@@ -7,10 +7,7 @@ pub enum Kind {
Missing,
}
-/// 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 visibility.
mod stale {
use super::Kind;
@@ -24,11 +21,7 @@ mod stale {
}
}
-/// one row of the staleness report. `http` and `ops` read the report `stale_rows` returns, but only the staleness tests write the name.
-///
-/// `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.
+/// One row of the staleness report.
#[cfg(feature = "test-support")]
pub use stale::Stale;
diff --git a/src/watch/upstream.rs b/src/watch/upstream.rs
index 3faeacc..0a61d4c 100644
--- a/src/watch/upstream.rs
+++ b/src/watch/upstream.rs
@@ -14,7 +14,6 @@ use crate::error::{Error, Result, TransientCause};
use crate::git;
#[derive(Debug, Clone)]
-// StageA stays `pub`: what `upstream::probe` returns; tests/ops.rs and tests/vcs.rs call `probe` directly.
pub struct StageA {
pub pins: Vec<UpstreamPin>,
pub unprobed: Vec<String>,
@@ -131,10 +130,7 @@ static RUNNING: AtomicUsize = AtomicUsize::new(0);
static SLOT_FREE: Condvar = Condvar::new();
static SLOT_LOCK: Mutex<()> = Mutex::new(());
-/// 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 visibility.
mod stage_b_slot {
use super::{Ordering, RUNNING, SLOT_FREE, SLOT_LOCK};
@@ -158,11 +154,7 @@ mod stage_b_slot {
}
}
-/// The stage-B concurrency slot. The VCS test that asserts it needs a real mirror, so it cannot move into the module.
-///
-/// `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.
+/// The stage-B concurrency slot.
#[cfg(feature = "test-support")]
pub use stage_b_slot::StageBSlot;