diff --git a/src-tauri/src/commands/live.rs b/src-tauri/src/commands/live.rs index f3408ec..4f4d21a 100644 --- a/src-tauri/src/commands/live.rs +++ b/src-tauri/src/commands/live.rs @@ -563,8 +563,14 @@ impl LiveSessionRuntime { // the lifecycle deadlock is broken either way. if let Some(task) = self.state.inflight.as_ref() { task.abort_flag.store(true, Ordering::Relaxed); + // Targeting convention: implicit module-path target + // (`lumotia_lib::commands::live`) so the operator's + // `RUST_LOG=…,lumotia_lib::commands::live=debug` filter + // covers this emit. A previous `target: "lumotia_live"` + // literal slipped past EnvFilter (which matches on + // `::`-segments, not substrings) and silenced this + // warning during the operator's documented triage. tracing::warn!( - target: "lumotia_live", session_id = self.session_id, chunk_id = task.chunk_id, timeout_ms = drain_timeout_ms, @@ -2094,4 +2100,41 @@ mod tests { "Drop for InferenceTask must signal cancellation to the worker" ); } + + /// Regression: every `tracing::*!` emit in this file must use the + /// implicit module-path target so it is covered by the operator's + /// documented triage filter + /// `RUST_LOG=...,lumotia_lib::commands::live=debug`. + /// + /// A previous custom literal target slipped past EnvFilter (which + /// matches on `::`-segments, not substrings) and silenced the + /// drain-timeout warning at incident time. If you find yourself + /// reaching for a custom literal target here, instead extend the + /// `DEFAULT_*_FILTER` constants in `src-tauri/src/lib.rs`. + #[test] + fn no_lumotia_live_literal_target_in_live_rs() { + let source = include_str!("live.rs"); + // The forbidden literal, assembled at runtime so this test's own + // source does not contain a stray match. Comment + doc-comment + // lines are skipped so the rationale above does not self-trip. + let forbidden = format!("\"{}\"", "lumotia_live"); + let mut offenders = Vec::new(); + for (idx, raw) in source.lines().enumerate() { + let trimmed = raw.trim_start(); + if trimmed.starts_with("//") { + continue; + } + if raw.contains("target:") && raw.contains(&forbidden) { + offenders.push(format!("L{}: {}", idx + 1, raw.trim())); + } + } + assert!( + offenders.is_empty(), + "found custom literal target(s) that dodge the \ + `lumotia_lib::commands::live` EnvFilter directive. Drop the \ + `target:` parameter so the emit uses the module-path target. \ + Offenders:\n{}", + offenders.join("\n") + ); + } }