You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: enable e2e filesystem tests and fix ha_mcp_tools integration (#868)
Three root causes prevented filesystem e2e tests from running:
1. ha_mcp_tools component was never installed in the Docker test
container. Unified the existing _install_mcp_proxy_component into
a generic _install_custom_component helper and used it to install
ha_mcp_tools alongside mcp_proxy.
2. async_add_executor_job does not pass kwargs — mkdir calls with
parents=True, exist_ok=True were silently called without arguments,
causing 500 errors. Fixed with lambda wrappers (3 occurrences).
3. HA's call_service(return_response=True) wraps results in
{"changed_states": [], "service_response": {...}} but
parse_mcp_result returned this as-is. Tests couldn't find
the success/error fields. Added _unwrap_service_response to
extract the inner dict.
Also:
- Removed add_timezone_metadata from filesystem/yaml_config tools
(timezone info is irrelevant for file operations)
- Fixed tests that used call_tool_success for expected-failure cases
(should use safe_call_tool which handles ToolError)
- Removed dead data.get("data", {}).get("success") branch and
unsafe eval() fallback in assert_mcp_success / parse_mcp_result
- Added tests/AGENTS.md with e2e test infrastructure notes
Results: 22 file_operations + 18 yaml_config e2e tests now pass
(previously all skipped). 901 unit tests pass. Full e2e suite:
525 passed, 3 failed (pre-existing HACS), 11 skipped.
- Component is installed into the Docker container by `_install_custom_component` in `src/e2e/conftest.py`
6
+
- HA's `call_service(return_response=True)` wraps results in `{"changed_states": [], "service_response": {...}}` — tools unwrap this with `result.get("service_response", result)` before returning
7
+
-`hass.async_add_executor_job` only passes positional args — use `lambda:` wrappers for calls needing kwargs (e.g., `mkdir(parents=True, exist_ok=True)`)
8
+
- HA Docker image uses `annotatedyaml` (PyYAML wrapper), NOT `ruamel.yaml` — custom components needing ruamel must declare it in `manifest.json` requirements
9
+
- Feature flags (`ENABLE_YAML_CONFIG_EDITING`, `HAMCP_ENABLE_FILESYSTEM_TOOLS`) are set in `ha_container_with_fresh_config` fixture
10
+
11
+
## Test Patterns
12
+
13
+
- Tests expecting tool **success**: use `mcp.call_tool_success()` inside `MCPAssertions` context
0 commit comments