The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(tool-search): make salvage-seam tests order- and stem-robust
Tekniuma9351543789b
diff --git a/tests/tools/test_deferral_fixes.py b/tests/tools/test_deferral_fixes.pyindex 0ef48d398bc..35fa272ad86 100644--- a/tests/tools/test_deferral_fixes.py+++ b/tests/tools/test_deferral_fixes.py@@ -297,9 +297,14 @@ class TestSourceNameIndexing:_td("mcp__catalogsource__native_action", "Perform a native action."),_td("plugin_action", "Perform a plugin action."),])+ # Compare in token space: the tokenizer may stem (e.g.+ # "catalogsource" -> "catalogsourc"), and the contract is that+ # the label lands in the document exactly once either way.+ from tools.tool_search import _tokenize+ label_token = _tokenize(source_label)[0]tokens_by_name = {entry.name: entry._tokens for entry in catalog}- assert tokens_by_name[names[0]].count(source_label) == 1- assert tokens_by_name[names[1]].count(source_label) == 1+ assert tokens_by_name[names[0]].count(label_token) == 1+ assert tokens_by_name[names[1]].count(label_token) == 1finally:for name in names:registry.deregister(name)diff --git a/tests/tools/test_tool_search_multiquery.py b/tests/tools/test_tool_search_multiquery.pyindex a6ffef87879..6c5923d0aa4 100644--- a/tests/tools/test_tool_search_multiquery.py+++ b/tests/tools/test_tool_search_multiquery.py@@ -422,9 +422,22 @@ class TestBatchedDescribe:assert result["not_found"] == ["mcp__linear__does_not_exist_zzz"]assert "errors" not in result- def test_unregistered_core_name_is_not_found(self, issue_defs):+ def test_unregistered_core_name_is_not_found(self, issue_defs, monkeypatch):+ from tools import registry as registry_modulefrom tools.tool_search import ToolSearchConfig, dispatch_tool_describe+ # The intent: a name that is NOT registered lands in not_found, even+ # when it looks like a core tool. Whether "terminal" is registered in+ # this process depends on which test files imported model_tools+ # earlier, so force the unregistered condition instead of relying on+ # collection order.+ real_get_entry = registry_module.registry.get_entry+ monkeypatch.setattr(+ registry_module.registry,+ "get_entry",+ lambda name: None if name == "terminal" else real_get_entry(name),+ )+result = json.loads(dispatch_tool_describe({"names": ["terminal", "mq_linear_create_issue"]},current_tool_defs=issue_defs,