From c295510e2bb0ee61234536c832dad87a45977fc8 Mon Sep 17 00:00:00 2001 From: aur-build Date: Fri, 20 Nov 2026 23:38:01 +0000 Subject: sandbox: keep `Exit` out of the release build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Exit` is the result of running a command in a sandbox. `pipeline` consumes it through `Sandbox::run` — `.success()`, `.stderr` — without ever writing the name, which is why the census called it dead outside `sandbox`. The type now lives in a private `mod exit` and reaches the world through an alias that is `pub` only under `test-support` and `pub(crate)` otherwise. A `pub` definition inside a private module is not a nameable path from outside, but it is visible enough to appear in a public trait signature, which is what makes this possible where a plain `pub(crate) struct` is not. Verified with an external crate: naming `aur_build::sandbox::Exit` in a release build is `error[E0603]: struct Exit is private`; with `test-support` it compiles. --- src/review/risk.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/review/risk.rs') diff --git a/src/review/risk.rs b/src/review/risk.rs index 9a7145d..e48ca24 100644 --- a/src/review/risk.rs +++ b/src/review/risk.rs @@ -3,7 +3,18 @@ use crate::error::Result; use crate::pkgver; pub mod level { - pub const LOW: &str = "low"; + /// `MEDIUM` and `HIGH` are matched by the UI to order risk, so they are + /// genuinely public. `LOW` is only ever produced here and asserted by a + /// test, so it is crate-internal in a production build. The string lives + /// once, in `LOW_VALUE`, so the two aliases cannot drift. + const LOW_VALUE: &str = "low"; + + #[cfg(feature = "test-support")] + pub const LOW: &str = LOW_VALUE; + + #[cfg(not(feature = "test-support"))] + pub(crate) const LOW: &str = LOW_VALUE; + pub const MEDIUM: &str = "medium"; pub const HIGH: &str = "high"; } -- cgit v1.2.3