From e846fed2b1755cab6c1d5a656a49db76b2778e91 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 2 Apr 2026 00:49:37 -0700 Subject: [PATCH] fix: move some test utilities out of codex-rs/core/src/tools/spec.rs (#16524) The `#[cfg(test)]` in `codex-rs/core/src/tools/spec.rs` smelled funny to me and it turns out these members were straightforward to move. --- codex-rs/core/src/tools/spec.rs | 20 -------------------- codex-rs/core/src/tools/spec_tests.rs | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/codex-rs/core/src/tools/spec.rs b/codex-rs/core/src/tools/spec.rs index 86f4840a4..341db2476 100644 --- a/codex-rs/core/src/tools/spec.rs +++ b/codex-rs/core/src/tools/spec.rs @@ -19,9 +19,6 @@ use codex_tools::build_tool_registry_plan; use std::collections::HashMap; use std::sync::Arc; -#[cfg(test)] -pub(crate) use codex_tools::mcp_call_tool_result_output_schema; - pub(crate) fn tool_user_shell_type(user_shell: &Shell) -> ToolUserShellType { match user_shell.shell_type { ShellType::Zsh => ToolUserShellType::Zsh, @@ -32,23 +29,6 @@ pub(crate) fn tool_user_shell_type(user_shell: &Shell) -> ToolUserShellType { } } -/// Builds the tool registry builder while collecting tool specs for later serialization. -#[cfg(test)] -pub(crate) fn build_specs( - config: &ToolsConfig, - mcp_tools: Option>, - app_tools: Option>, - dynamic_tools: &[DynamicToolSpec], -) -> ToolRegistryBuilder { - build_specs_with_discoverable_tools( - config, - mcp_tools, - app_tools, - /*discoverable_tools*/ None, - dynamic_tools, - ) -} - pub(crate) fn build_specs_with_discoverable_tools( config: &ToolsConfig, mcp_tools: Option>, diff --git a/codex-rs/core/src/tools/spec_tests.rs b/codex-rs/core/src/tools/spec_tests.rs index 61cb49467..4e73be350 100644 --- a/codex-rs/core/src/tools/spec_tests.rs +++ b/codex-rs/core/src/tools/spec_tests.rs @@ -29,6 +29,7 @@ use codex_tools::ToolsConfig; use codex_tools::ToolsConfigParams; use codex_tools::UnifiedExecShellMode; use codex_tools::ZshForkConfig; +use codex_tools::mcp_call_tool_result_output_schema; use codex_tools::mcp_tool_to_deferred_responses_api_tool; use codex_utils_absolute_path::AbsolutePathBuf; use pretty_assertions::assert_eq; @@ -170,6 +171,22 @@ fn model_info_from_models_json(slug: &str) -> ModelInfo { with_config_overrides(model, &config) } +/// Builds the tool registry builder while collecting tool specs for later serialization. +fn build_specs( + config: &ToolsConfig, + mcp_tools: Option>, + app_tools: Option>, + dynamic_tools: &[DynamicToolSpec], +) -> ToolRegistryBuilder { + build_specs_with_discoverable_tools( + config, + mcp_tools, + app_tools, + /*discoverable_tools*/ None, + dynamic_tools, + ) +} + #[test] fn model_provided_unified_exec_is_blocked_for_windows_sandboxed_policies() { let mut model_info = model_info_from_models_json("gpt-5-codex");