From e757979f1a2afdbe7146066345bb9acd19d3b151 Mon Sep 17 00:00:00 2001 From: aur-build Date: Thu, 19 Nov 2026 17:09:59 +0000 Subject: comments: say why, not what MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/pipeline/mod.rs | 49 ++++++++++++++----------------------------------- 1 file changed, 14 insertions(+), 35 deletions(-) (limited to 'src/pipeline/mod.rs') 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> { let spec = crate::sandbox::SandboxSpec { profile: self.profile.clone(), @@ -265,10 +250,9 @@ pub fn run_with(ctx: &Ctx) -> Result { )?; 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