From 40be587ce256469ccca9a2752aa6c6777aaa3686 Mon Sep 17 00:00:00 2001 From: goodboy Date: Mon, 17 Aug 2026 12:09:52 -0400 Subject: [PATCH] Keep `HAS_UDS` false on Windows Modern Windows Python can expose `AF_UNIX`, so `trio.has_unix` alone can register the UDS backend even though its credential and lifecycle paths remain POSIX-only. Gate `HAS_UDS` on `sys.platform` and make the Windows import smoke step assert the TCP-only capability contract. (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`)) --- .github/workflows/ci.yml | 2 +- tractor/ipc/_uds.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7871e346..0a973ff0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,7 +160,7 @@ jobs: # tractor` must succeed everywhere, and `HAS_UDS` reflects # platform capability (False on Windows, True on POSIX). - name: 'Smoke: import tractor' - run: uv run python -c "import tractor; from tractor.ipc._uds import HAS_UDS; print('import tractor OK | HAS_UDS=', HAS_UDS)" + run: uv run python -c "import sys; import tractor; from tractor.ipc._uds import HAS_UDS; assert sys.platform != 'win32' or not HAS_UDS; print('import tractor OK | HAS_UDS=', HAS_UDS)" - name: Run tests run: > diff --git a/tractor/ipc/_uds.py b/tractor/ipc/_uds.py index 3d5a3c8e..262cc2e1 100644 --- a/tractor/ipc/_uds.py +++ b/tractor/ipc/_uds.py @@ -115,10 +115,12 @@ _SUN_PATH_LIMIT: int = ( # single source of truth for "is the UDS backend usable on this -# host?" — reuse `trio`'s `has_unix` (the same predicate that gates -# `trio.open_unix_socket()`) rather than re-deriving an `AF_UNIX` -# probe in every consumer module. -HAS_UDS: bool = has_unix +# host?" Windows can expose `AF_UNIX`, but this backend remains +# POSIX-only until its credential and lifecycle paths are supported. +HAS_UDS: bool = ( + sys.platform != 'win32' + and has_unix +) def unwrap_sockpath(