diff options
Diffstat (limited to 'src/watch')
| -rw-r--r-- | src/watch/detect.rs | 1 | ||||
| -rw-r--r-- | src/watch/mirror.rs | 4 | ||||
| -rw-r--r-- | src/watch/sources.rs | 21 | ||||
| -rw-r--r-- | src/watch/staleness.rs | 11 | ||||
| -rw-r--r-- | src/watch/upstream.rs | 12 |
5 files changed, 8 insertions, 41 deletions
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; |
