style(server,agent): fmt + clippy fixes for Task 5 (CI green)
All checks were successful
All checks were successful
9082e11 compiles + passes all 50 server tests on the build host; only blocked
CI on cargo fmt (4 files) and one clippy -D dead-code denial:
- cargo fmt --all (relay/mod.rs, session/mod.rs, agent consent/mod.rs + session/mod.rs)
- #[cfg_attr(not(test), allow(dead_code))] on session::get_consent_state (a
read accessor currently exercised only by tests)
No logic change.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -73,8 +73,7 @@ pub fn prompt_consent(technician_name: &str, access: ConsentAccessMode) -> bool
|
||||
use std::os::windows::ffi::OsStrExt;
|
||||
use windows::core::PCWSTR;
|
||||
use windows::Win32::UI::WindowsAndMessaging::{
|
||||
MessageBoxW, IDYES, MB_ICONQUESTION, MB_SETFOREGROUND, MB_SYSTEMMODAL, MB_TOPMOST,
|
||||
MB_YESNO,
|
||||
MessageBoxW, IDYES, MB_ICONQUESTION, MB_SETFOREGROUND, MB_SYSTEMMODAL, MB_TOPMOST, MB_YESNO,
|
||||
};
|
||||
|
||||
let title = "GuruConnect - Remote Support Request";
|
||||
@@ -150,6 +149,9 @@ mod tests {
|
||||
#[test]
|
||||
fn access_mode_from_proto_defaults_to_control() {
|
||||
// An out-of-range proto value must not under-state access.
|
||||
assert_eq!(ConsentAccessMode::from_proto(999), ConsentAccessMode::Control);
|
||||
assert_eq!(
|
||||
ConsentAccessMode::from_proto(999),
|
||||
ConsentAccessMode::Control
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,15 +533,13 @@ impl SessionManager {
|
||||
|
||||
// The MessageBox blocks the calling thread; run it on the blocking pool
|
||||
// so the agent's async loop is not stalled and heartbeats keep flowing.
|
||||
let granted = tokio::task::spawn_blocking(move || {
|
||||
prompt_consent(&technician_name, access)
|
||||
})
|
||||
.await
|
||||
.unwrap_or_else(|e| {
|
||||
// The blocking task panicked — fail closed (deny).
|
||||
tracing::error!("Consent dialog task failed: {}; denying", e);
|
||||
false
|
||||
});
|
||||
let granted = tokio::task::spawn_blocking(move || prompt_consent(&technician_name, access))
|
||||
.await
|
||||
.unwrap_or_else(|e| {
|
||||
// The blocking task panicked — fail closed (deny).
|
||||
tracing::error!("Consent dialog task failed: {}; denying", e);
|
||||
false
|
||||
});
|
||||
|
||||
tracing::info!(
|
||||
"End user {} consent for session {}",
|
||||
|
||||
Reference in New Issue
Block a user