From c9539433b81886f2fccd30e78c087ffd07c20e05 Mon Sep 17 00:00:00 2001 From: ruv Date: Sun, 31 May 2026 03:55:32 -0400 Subject: [PATCH] fix(worldmodel): compile on non-unix targets (Windows workspace build) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bridge.rs imported tokio::net::UnixStream unconditionally, so the whole workspace failed to build on Windows (E0432) — blocking cargo test --workspace and the pre-merge gate there. The OccWorld Unix-socket bridge is a Linux-appliance feature (Python inference server on the GPU host), so gate it #[cfg(unix)] and add a #[cfg(not(unix))] send_recv that fails fast with a clear 'unsupported on this target' Protocol error. Workspace now builds on Windows; worldmodel 12 tests pass. Co-Authored-By: claude-flow --- .../wifi-densepose-worldmodel/src/bridge.rs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/v2/crates/wifi-densepose-worldmodel/src/bridge.rs b/v2/crates/wifi-densepose-worldmodel/src/bridge.rs index dc8075b7..d9e84e40 100644 --- a/v2/crates/wifi-densepose-worldmodel/src/bridge.rs +++ b/v2/crates/wifi-densepose-worldmodel/src/bridge.rs @@ -13,7 +13,9 @@ use std::path::PathBuf; use std::time::Duration; +#[cfg(unix)] use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader}; +#[cfg(unix)] use tokio::net::UnixStream; use tokio::time::timeout; @@ -27,7 +29,8 @@ const TIMEOUT_S: u64 = 30; /// /// 200×200×16 future frames × 15 steps × ~1 byte/voxel = ~9.6 MB in the /// worst case; set a generous 64 MB ceiling to stay safe without allocating -/// it up front. +/// it up front. (Only used by the unix socket reader.) +#[cfg(unix)] const MAX_RESPONSE_BYTES: usize = 64 * 1024 * 1024; /// Thin async client for the OccWorld Unix-socket inference server. @@ -65,8 +68,23 @@ impl OccWorldBridge { .map_err(|_| WorldModelError::Timeout { timeout_s: TIMEOUT_S })? } + /// Non-unix platforms have no Unix-domain sockets. The OccWorld bridge is a + /// Linux-appliance feature (the Python inference server runs on the GPU host), + /// so on Windows/other targets the crate still compiles but `predict` fails + /// fast with a clear error instead of silently degrading. + #[cfg(not(unix))] + async fn send_recv( + &self, + _request: OccupancyWorldModelRequest, + ) -> Result { + Err(WorldModelError::Protocol( + "OccWorld Unix-socket bridge is only supported on unix targets".into(), + )) + } + /// Internal: connect, write request, read response — no timeout here; /// the outer [`timeout`] in [`predict`] handles that. + #[cfg(unix)] async fn send_recv( &self, request: OccupancyWorldModelRequest, @@ -129,6 +147,7 @@ impl OccWorldBridge { } /// Establishes a [`UnixStream`] connection to `self.socket_path`. + #[cfg(unix)] async fn connect(&self) -> Result { UnixStream::connect(&self.socket_path) .await @@ -161,6 +180,8 @@ mod tests { } /// Verify that a missing socket returns `SocketConnect` and not a panic. + /// Unix-only: non-unix targets return a `Protocol` "unsupported" error instead. + #[cfg(unix)] #[tokio::test] async fn connect_to_missing_socket_returns_error() { let bridge = OccWorldBridge::new("/tmp/__occworld_nonexistent_test__.sock");