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/watch/digests.rs | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'src/watch/digests.rs') diff --git a/src/watch/digests.rs b/src/watch/digests.rs index 8136850..d3119eb 100644 --- a/src/watch/digests.rs +++ b/src/watch/digests.rs @@ -1,15 +1,3 @@ -//! Source digest resolution (§5.3). -//! -//! `sha256sums=('SKIP')` is the hole in the integrity story. We resolve and -//! record the digest of *every* source ourselves, at detection time, regardless -//! of what the PKGBUILD declares — which turns a silent artifact swap into a -//! reviewable (or at least alertable) event. -//! -//! Cost control: only `SKIP`-declared static sources cost bandwidth. Declared -//! checksums are trusted-as-declared for identity because makepkg enforces them -//! at build time; VCS digests come free from the pin we already resolved; local -//! files are already in the mirror. - use crate::config::Config; use crate::db::{self, *}; use crate::error::Result; @@ -49,10 +37,9 @@ pub fn resolve_sources( digest, size: 0, // Computed from the recipe like every other entry (m-19), not - // hardcoded: the field answers "did the recipe give us a - // checksum?", and for a VCS source the answer is usually yes-by- - // absence — which is why renderers must ask `is_vcs` before - // calling it a missing checksum. + // hardcoded: for a VCS source the answer is usually + // yes-by-absence, so renderers must ask `is_vcs` before calling + // it a missing checksum. skip_declared: match declared_sums(recipe, entry.index) { Some(d) => d == SKIP || !is_hex_digest(&d), None => true, @@ -120,11 +107,8 @@ pub fn resolve_sources( /// Download `url`, hashing as we go, and record it in `source_cache`. /// -/// This always goes to the network. That is deliberate: the whole point of §5.3 -/// is to notice that the bytes behind a `SKIP` source changed while the version -/// did not, and answering from our own cache would make that impossible. The -/// cache exists so the *build* can reuse the bytes it was reviewed against -/// ([`cached_path`]), not so detection can skip looking. +/// This always goes to the network: the point of .5.3 is to notice that the bytes +/// behind a `SKIP` source changed while the version did not. pub fn download_and_cache(cfg: &Config, db: &Db, url: &str) -> Result<(String, u64)> { let tmp = cfg.source_cache_dir().join(format!("tmp-{}", crate::hash::short(url.as_bytes(), 16))); let (digest, size) = crate::fetch::fetch_to(url, &tmp)?; -- cgit v1.2.3