this is finally goodbye. use the new one.

This commit is contained in:
lda
2026-05-17 00:41:20 +07:00 Verified
parent 16591f3560
commit a55879ea2b
10 changed files with 61 additions and 214 deletions
-12
View File
@@ -75,7 +75,6 @@ def test_create_broker_server_exposes_tools_resources_and_prompts() -> None:
assert "refresh_connection_catalog" in tool_names
assert "get_planner_catalog" in tool_names
assert "list_sources" in tool_names
assert "list_spec_sources" in tool_names
assert "invoke_broker_method" in tool_names
assert "call_broker_tool" in tool_names
assert "catalog.all" in resource_names
@@ -93,16 +92,6 @@ def test_create_broker_server_exposes_tools_resources_and_prompts() -> None:
assert "wf.mcp.call_tool" in planner_names
assert "wf.std.runtime_error" in planner_names
_content, source_payload_raw = asyncio.run(
server.call_tool("list_spec_sources", {})
)
source_payload = cast(dict[str, Any], cast(object, source_payload_raw))
sources = source_payload["result"]
source_ids = [source["id"] for source in sources]
assert "demo.personal" in source_ids
assert "wf.mcp" in source_ids
assert "wf.std" in source_ids
_content, all_sources_payload_raw = asyncio.run(
server.call_tool("list_sources", {})
)
@@ -120,7 +109,6 @@ def test_broker_admin_tools_are_backed_by_wf_admin_source() -> None:
tools = asyncio.run(server.list_tools())
tool_names = {tool.name for tool in tools}
assert "list_spec_sources" in tool_names
assert "get_planner_catalog" in tool_names
assert (
"wf.admin.list_sources"
-1
View File
@@ -44,7 +44,6 @@ def test_server_exposes_upstream_admin_and_workflow_tools() -> None:
assert "wf.admin.refresh_connection_catalog" in names
assert "wf.admin.get_catalog" in names
assert "wf.admin.get_planner_catalog" in names
assert "wf.admin.list_spec_sources" in names
assert "wf.admin.list_sources" in names
assert "wf.admin.read_resource" in names
assert "wf.admin.render_prompt" in names
+16 -45
View File
@@ -88,14 +88,12 @@ def test_service_rejects_reserved_connection_ids() -> None:
def test_service_installs_builtin_stdlib_specs_by_default() -> None:
service = WfMcpService(store=FileStore(local_temp_root() / "builtin_store"))
assert "wf.std" in service.spec_sources
assert "wf.std.runtime_error" in service.spec_sources["wf.std"].specs
assert "wf.mcp" in service.spec_sources
assert "wf.mcp.call_tool" in service.spec_sources["wf.mcp"].specs
sources = service.list_spec_sources()
assert {source["id"] for source in sources} == {"wf.mcp", "wf.std"}
assert all(source["kind"] == "system" for source in sources)
assert "wf.std.runtime_error" in service.capability_sources[
"wf.std"
].capabilities.node_specs
assert "wf.mcp.call_tool" in service.capability_sources[
"wf.mcp"
].capabilities.node_specs
def test_service_lists_all_capability_sources_with_owned_capability_names() -> None:
@@ -176,47 +174,17 @@ def test_wf_admin_source_exists_but_is_not_planner_visible() -> None:
assert "wf.admin" not in service.get_planner_catalog().snapshots
def test_service_spec_views_are_derived_from_capability_sources() -> None:
service = WfMcpService(store=FileStore(local_temp_root() / "source_view_store"))
assert "wf.std" in service.capability_sources
assert "wf.std" in service.spec_sources
assert "wf.std" in service.specs_by_connection
assert (
service.spec_sources["wf.std"].specs
is not service.capability_sources["wf.std"].capabilities.node_specs
)
assert (
service.specs_by_connection["wf.std"]
is not service.capability_sources["wf.std"].capabilities.node_specs
)
assert (
service.specs_by_connection["wf.std"]["wf.std.runtime_error"]
is service.capability_sources["wf.std"].capabilities.node_specs[
"wf.std.runtime_error"
]
)
service.spec_sources["wf.std"].specs.clear()
service.specs_by_connection["wf.std"].clear()
assert (
"wf.std.runtime_error"
in service.capability_sources["wf.std"].capabilities.node_specs
)
def test_service_can_disable_builtin_stdlib_specs() -> None:
service = WfMcpService(
store=FileStore(local_temp_root() / "no_builtin_store"),
include_builtin_specs=False,
)
assert "wf.std" not in service.spec_sources
assert "wf.mcp" not in service.spec_sources
assert service.list_spec_sources() == []
assert "wf.std" not in service.capability_sources
assert "wf.mcp" not in service.capability_sources
def test_service_list_spec_sources_excludes_hidden_sources() -> None:
def test_service_planner_catalog_excludes_hidden_sources() -> None:
service = WfMcpService(store=FileStore(local_temp_root() / "hidden_list_store"))
hidden_echo_tool = NodeSpec(
name="hidden.source.echo_tool",
@@ -241,9 +209,10 @@ def test_service_list_spec_sources_excludes_hidden_sources() -> None:
)
)
source_ids = {source["id"] for source in service.list_spec_sources()}
assert "hidden.source" not in source_ids
planner_names = {
entry.qualified_name for entry in service.get_planner_catalog().entries()
}
assert "hidden.source.echo_tool" not in planner_names
def test_service_catalog_split_keeps_system_specs_out_of_backend_catalog() -> None:
@@ -693,7 +662,9 @@ def test_service_wrapped_tool_adapter_model_validates_simple_schema_types() -> N
service.register_adapter("demo", FakeAdapter())
asyncio.run(service.refresh_connection_catalog("demo.personal"))
spec = service.spec_sources["demo.personal"].specs["demo.personal.echo_tool"]
spec = service.capability_sources["demo.personal"].capabilities.node_specs[
"demo.personal.echo_tool"
]
parsed = spec.input_model.model_validate({"text": "hello"})
assert parsed.model_dump() == {"text": "hello"}