diff --git a/.machine_readable/6a2/STATE.a2ml b/.machine_readable/6a2/STATE.a2ml index ffffd639..47d9d97f 100644 --- a/.machine_readable/6a2/STATE.a2ml +++ b/.machine_readable/6a2/STATE.a2ml @@ -352,10 +352,12 @@ priority-3 = [ # ============================================================================ [session-2026-04-16] -summary = "Cleared two compile blockers discovered by `check current standing`; workspace now green." +summary = "Cleared compile blockers + swept all workspace warnings; workspace now fully green." changes = [ "emergency-button/rust/src/main.rs: added .display() to two PathBuf format calls (lines 82, 104)", "clinician/src/main.rs: rewritten as minimal working dispatcher — imports modules from crate, uses real enum names, stubs non-wired subcommands. Full CLI surface tracked as P1 follow-up.", + "Warning sweep: deleted unused `verbose` field/flag from emergency-button + emergency-room; deleted unused `inode`/`cmdline` fields and 4 unused pub utility functions from port-endoscope; deleted dead `events` binding in hardware-crash-team analyzer; cfg-gated Screen enum in hardware-crash-team/tui to `any(feature = \"tui\", test)`; dropped unused imports in clinician/lib.rs and contracts-rust property_tests; removed stray parens in proptest strategy.", + "Cargo.toml: moved [profile.release] from clinician/Cargo.toml to workspace root (clears 'profiles for the non root package will be ignored' warning).", ] -test-baseline = "cargo test --workspace: 195 passed, 0 failed (13 suites: contracts-rust 47, clinician 15+13+12+5, contracts-rust property 12, aspect 5, E2E 9, hardware-crash-team 77, others 0)" -build-status = "cargo check --workspace: clean (1 unused-import warning in clinician lib)" +test-baseline = "cargo test --workspace: 195 passed, 0 failed (13 suites); cargo test -p hardware-crash-team --features tui: 76 passed, 0 failed. ZERO warnings under both builds." +build-status = "cargo build --workspace: clean; cargo build -p hardware-crash-team --features tui: clean." diff --git a/Cargo.toml b/Cargo.toml index 38077368..dc6a39ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,3 +14,8 @@ resolver = "2" [workspace.dependencies] proptest = "1.4" criterion = "0.5" + +[profile.release] +lto = true +codegen-units = 1 +strip = true diff --git a/clinician/Cargo.toml b/clinician/Cargo.toml index 2c7874ca..480606de 100644 --- a/clinician/Cargo.toml +++ b/clinician/Cargo.toml @@ -80,7 +80,5 @@ anomaly = ["ndarray"] # ESN/LSM anomaly detection bluetooth = ["bluer"] # Bluetooth device monitoring (BT Sentinel) all = ["storage", "cache", "ai", "p2p", "search", "forum", "anomaly", "bluetooth"] -[profile.release] -lto = true -codegen-units = 1 -strip = true +# NOTE: release-profile tuning lives in the workspace root Cargo.toml so it +# applies consistently across all member crates. diff --git a/clinician/src/lib.rs b/clinician/src/lib.rs index 9ee7a19f..a66a8379 100644 --- a/clinician/src/lib.rs +++ b/clinician/src/lib.rs @@ -32,10 +32,9 @@ pub mod tools; // Task-specific administrative utilities. /// SYSTEM PATHS: Standardized cross-platform directory resolution. pub mod dirs { - use directories::ProjectDirs; use std::path::PathBuf; - /// RESOLUTION: Dispatches to the OS-appropriate storage locations + /// RESOLUTION: Dispatches to the OS-appropriate storage locations /// using the `directories` crate. pub fn config_dir() -> PathBuf { // ... [Path resolution implementation] diff --git a/contracts-rust/tests/property_tests.rs b/contracts-rust/tests/property_tests.rs index 923f3028..0f339350 100644 --- a/contracts-rust/tests/property_tests.rs +++ b/contracts-rust/tests/property_tests.rs @@ -8,7 +8,6 @@ use ambientops_contracts::*; use chrono::Utc; use proptest::prelude::*; -use serde_json::json; use uuid::Uuid; // ============================================================================= @@ -152,7 +151,7 @@ fn arb_receipt() -> impl Strategy { Just(Uuid::new_v4()), Just(Uuid::new_v4()), prop::collection::vec( - ("[a-z0-9_]{1,20}"), + "[a-z0-9_]{1,20}", step_count as usize, ), ) diff --git a/emergency-button/rust/src/incident.rs b/emergency-button/rust/src/incident.rs index ff0974a9..064131a7 100644 --- a/emergency-button/rust/src/incident.rs +++ b/emergency-button/rust/src/incident.rs @@ -13,7 +13,6 @@ pub const SCHEMA_VERSION: &str = "1.0.0"; pub struct Config { pub quick_backup_dest: Option, pub dry_run: bool, - pub verbose: bool, } pub struct Incident { diff --git a/emergency-button/rust/src/main.rs b/emergency-button/rust/src/main.rs index 29799e30..a66ac2e3 100644 --- a/emergency-button/rust/src/main.rs +++ b/emergency-button/rust/src/main.rs @@ -37,10 +37,6 @@ struct TriggerArgs { /// Preview actions without executing #[arg(short = 'n', long)] dry_run: bool, - - /// Verbose output - #[arg(short = 'V', long)] - verbose: bool, } fn main() { @@ -56,7 +52,6 @@ fn run_trigger(args: TriggerArgs) { let cfg = incident::Config { quick_backup_dest: args.quick_backup.clone(), dry_run: args.dry_run, - verbose: args.verbose, }; println!(); @@ -118,7 +113,6 @@ fn print_help() { println!("\x1b[1mOPTIONS (for trigger):\x1b[0m"); println!(" -b, --quick-backup Run quick backup to destination (opt-in)"); println!(" -n, --dry-run Preview actions without executing"); - println!(" -V, --verbose Verbose output"); println!(); println!("\x1b[1mSAFETY:\x1b[0m"); println!(" Default action is non-destructive and offline-first"); diff --git a/emergency-room/rust/src/incident.rs b/emergency-room/rust/src/incident.rs index ff0974a9..064131a7 100644 --- a/emergency-room/rust/src/incident.rs +++ b/emergency-room/rust/src/incident.rs @@ -13,7 +13,6 @@ pub const SCHEMA_VERSION: &str = "1.0.0"; pub struct Config { pub quick_backup_dest: Option, pub dry_run: bool, - pub verbose: bool, } pub struct Incident { diff --git a/emergency-room/rust/src/main.rs b/emergency-room/rust/src/main.rs index 1deb70d7..faf21a5f 100644 --- a/emergency-room/rust/src/main.rs +++ b/emergency-room/rust/src/main.rs @@ -45,8 +45,6 @@ struct TriggerArgs { quick_backup: Option, #[arg(short = 'n', long)] dry_run: bool, - #[arg(short = 'V', long)] - verbose: bool, } #[derive(Args)] @@ -119,7 +117,6 @@ fn run_trigger(args: TriggerArgs) { let cfg = incident::Config { quick_backup_dest: args.quick_backup.clone(), dry_run: args.dry_run, - verbose: args.verbose, }; println!(); diff --git a/hardware-crash-team/src/analyzer/mod.rs b/hardware-crash-team/src/analyzer/mod.rs index cf8103c1..33a5ebf8 100644 --- a/hardware-crash-team/src/analyzer/mod.rs +++ b/hardware-crash-team/src/analyzer/mod.rs @@ -160,7 +160,6 @@ pub fn diagnose(boots: usize, device_filter: Option<&str>) -> Result = device_crash_count .iter() .map(|(device, &count)| { - let events = device_events.get(device).map(|e| e.len()).unwrap_or(0); let event_desc = device_events .get(device) .and_then(|e| e.first()) diff --git a/hardware-crash-team/src/scanner/mod.rs b/hardware-crash-team/src/scanner/mod.rs index 76b46865..ff6d8fb6 100644 --- a/hardware-crash-team/src/scanner/mod.rs +++ b/hardware-crash-team/src/scanner/mod.rs @@ -688,7 +688,6 @@ fn read_kernel_version() -> String { #[cfg(test)] mod tests { use super::*; - use crate::types::*; fn make_device(slot: &str, driver: Option<&str>, power: PowerState, issues: Vec) -> PciDevice { PciDevice { diff --git a/hardware-crash-team/src/tui/mod.rs b/hardware-crash-team/src/tui/mod.rs index 4a94d828..b512fa36 100644 --- a/hardware-crash-team/src/tui/mod.rs +++ b/hardware-crash-team/src/tui/mod.rs @@ -26,6 +26,7 @@ pub fn run() -> anyhow::Result<()> { } /// Screen identifiers +#[cfg(any(feature = "tui", test))] #[derive(Debug, Clone, Copy, PartialEq)] pub enum Screen { DeviceList, @@ -35,6 +36,7 @@ pub enum Screen { StatusDashboard, } +#[cfg(any(feature = "tui", test))] impl Screen { /// Cycle to next screen pub fn next(self) -> Self { diff --git a/port-endoscope/src/port.rs b/port-endoscope/src/port.rs index f9cab394..b36730fa 100644 --- a/port-endoscope/src/port.rs +++ b/port-endoscope/src/port.rs @@ -4,8 +4,8 @@ //! Port introspection via /proc/net/{tcp,udp} and /proc/*/fd. //! //! Parses the kernel's network socket tables directly from procfs rather than -//! shelling out to `ss` or `lsof`. This gives us PID ownership, socket state, -//! and inode mapping without any external dependencies. +//! shelling out to `ss` or `lsof`. This gives us PID ownership and socket +//! state without any external dependencies. use anyhow::Result; use std::collections::HashMap; @@ -23,8 +23,6 @@ pub struct PortHolder { pub socket_state: String, /// File descriptor number within the process (if determinable). pub fd: Option, - /// Socket inode number. - pub inode: u64, } /// TCP socket states from /proc/net/tcp (hex state field). @@ -173,7 +171,6 @@ pub fn find_port_holders(port: u16, proto: &str) -> Result> { local_port, socket_state: state, fd: Some(fd), - inode, }); } else { // Socket exists but no process found (maybe kernel-owned or permission denied) @@ -182,7 +179,6 @@ pub fn find_port_holders(port: u16, proto: &str) -> Result> { local_port, socket_state: state, fd: None, - inode, }); } } @@ -208,7 +204,6 @@ pub fn find_all_listening() -> Result> { local_port, socket_state: state, fd: if pid > 0 { Some(fd) } else { None }, - inode, }); } @@ -230,38 +225,3 @@ pub fn find_all_listening() -> Result> { Ok(holders) } -/// Check if a specific port is free (no holders). -pub fn is_port_free(port: u16, proto: &str) -> bool { - find_port_holders(port, proto) - .map(|h| h.is_empty()) - .unwrap_or(true) -} - -/// Try to bind to a port to verify it's truly available. -/// Returns true if the port can be bound (and immediately releases it). -pub fn can_bind(port: u16) -> bool { - use std::net::{TcpListener, SocketAddr}; - let addr: SocketAddr = ([127, 0, 0, 1], port).into(); - TcpListener::bind(addr).is_ok() -} - -/// Find the next available port starting from `start`. -/// Useful for fallback port selection. -pub fn find_free_port(start: u16) -> Option { - for port in start..=65535 { - if can_bind(port) { - return Some(port); - } - } - None -} - -/// Suggest a fallback port if the requested port is stuck. -/// Tries the requested port first, then scans upward. -pub fn suggest_port(preferred: u16) -> u16 { - if can_bind(preferred) { - preferred - } else { - find_free_port(preferred + 1).unwrap_or(0) - } -} diff --git a/port-endoscope/src/process.rs b/port-endoscope/src/process.rs index 33a4da02..5c0812d1 100644 --- a/port-endoscope/src/process.rs +++ b/port-endoscope/src/process.rs @@ -3,9 +3,9 @@ //! Process introspection and termination via procfs and signals. //! -//! Reads /proc//stat, /proc//status, and /proc//cmdline to -//! determine process name, state (zombie, sleeping, running), and age. -//! Provides graceful kill (SIGTERM → wait → SIGKILL) for port reclamation. +//! Reads /proc//stat and /proc//status to determine process name, +//! state (zombie, sleeping, running), and age. Provides graceful kill +//! (SIGTERM → wait → SIGKILL) for port reclamation. use anyhow::Result; use std::fs; @@ -20,8 +20,6 @@ pub struct ProcessInfo { pub is_zombie: bool, /// Process age in seconds (since start time), if determinable. pub age_secs: Option, - /// Full command line (from /proc//cmdline). - pub cmdline: String, } /// Read process information from /proc//. @@ -30,7 +28,6 @@ pub fn get_process_info(pid: u32) -> ProcessInfo { name: "".to_string(), is_zombie: false, age_secs: None, - cmdline: String::new(), }; if pid == 0 { @@ -64,16 +61,10 @@ pub fn get_process_info(pid: u32) -> ProcessInfo { // Read process start time for age calculation let age_secs = calculate_process_age(pid); - // Read command line - let cmdline = fs::read_to_string(format!("/proc/{}/cmdline", pid)) - .map(|s| s.replace('\0', " ").trim().to_string()) - .unwrap_or_default(); - ProcessInfo { name, is_zombie, age_secs, - cmdline, } }