From debb8af0ef0e72048b9df5fed40071745ea40c6b Mon Sep 17 00:00:00 2001 From: aur-build Date: Fri, 20 Nov 2026 23:39:07 +0000 Subject: sandbox,http,review,watch: keep six more test-only types out of the release build --- src/http/sse.rs | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'src/http/sse.rs') diff --git a/src/http/sse.rs b/src/http/sse.rs index bceba9f..98e9282 100644 --- a/src/http/sse.rs +++ b/src/http/sse.rs @@ -8,17 +8,34 @@ const MAX_LIFETIME: Duration = Duration::from_secs(30 * 60); const KEEPALIVE: Duration = Duration::from_secs(10); const POLL: Duration = Duration::from_millis(200); -pub struct LogTail { - path: PathBuf, - build_id: String, - db: crate::db::Db, - offset: u64, - out: std::collections::VecDeque, - started: Instant, - since_keepalive: Duration, - ended: bool, +/// 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. +mod log_tail { + pub struct LogTail { + path: PathBuf, + build_id: String, + db: crate::db::Db, + offset: u64, + out: std::collections::VecDeque, + started: Instant, + since_keepalive: Duration, + ended: bool, + } } +/// The SSE tail handle. The live test that names it drives a real server, 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. +#[cfg(feature = "test-support")] +pub use log_tail::LogTail; + +#[cfg(not(feature = "test-support"))] +pub(crate) use log_tail::LogTail; + impl LogTail { pub fn new(cfg: &crate::config::Config, db: crate::db::Db, build_id: &str) -> Self { Self { -- cgit v1.2.3