From e5b7bb19095bfe01ae9cdd199d016dfdf7b7520a Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Mon, 13 Apr 2026 22:14:51 -0400 Subject: [PATCH] fix(tests): disable macOS proxy discovery via FABRO_HTTP_PROXY_POLICY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fabro-http crate's proxy policy mechanism was not being used in tests. http_api.rs used #[cfg(test)] to call .no_proxy(), but cfg(test) only applies within the crate being tested — downstream crates like fabro-workflow and fabro-cli hit the production path with system proxy discovery, adding ~900ms per reqwest client per process. - Set FABRO_HTTP_PROXY_POLICY=disabled in .cargo/config.toml so all test HTTP clients skip proxy discovery automatically - Remove dead #[cfg(test)] branch in http_api.rs; it now relies on the env var like every other fabro-http consumer - Remove kind(test) from nextest overrides so timeout budgets apply to unit tests too, not just integration tests - Remove unused SessionCookie import in web_auth.rs Eliminates all 11 flaky nextest timeouts under parallel load. Co-Authored-By: Claude Opus 4.6 (1M context) --- .cargo/config.toml | 6 ++++++ .config/nextest.toml | 6 +++--- .../fabro-llm/src/providers/http_api.rs | 19 ++++--------------- lib/crates/fabro-server/src/web_auth.rs | 2 +- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 45f1c724a..63679ef4c 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,8 @@ [alias] t = "test -- --format terse" + +[env] +# Disable macOS proxy discovery in tests — without this, every reqwest client +# pays ~900ms of system-proxy lookup overhead per process, which pushes tests +# past the 3s nextest kill threshold under parallel load. +FABRO_HTTP_PROXY_POLICY = "disabled" diff --git a/.config/nextest.toml b/.config/nextest.toml index 334055709..68b01fb3e 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -4,11 +4,11 @@ slow-timeout = { period = "1s", terminate-after = 3 } leak-timeout = "500ms" [[profile.default.overrides]] - filter = "package(fabro-cli) & kind(test)" + filter = "package(fabro-cli)" slow-timeout = { period = "3s", terminate-after = 4 } [[profile.default.overrides]] - filter = "package(fabro-server) & kind(test)" + filter = "package(fabro-server)" slow-timeout = { period = "5s", terminate-after = 4 } [[profile.default.overrides]] @@ -16,7 +16,7 @@ leak-timeout = "500ms" slow-timeout = { period = "15s", terminate-after = 4 } [[profile.default.overrides]] - filter = "package(fabro-workflow) & kind(test)" + filter = "package(fabro-workflow)" slow-timeout = { period = "2s", terminate-after = 3 } [[profile.default.overrides]] diff --git a/lib/crates/fabro-llm/src/providers/http_api.rs b/lib/crates/fabro-llm/src/providers/http_api.rs index 809f605c5..09e29e44e 100644 --- a/lib/crates/fabro-llm/src/providers/http_api.rs +++ b/lib/crates/fabro-llm/src/providers/http_api.rs @@ -19,21 +19,10 @@ pub struct HttpApi { impl HttpApi { fn build_client(timeout: AdapterTimeout) -> fabro_http::HttpClient { - #[cfg(test)] - { - fabro_http::HttpClientBuilder::new() - .connect_timeout(Duration::from_secs_f64(timeout.connect)) - .no_proxy() - .build() - .expect("LLM HTTP client should build") - } - #[cfg(not(test))] - { - fabro_http::HttpClientBuilder::new() - .connect_timeout(Duration::from_secs_f64(timeout.connect)) - .build() - .expect("LLM HTTP client should build") - } + fabro_http::HttpClientBuilder::new() + .connect_timeout(Duration::from_secs_f64(timeout.connect)) + .build() + .expect("LLM HTTP client should build") } #[must_use] diff --git a/lib/crates/fabro-server/src/web_auth.rs b/lib/crates/fabro-server/src/web_auth.rs index 65ef92bd7..bbbe22bd2 100644 --- a/lib/crates/fabro-server/src/web_auth.rs +++ b/lib/crates/fabro-server/src/web_auth.rs @@ -673,7 +673,7 @@ mod tests { use serde_json::{Value, json}; use tower::ServiceExt; - use super::{SessionCookie, api_routes, read_private_session, routes}; + use super::{api_routes, read_private_session, routes}; use crate::jwt_auth::{AuthMode, ConfiguredAuth}; use crate::server;