refactor(api): make tool_handlers require a DeviceManager

Eliminates the silent fallback to DEFAULT_MANAGER that produced the
DeviceNotFoundError incident. All existing callers already pass
manager explicitly.
This commit is contained in:
2026-07-21 13:52:01 +08:00
parent d1b0fffabb
commit 29b9a8c39a
2 changed files with 26 additions and 15 deletions
+9
View File
@@ -64,3 +64,12 @@ def test_mcp_ui_tree_can_include_active_app_info() -> None:
"activity": ".MainActivity",
}
assert isinstance(response["nodes"], list)
def test_tool_handlers_requires_manager() -> None:
"""D12: tool_handlers must not silently fall back to DEFAULT_MANAGER."""
from api.mcp import tool_handlers
import pytest
with pytest.raises(TypeError):
tool_handlers() # type: ignore[call-arg]