From 1fe6be9719ac4a18ad08f8341b89f9a0f386105e Mon Sep 17 00:00:00 2001 From: sayan-oai Date: Wed, 5 Aug 2026 06:02:41 +0000 Subject: [PATCH] Align registry tests with canonical tool names (#37035) ## What changed - Expect tool collisions to report names canonicalized into the default `functions` namespace. - Remove the obsolete test that allowed an explicitly namespaced `functions.shell_command` external tool. GitOrigin-RevId: 9a517f49c027ffe5b811f6668dca91246f4925a6 --- codex-rs/core/src/tools/registry_tests.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/codex-rs/core/src/tools/registry_tests.rs b/codex-rs/core/src/tools/registry_tests.rs index 9736da4442..0555a6e3b3 100644 --- a/codex-rs/core/src/tools/registry_tests.rs +++ b/codex-rs/core/src/tools/registry_tests.rs @@ -276,7 +276,8 @@ fn registry_preserves_external_winners_and_trusted_synthetic_order() { let mut registry = ToolRegistry::from_tools([Arc::clone(&first_handler)]); assert!(!registry.register_external(handler(first_name.clone()))); - assert_eq!(registry.first_collision(), Some(&first_name)); + let canonical_first_name = first_name.clone().with_default_namespace(); + assert_eq!(registry.first_collision(), Some(&canonical_first_name)); assert!(registry.register_external(handler(second_name.clone()))); registry.prepend_trusted(handler(synthetic_name.clone())); @@ -325,16 +326,6 @@ fn reserved_shell_command_rejects_external_runtimes_without_a_builtin() { ); } -#[test] -fn registry_preserves_explicit_functions_shell_command_without_a_collision() { - let tool_name = codex_tools::ToolName::namespaced("functions", "shell_command"); - let runtime = Arc::new(TestHandler { tool_name }); - let mut registry = ToolRegistry::default(); - - assert!(registry.register_external(runtime)); - assert_eq!(registry.first_collision(), None); -} - #[test] fn registry_records_reserved_shell_command_when_a_matching_tool_exists() { let tool_name = codex_tools::ToolName::plain("shell_command"); @@ -347,7 +338,8 @@ fn registry_records_reserved_shell_command_when_a_matching_tool_exists() { let mut registry = ToolRegistry::from_tools([trusted]); assert!(!registry.register_external(external)); - assert_eq!(registry.first_collision(), Some(&tool_name)); + let canonical_tool_name = tool_name.with_default_namespace(); + assert_eq!(registry.first_collision(), Some(&canonical_tool_name)); } #[test]