fix(ctl): cfg-gate Unix-socket IPC for Windows build#1204
Conversation
The openab set/get control socket uses tokio::net::UnixListener/UnixStream unconditionally, which fails to compile on Windows (E0432) and breaks the Build Binaries release workflow for the windows-msvc targets. Gate the Unix-socket imports and the socket I/O fns (spawn_server_at, handle_conn, send_request_to) with #[cfg(unix)], and provide #[cfg(not(unix))] stubs so main.rs's run/set/get paths compile unchanged: - spawn_server_at: no-op task (logs a warning) - send_request_to: returns an error (IPC is Unix-only) The cross-platform protocol types, registry, and RuntimeHandler are unchanged. Gate the unix-socket roundtrip test; the serialization test stays portable.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
LGTM ✅ — Clean cross-platform cfg-gating with consistent API contract. What This PR DoesThe How It Works
Findings
Finding Details🟢 F1: API Contract ConsistencyCallers ( 🟢 F2: Graceful DegradationThe 🟢 F3: Zero Regression RiskAll existing Unix logic is untouched — the cfg gates only add visibility annotations and alternative implementations for non-Unix. 🟢 F4: Test Gating
🟢 F5: Idiomatic PatternsUses Baseline Check
|
Summary
Fixes the long-standing Build Binaries failure on the windows-msvc targets (present since at least v0.9.0-beta.2).
src/ctl.rsimported and usedtokio::net::UnixListener/UnixStreamunconditionally, so theopenabbinary failed to compile on Windows:Fix
Per the cross-platform rule in AGENTS.md, gate the Unix-only code with
#[cfg(unix)]and provide#[cfg(not(unix))]stubs somain.rs's run/set/get paths compile unchanged:UnixListener/UnixStream, tokio io traits) →#[cfg(unix)]spawn_server_at→ unix impl + non-unix no-op task (logs a warning)send_request_to→ unix impl + non-unix error (openab set/getis Unix-only)handle_conn→#[cfg(unix)]#[cfg(unix)]; the serialization test stays portableThe control socket (
openab set/get) was already Unix-only in practice; this just makes the Windows build skip it cleanly instead of failing to compile.Verification
cargo checkon host (unix): cleanpushevents)The Linux CI (
ci.yml, runsclippy -- -D warnings) stays clean because the gates are no-ops on unix.