summaryrefslogtreecommitdiffstats
path: root/src/shims/mod.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-21 09:38:21 +0000
committeraur-build <aur-build@localhost>2026-11-21 09:38:21 +0000
commitae492c87ff66b9f2c8fec25a5ca917c438bf5858 (patch)
tree18297d0227af73562f9cf6575664649448d8d907 /src/shims/mod.rs
parent28023ba17adbe6fc096a31d5e2c62d017a88fc4c (diff)
downloadaur-build-ae492c87ff66b9f2c8fec25a5ca917c438bf5858.tar.gz
aur-build-ae492c87ff66b9f2c8fec25a5ca917c438bf5858.zip
src: close the items the stricter detector surfaced
The auditor's two counterexamples were real, and fixing the detector exposed seventeen more items it had never listed. Each was checked individually rather than dispositioned in bulk, and the check changed what the right answer was: - `review::approve::withdraw` — gated. The CLI and the web UI both go through `usecase::withdraw_package`; nothing invokes this. tests/pipeline.rs pins its invariants, so it is gated rather than deleted: the test is the cover for an operation production has not grown yet. - `pipeline::dispatch::Pool::shutdown` — gated. Production runs the pool until the process exits; a test needs the join to assert on effects after the threads stop. Its two fields now carry a matching `cfg_attr(allow(dead_code))` because in a release build they are stored and never read. - `shims::{mkarchroot,makechrootpkg,makepkg,gpg,pacman,record}` — plain `pub(crate)`. `run` dispatches to them by tool name; no module outside `shims` names them and no test calls them. The tool names appear in test *strings*, which is not a caller. - `db::Writer::start`, `fetch::open`, `http::Req::form`, `http::Page::new`, `http::Panel::new`, `http::render::BuildRow` — plain `pub(crate)`, same reason: used only from inside their own module. - `db::AuditEntry::system` — deleted. `audit_system` builds the row through the free `audit()`; nothing ever called the constructor, production or otherwise. - `pkgver::Version::display` — deleted, a wrapper around `to_string` with no callers. - `http::Server`, `watch::Stale`, `pkgver::Version` — private inner module with a gated alias. `Server` is what `spawn` hands back and `main` holds without naming; `Stale` is what `stale_rows` returns to `http` and `ops`; `Version` is what `parse` returns. All three must stay nameable to those callers in shape but not in name, which is exactly what the inner-module alias gives. Measured on the release build's public surface: 466 reachable public names at the start of this goal, 402 now, newly-public set empty.
Diffstat (limited to 'src/shims/mod.rs')
-rw-r--r--src/shims/mod.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/shims/mod.rs b/src/shims/mod.rs
index 4b29466..a877739 100644
--- a/src/shims/mod.rs
+++ b/src/shims/mod.rs
@@ -109,7 +109,8 @@ fn manifest_impl() -> Manifest {
}
}
-pub fn record(tool: &str, args: &[String]) {
+/// Called by `run` to log the invocation; nothing outside `shims` records a shim call.
+pub(crate) fn record(tool: &str, args: &[String]) {
let dir = match std::env::var("AUR_SHIM_DIR") {
Ok(d) => d,
Err(_) => return,
@@ -206,7 +207,8 @@ pub fn run(tool: &str) -> i32 {
}
}
-pub fn mkarchroot(args: &[String]) -> Result<i32, String> {
+/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
+pub(crate) fn mkarchroot(args: &[String]) -> Result<i32, String> {
let mut target = None;
let mut skip = false;
for a in args {
@@ -229,7 +231,8 @@ pub fn mkarchroot(args: &[String]) -> Result<i32, String> {
Ok(0)
}
-pub fn makechrootpkg(args: &[String], m: &Manifest) -> Result<i32, String> {
+/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
+pub(crate) fn makechrootpkg(args: &[String], m: &Manifest) -> Result<i32, String> {
if !args.iter().any(|a| a == "-r") {
return Err("makechrootpkg: expected -r <chroot>".into());
}
@@ -407,7 +410,8 @@ fn fake_sig(bytes: &[u8]) -> Vec<u8> {
format!("-----BEGIN FAKE PGP SIGNATURE-----\n{}\n-----END FAKE PGP SIGNATURE-----\n", hash::hex(bytes)).into_bytes()
}
-pub fn makepkg(args: &[String], m: &Manifest) -> Result<i32, String> {
+/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
+pub(crate) fn makepkg(args: &[String], m: &Manifest) -> Result<i32, String> {
if args.iter().any(|a| a == "--vercheck" || a == "-V-check") {
let v = m.vercheck.clone().unwrap_or_else(|| "1.0-1".into());
println!("{v}");
@@ -456,7 +460,8 @@ pub fn makepkg(args: &[String], m: &Manifest) -> Result<i32, String> {
}
}
-pub fn pacman(args: &[String]) -> Result<i32, String> {
+/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
+pub(crate) fn pacman(args: &[String]) -> Result<i32, String> {
if args.iter().any(|a| a == "-U") {
for path in args.iter().filter(|a| !a.starts_with('-')) {
let p = std::path::Path::new(path);
@@ -624,7 +629,8 @@ fn pkginfo_fields(pkg_bytes: &[u8]) -> Result<(String, String, String, String),
Ok((info.name, info.version, info.arch, extra))
}
-pub fn gpg(args: &[String]) -> Result<i32, String> {
+/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
+pub(crate) fn gpg(args: &[String]) -> Result<i32, String> {
let out = args
.iter()
.position(|a| a == "--output" || a == "-o")