fix(desktop): unblock native CI on windows and de-flake the idle heartbeat test

The locator HSM signer is a unix-socket daemon with no Windows target,
but its unconditional std::os::unix imports failed cargo check on the
windows runner — the socket server and secure-file layers are now
cfg(unix) with a stub main. The transfer-idle heartbeat test pinned its
handshake windows to the same 400ms as the deadline under test, so a
loaded runner could flake the connect phase; the idle deadline (and the
validation-capped handshake windows) now sit at 2s.
This commit is contained in:
Kayshen-X 2026-08-08 12:48:59 +08:00
parent 41860c781b
commit 8845c39804
3 changed files with 28 additions and 6 deletions

View file

@ -2,7 +2,12 @@ pub mod config;
pub mod error;
pub mod pkcs11;
pub mod protocol;
// The signer daemon speaks over a permission-checked Unix domain socket and
// enforces unix file modes on its secrets; there is no Windows deployment
// target, so the socket server and secure-file layers are unix-only.
#[cfg(unix)]
pub mod secure_file;
#[cfg(unix)]
pub mod server;
pub use config::{KeyConfig, Region, SignerConfig};

View file

@ -1,8 +1,12 @@
// The signer only deploys on unix (permission-checked unix socket); other
// hosts get a stub main so workspace-wide checks still build the target.
#![cfg_attr(not(unix), allow(dead_code))]
use std::{env, path::PathBuf, process::ExitCode};
use op_collab_relay_locator_hsm::{
secure_file, server, KeyStore, SignerConfig, SignerError, SignerResult,
};
#[cfg(unix)]
use op_collab_relay_locator_hsm::{secure_file, server, KeyStore, SignerConfig};
use op_collab_relay_locator_hsm::{SignerError, SignerResult};
use tracing_subscriber::EnvFilter;
enum Command {
@ -18,6 +22,7 @@ struct Arguments {
config: PathBuf,
}
#[cfg(unix)]
fn main() -> ExitCode {
init_tracing();
match run() {
@ -29,6 +34,14 @@ fn main() -> ExitCode {
}
}
#[cfg(not(unix))]
fn main() -> ExitCode {
init_tracing();
eprintln!("locator HSM signer requires a unix host");
ExitCode::FAILURE
}
#[cfg(unix)]
fn run() -> SignerResult<()> {
let arguments = parse_arguments()?;
let config_bytes = secure_file::read_config(&arguments.config)?;

View file

@ -79,9 +79,13 @@ mod heartbeat_idle {
TransportConfig {
timeouts: TimeoutConfig {
heartbeat: Duration::from_millis(50),
idle: Duration::from_millis(400),
read_write: Duration::from_millis(400),
admission: Duration::from_millis(400),
// The transfer-idle deadline is what this module tests; 2s
// keeps the run short while leaving the handshake windows
// (capped at idle by config validation) wide enough that a
// loaded CI runner cannot flake the connect/admission phase.
idle: Duration::from_secs(2),
read_write: Duration::from_secs(2),
admission: Duration::from_secs(2),
..TimeoutConfig::default()
},
..TransportConfig::default()