summaryrefslogtreecommitdiffstats
path: root/src/pipeline/mod.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 17:09:59 +0000
committeraur-build <aur-build@localhost>2026-11-19 17:09:59 +0000
commite757979f1a2afdbe7146066345bb9acd19d3b151 (patch)
tree30d5f5fbccd25ea7bf01c5202684af463b74e7d3 /src/pipeline/mod.rs
parent94c318f13264bb3c00a9f3057ba2e1aafb57c9e4 (diff)
downloadaur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.tar.gz
aur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.zip
comments: say why, not what
Every module-level `//!` header is gone, and the comments that remained either re-explained the line below them or had grown into paragraphs. Density went from one comment line per 6.7 lines of code to one per 10. 827 insertions against 2194 deletions across 86 files. What survived: the invariants (I1-I12), the design cross-references into DESIGN.md, and the notes recording a bug that was found and fixed — those are the comments that carry weight, because they answer a question the code cannot answer about itself. What did not: restating a function signature in prose, and narration of the statement underneath.
Diffstat (limited to 'src/pipeline/mod.rs')
-rw-r--r--src/pipeline/mod.rs49
1 files changed, 14 insertions, 35 deletions
diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs
index 6729605..308f2a8 100644
--- a/src/pipeline/mod.rs
+++ b/src/pipeline/mod.rs
@@ -1,10 +1,3 @@
-//! The build pipeline (§8).
-//!
-//! Ten steps, each idempotent and checkpointed in `build_step`. A worker can die
-//! at any instant and the pipeline resumes at the next incomplete step with no
-//! duplicate side effects (I5). Only the last step is externally visible, and it
-//! is serialized per repo (I4).
-
pub mod publish;
pub mod dispatch;
mod steps;
@@ -37,15 +30,10 @@ pub struct SourceIdentity {
}
impl SourceIdentity {
- /// The identity of a build's source, complete on construction (n-1).
- ///
- /// This used to return a value with `aur_commit` and `recipe_hash` left
- /// empty, which `Ctx::new` filled in afterwards if it happened to find the
- /// snapshot row — so a `SourceIdentity` was a type whose empty strings could
- /// mean either "not filled in yet" or "genuinely unknown", and a new call
- /// site that forgot the second half produced a build that silently recorded
- /// an empty provenance. The snapshot is an argument now: you cannot build one
- /// without it.
+ /// The identity of a build's source, complete on construction (n-1). The
+ /// snapshot is an argument because an `aur_commit` that could mean either
+ /// "not filled in yet" or "genuinely unknown" records empty provenance
+ /// silently.
pub fn from_candidate(c: &CandidateRow, snapshot: &SnapshotRow) -> Self {
Self {
aur_commit: snapshot.aur_commit.clone(),
@@ -175,12 +163,9 @@ impl Ctx {
})
}
- /// Lease a sandbox for this build's profile. Today every step acquires and
- /// releases around itself; a remote backend will hold one sandbox across
- /// the sandbox-bearing steps of a build, and steps stay idempotent either
- /// way (I5). The TTL is the lease window: a sandbox that outlives it is
- /// assumed dead, which is exactly what the reaper already concludes about
- /// an expired build lease.
+ /// Lease a sandbox for this build's profile. The TTL is the lease window: a
+ /// sandbox that outlives it is assumed dead, which is what the reaper already
+ /// concludes about an expired build lease.
pub fn sandbox(&self) -> Result<Arc<dyn Sandbox>> {
let spec = crate::sandbox::SandboxSpec {
profile: self.profile.clone(),
@@ -265,10 +250,9 @@ pub fn run_with(ctx: &Ctx) -> Result<Outcome> {
)?;
ctx.log_line(&format!("!! {step} failed: {e}"));
// A failed build must not leave the old version looking healthy.
- // Nothing has to *do* that: the accepted pointer was never moved,
- // so "approved, build failed, index still serving the old
- // version" is what the derived query reads back (§8.4). There is
- // deliberately no state to set here — see `approved_but_unbuilt`.
+ // Nothing has to do that: the accepted pointer was never moved,
+ // so the derived query reads it back (§8.4). There is
+ // deliberately no state to set here.
return Ok(Outcome::Failed { step: step.to_string(), error: e.to_string(), transient });
}
}
@@ -314,15 +298,10 @@ pub fn enqueue_manual_rebuild(cfg: &Config, db: &Db, pkgbase: &str) -> Result<St
let rel = db::accepted_release(db, pkgbase)?
.ok_or_else(|| Error::invalid(format!("{pkgbase} has no accepted release")))?;
// A manual rebuild is the accepted release asked for again, so its identity
- // is derived from what that release actually is — commit, recipe, pins,
- // digests — through the same canonical-JSON hash every other identity uses
- // (n-5). The old version was an ad-hoc `commit|hash|manual` string: a
- // different format for the same concept, with a delimiter that could appear
- // inside the values, and no pins or digests at all, so two releases with the
- // same recipe but different upstream commits... were distinguished only by
- // luck. `requested` is what keeps a rebuild a *distinct* build from the one
- // that produced the release, while staying deterministic (§8.2): clicking
- // rebuild twice is one build, not two.
+ // is derived from what that release actually is, through the same
+ // canonical-JSON hash every other identity uses (n-5). `requested` is what
+ // keeps a rebuild a *distinct* build while staying deterministic (§8.2):
+ // clicking rebuild twice is one build, not two.
let identity = format!(
"sha256:{}",
crate::hash::hex(crate::hash::canonical_json(&serde_json::json!({