From 053dfbca8a4955a616e9b2c0f5a5d664c0db7aef Mon Sep 17 00:00:00 2001 From: aur-build Date: Sun, 22 Nov 2026 10:51:45 +0000 Subject: 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. --- src/shims/mod.rs | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'src/shims') 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 { let path = dir.join("invocations.jsonl"); @@ -157,12 +148,7 @@ pub fn invocations(dir: &Path) -> Vec { } } -/// 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 { let mut target = None; let mut skip = false; @@ -221,7 +207,6 @@ fn mkarchroot(args: &[String]) -> Result { 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 { if !args.iter().any(|a| a == "-r") { return Err("makechrootpkg: expected -r ".into()); @@ -397,7 +382,6 @@ fn fake_sig(bytes: &[u8]) -> Vec { 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 { 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 { } } -/// 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 { 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 { 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()); -- cgit v1.2.3