From dad418f95d7c40d195e8323a0c25596e22322f57 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 5 Apr 2026 15:33:16 -0400 Subject: [PATCH] fix(test): disable worktrees in fabro-server integration tests Server scenario tests were inheriting the default local sandbox worktree mode, which meant they created git worktrees and branches before stage execution. Under suite load that setup intermittently stalled the run long enough for the scenario polling windows to fail. Disable worktrees in the shared server test settings and let lifecycle scenarios use the same test-only settings through a settings-aware registry factory helper. --- lib/crates/fabro-server/src/server.rs | 13 ++++++++++++- lib/crates/fabro-server/tests/it/helpers.rs | 15 ++++++++++++++- .../fabro-server/tests/it/scenario/lifecycle.rs | 8 ++++---- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/crates/fabro-server/src/server.rs b/lib/crates/fabro-server/src/server.rs index 95d83ae8f..ad640136a 100644 --- a/lib/crates/fabro-server/src/server.rs +++ b/lib/crates/fabro-server/src/server.rs @@ -509,9 +509,20 @@ pub fn create_app_state() -> Arc { #[doc(hidden)] pub fn create_app_state_with_registry_factory( registry_factory_override: impl Fn(Arc) -> HandlerRegistry + Send + Sync + 'static, +) -> Arc { + create_app_state_with_settings_and_registry_factory( + Settings::default(), + registry_factory_override, + ) +} + +#[doc(hidden)] +pub fn create_app_state_with_settings_and_registry_factory( + settings: Settings, + registry_factory_override: impl Fn(Arc) -> HandlerRegistry + Send + Sync + 'static, ) -> Arc { build_app_state( - Arc::new(RwLock::new(Settings::default())), + Arc::new(RwLock::new(settings)), Some(Box::new(registry_factory_override)), 5, test_store(), diff --git a/lib/crates/fabro-server/tests/it/helpers.rs b/lib/crates/fabro-server/tests/it/helpers.rs index 282c73e98..c04393d94 100644 --- a/lib/crates/fabro-server/tests/it/helpers.rs +++ b/lib/crates/fabro-server/tests/it/helpers.rs @@ -8,6 +8,7 @@ use fabro_server::server::{ AppState, build_router, create_app_state, create_app_state_with_options, spawn_scheduler, }; use fabro_types::Settings; +use fabro_types::settings::{LocalSandboxSettings, SandboxSettings, WorktreeMode}; use tower::ServiceExt; pub(crate) const MINIMAL_DOT: &str = r#"digraph Test { @@ -24,10 +25,22 @@ pub(crate) fn test_app_state() -> Arc { create_app_state() } +pub(crate) fn test_settings() -> Settings { + Settings { + sandbox: Some(SandboxSettings { + local: Some(LocalSandboxSettings { + worktree_mode: WorktreeMode::Never, + }), + ..Default::default() + }), + ..Default::default() + } +} + pub(crate) fn dry_run_settings() -> Settings { Settings { dry_run: Some(true), - ..Default::default() + ..test_settings() } } diff --git a/lib/crates/fabro-server/tests/it/scenario/lifecycle.rs b/lib/crates/fabro-server/tests/it/scenario/lifecycle.rs index b55bcdff7..6e5fb84d7 100644 --- a/lib/crates/fabro-server/tests/it/scenario/lifecycle.rs +++ b/lib/crates/fabro-server/tests/it/scenario/lifecycle.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use axum::body::Body; use axum::http::{Request, StatusCode}; use fabro_interview::Interviewer; -use fabro_server::server::{build_router, create_app_state_with_registry_factory}; +use fabro_server::server::{build_router, create_app_state_with_settings_and_registry_factory}; use fabro_workflow::handler::HandlerRegistry; use fabro_workflow::handler::agent::AgentHandler; use fabro_workflow::handler::exit::ExitHandler; @@ -12,7 +12,7 @@ use fabro_workflow::handler::start::StartHandler; use tower::ServiceExt; use crate::helpers::{ - POLL_ATTEMPTS, POLL_INTERVAL, api, body_json, run_json, wait_for_run_status, + POLL_ATTEMPTS, POLL_INTERVAL, api, body_json, run_json, test_settings, wait_for_run_status, wait_for_run_status_not_in, }; @@ -65,7 +65,7 @@ const GATE_DOT: &str = r#"digraph GateTest { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn full_http_lifecycle_approve_and_complete() { - let state = create_app_state_with_registry_factory(gate_registry); + let state = create_app_state_with_settings_and_registry_factory(test_settings(), gate_registry); fabro_server::server::spawn_scheduler(Arc::clone(&state)); let app = build_router( Arc::clone(&state), @@ -133,7 +133,7 @@ async fn full_http_lifecycle_approve_and_complete() { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn full_http_lifecycle_cancel() { - let state = create_app_state_with_registry_factory(gate_registry); + let state = create_app_state_with_settings_and_registry_factory(test_settings(), gate_registry); fabro_server::server::spawn_scheduler(Arc::clone(&state)); let app = build_router( Arc::clone(&state),