From cf1f5e3ecfa5670b59bf498423b26f7679662d94 Mon Sep 17 00:00:00 2001 From: yuandonghao Date: Wed, 24 Jun 2026 18:17:20 +0800 Subject: [PATCH] fix(tools): re-export dropped helpers through the split shim Address review finding from #4423: the compatibility facade claimed to preserve every original top-level symbol but omitted three helpers the old src.tool_implementations exposed. Re-export them and pin them in the shim protection test: - _string_arg, _validate_cookbook_ssh_target <- src/tools/cookbook.py - _mcp_allowed_commands <- src/agent_tools/admin_tools.py (lazily via __getattr__, to keep the agent_tools.__init__ <-> facade import acyclic after the #3629 admin-tools migration) All three added to tests/test_tool_implementations_shim.py _EXPECTED so the test contract now matches its "every original top-level function" comment. Co-Authored-By: Claude Opus 4.8 --- src/tool_implementations.py | 3 ++- tests/test_tool_implementations_shim.py | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tool_implementations.py b/src/tool_implementations.py index e1c7c24b2..09fabf0cf 100644 --- a/src/tool_implementations.py +++ b/src/tool_implementations.py @@ -27,7 +27,7 @@ from src.tools.system import ( # noqa: F401 _ADMIN_TOOL_SYMBOLS = ( "do_manage_endpoints", "do_manage_mcp", "do_manage_webhooks", "do_manage_tokens", "do_manage_settings", - "_MCP_DENIED_COMMANDS", "_validate_mcp_command", + "_MCP_DENIED_COMMANDS", "_validate_mcp_command", "_mcp_allowed_commands", ) @@ -51,6 +51,7 @@ from src.tools.cookbook import ( # noqa: F401 _cookbook_register_task, _cookbook_apply_retry_suggestion, _scan_running_model_processes, _cookbook_kill_session, _MODEL_PROCESS_PATTERNS, + _string_arg, _validate_cookbook_ssh_target, ) # Search domain extracted to src/tools/search.py (slice 1, #4082/#4071). # Re-imported here so this module stays a working facade. diff --git a/tests/test_tool_implementations_shim.py b/tests/test_tool_implementations_shim.py index 5836d14a5..f72328374 100644 --- a/tests/test_tool_implementations_shim.py +++ b/tests/test_tool_implementations_shim.py @@ -25,13 +25,14 @@ _EXPECTED = [ "do_serve_model", "do_serve_preset", "do_stop_served_model", "do_tail_serve_output", "do_trigger_research", "do_vault_get", "do_vault_search", "do_vault_unlock", - # 15 module-private helpers (importable by name too) + # module-private helpers (importable by name too) "_cookbook_apply_retry_suggestion", "_cookbook_env_for_host", "_cookbook_kill_session", "_cookbook_register_task", "_cookbook_servers", "_ensure_served_endpoint", "_infer_serve_host", "_infer_serve_port", - "_internal_headers", "_load_vault_config", "_parse_tool_args", - "_resolve_cookbook_host", "_run_bw", "_scan_running_model_processes", - "_skill_dump", + "_internal_headers", "_load_vault_config", "_mcp_allowed_commands", + "_parse_tool_args", "_resolve_cookbook_host", "_run_bw", + "_scan_running_model_processes", "_skill_dump", "_string_arg", + "_validate_cookbook_ssh_target", ]