Commit e49a7b6
feat(search): use Home Assistant's reference graph for entity dependency discovery (#2277)
* test: scope the supply-chain Dockerfile scan to repository content
- rglob picked up Dockerfiles inside gitignored worktree checkouts
- Renovate only sees tracked content, so the assertion should too
- unblocked committing for anyone following the worktree workflow
* feat(search): add Home Assistant reference-graph lookups
- query-shape gate, search/related frame, response parsing and merge
- distinguishes an unreadable answer from 'no references found'
- suppresses repeat frames only after a second unknown_command rejection
* refactor(search): drop the phantom bulk config tier and use the reference graph
- the keyless bulk GET matched no HA route and 404'd on every version
- per-id fetch now orders by what the graph already confirmed
- renamed scenes resolve through the registry storage key
* test(search): update suites for per-id fetching and renamed-scene resolution
- drop mocks and assertions that simulated the removed bulk endpoint
- delete two tests whose hand-built input the real path cannot produce
- rename the bulk-fetch e2e file to what it actually covers
* docs: record unit-test invocation and e2e component routing
- AGENTS.md documented only the E2E command; add the parallel unit one
- note that ha_search routes to the component on every e2e lane
* fix(search): address review findings on the reference-graph merge
- disclose unmodelled consumers as a count, never ids: enforce mode refuses
any response carrying a hidden entity_id, which failed the whole search
- treat a populated but unreadable bucket as not consulted
- bound the optional graph lookup with its own 5s timeout
- emit match_in_references on dashboard records too
- fix the documented unit-test command to run from tests/
* fix(search): let scene incompleteness reach the scope-sentence gate
- a scene-only search whose configs failed lost the scope sentence entirely
- tighten a scene assertion that could pass on unrelated wording
- drop a docstring reference to state that was consolidated away
* fix(search): correct the budget-exhausted guidance
- raising config_time_budget does complete the scan when Home Assistant's
serialized reads finish inside the higher limit
- state the latency tradeoff and the throughput ceiling instead of claiming
the limit is irrelevant, which steered users to the component needlessly
* refactor(internal): isolate the reference-graph clock behind a seam
- _graph.time is the stdlib module object, so patching monotonic through it
faked the clock for every module in the process
- mirrors the existing component_api._monotonic pattern
* test: address review findings on e2e conventions and the Dockerfile scan
- use call_tool_success inside MCPAssertions, and safe_call_tool for cleanup
so a cleanup failure cannot mask the real assertion
- enumerate Dockerfiles via git ls-files: the .claude name filter also
excluded the tracked .claude/skills tree
- refresh a fixture comment that still described the removed bulk tier
* fix(test): let the Dockerfile scan read the index inside CI's container
- the unit-test job runs in a container with the workspace bind-mounted, so
the checkout is owned by another uid and git refused with exit 128
- scope safe.directory to the one invocation; no git config is written
- carry git's stderr into the assertion so the next failure explains itself
---------
Co-authored-by: Sergey <sergey@example.com>1 parent 3bc9d1e commit e49a7b6
17 files changed
Lines changed: 2315 additions & 449 deletions
File tree
- src/ha_mcp/tools
- smart_search
- tests
- src
- e2e/tools
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
420 | 430 | | |
421 | 431 | | |
422 | 432 | | |
| |||
896 | 906 | | |
897 | 907 | | |
898 | 908 | | |
899 | | - | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
900 | 913 | | |
901 | 914 | | |
902 | 915 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | 23 | | |
| 24 | + | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
16 | 15 | | |
17 | 16 | | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
0 commit comments