From 8b81ed1bccb0a7814c7012c344b84b38241f48f6 Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Mon, 13 Apr 2026 15:34:55 +0200 Subject: [PATCH] fix(mcp): pass zlob through nested CI cargo runs The remaining main release-build failures came from MCP test harnesses that spawned nested cargo run/build commands under CI=true without forwarding the zlob feature required by fff-search. Make every nested MCP cargo invocation propagate zlob in CI so the release test sweep is deterministic on main. --- .../tests/mcp_autocomplete_e2e_test.rs | 9 +++++++-- .../tests/test_mcp_fixes_validation.rs | 13 +++++++++---- crates/terraphim_mcp_server/tests/test_mcp_stdio.rs | 9 +++++++-- .../terraphim_mcp_server/tests/test_tools_list.rs | 9 +++++++-- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/crates/terraphim_mcp_server/tests/mcp_autocomplete_e2e_test.rs b/crates/terraphim_mcp_server/tests/mcp_autocomplete_e2e_test.rs index 76972cc69..a6eea7d10 100644 --- a/crates/terraphim_mcp_server/tests/mcp_autocomplete_e2e_test.rs +++ b/crates/terraphim_mcp_server/tests/mcp_autocomplete_e2e_test.rs @@ -118,8 +118,13 @@ async fn create_autocomplete_test_config() -> Result { /// Start the MCP server as a subprocess and return the transport async fn start_mcp_server() -> Result { let mut cmd = Command::new("cargo"); - cmd.args(["run", "--bin", "terraphim_mcp_server"]) - .stdin(std::process::Stdio::piped()) + cmd.arg("run").arg("--bin").arg("terraphim_mcp_server"); + + if std::env::var_os("CI").is_some() { + cmd.arg("--features").arg("zlob"); + } + + cmd.stdin(std::process::Stdio::piped()) .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()); diff --git a/crates/terraphim_mcp_server/tests/test_mcp_fixes_validation.rs b/crates/terraphim_mcp_server/tests/test_mcp_fixes_validation.rs index 45509bf3e..093c7e781 100644 --- a/crates/terraphim_mcp_server/tests/test_mcp_fixes_validation.rs +++ b/crates/terraphim_mcp_server/tests/test_mcp_fixes_validation.rs @@ -10,12 +10,17 @@ async fn test_mcp_log_separation_and_tools() -> Result<()> { println!("🧪 Testing MCP server log separation and tool availability"); // Build the server first - let build_status = Command::new("cargo") + let mut build = Command::new("cargo"); + build .arg("build") .arg("--package") - .arg("terraphim_mcp_server") - .status() - .await?; + .arg("terraphim_mcp_server"); + + if std::env::var_os("CI").is_some() { + build.arg("--features").arg("zlob"); + } + + let build_status = build.status().await?; if !build_status.success() { anyhow::bail!("Failed to build terraphim_mcp_server"); diff --git a/crates/terraphim_mcp_server/tests/test_mcp_stdio.rs b/crates/terraphim_mcp_server/tests/test_mcp_stdio.rs index 8c1685902..0eb0671da 100644 --- a/crates/terraphim_mcp_server/tests/test_mcp_stdio.rs +++ b/crates/terraphim_mcp_server/tests/test_mcp_stdio.rs @@ -22,8 +22,13 @@ fn test_mcp_autocomplete_via_stdio() { // Start the MCP server // NOTE: Don't pass --verbose here. It can enable non-JSON output on stdout, // which breaks stdio JSON-RPC framing. - let mut child = Command::new("cargo") - .args(["run", "--"]) + let mut command = Command::new("cargo"); + command.arg("run"); + if std::env::var_os("CI").is_some() { + command.arg("--features").arg("zlob"); + } + let mut child = command + .args(["--"]) .current_dir(".") .stdin(Stdio::piped()) .stdout(Stdio::piped()) diff --git a/crates/terraphim_mcp_server/tests/test_tools_list.rs b/crates/terraphim_mcp_server/tests/test_tools_list.rs index 3735ebb1c..1dcf6d748 100644 --- a/crates/terraphim_mcp_server/tests/test_tools_list.rs +++ b/crates/terraphim_mcp_server/tests/test_tools_list.rs @@ -15,8 +15,13 @@ fn test_tools_list_only() { println!("Starting MCP server test for tools list..."); // Start the MCP server - let mut child = Command::new("cargo") - .args(["run", "--", "--verbose"]) + let mut command = Command::new("cargo"); + command.arg("run"); + if std::env::var_os("CI").is_some() { + command.arg("--features").arg("zlob"); + } + let mut child = command + .args(["--", "--verbose"]) .current_dir(".") .stdin(Stdio::piped()) .stdout(Stdio::piped())