Skip to content

fix: dashboard search stays on legacy path without false partial#2020

Draft
kingpanther13 wants to merge 9 commits into
masterfrom
fix/2008-dashboard-search-routing
Draft

fix: dashboard search stays on legacy path without false partial#2020
kingpanther13 wants to merge 9 commits into
masterfrom
fix/2008-dashboard-search-routing

Conversation

@kingpanther13

@kingpanther13 kingpanther13 commented Jul 24, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Fixes #2008.

ha_search(search_types=["dashboard"]) was forwarded to the ha_mcp_tools component, whose search command has no dashboard surface — every call bounced off the component schema into a legacy fallback with a component search path failed (...) warning. And the legacy dashboard scan counted auto-generated dashboards (never taken control of — lovelace/config answers config_not_found) as failed scans, so a stock install reported partial: true with N dashboard(s) not scanned (config or list fetch failed).

Both reproduced live before the fix (component-rejection warning on every dashboard search; the false partial appears as soon as a never-edited dashboard exists).

  • ha_search now routes a search_types naming a surface the component lacks (dashboard) straight to the legacy path, silently — the same treatment as the other route-ineligible modes. Pins of supported types keep the component fast path (_component_serves_search_types).
  • ha_search's dashboard bucket now rides the ha_mcp_tools component's in-process cross-dashboard search (the same frame ha_config_get_dashboard(mode="search") already uses) for the exact-match, no-body shape — one WS frame instead of one lovelace/config read per dashboard. Fuzzy scoring, include_config bodies, truncated frames, and every component-fallback case keep the legacy walk. YAML-mode dashboards, which the component deliberately never scans (bodies can carry resolved !secret values), surface as an explicit partial reason.
  • _search_one_dashboard treats config_not_found as a clean no-match: a config-less auto-generated dashboard has nothing to scan, so it no longer counts toward dashboard(s) not scanned. Genuine failures (403 soft-fail, non-dict shape, raised fetch) still flag partial.

Type of change

  • 🐛 Bug fix

Testing

  • I have tested these changes with a LLM agent (live A/B on a real HA instance: unpatched server reproduces both symptoms, PR build returns clean partial: false, warnings: [] with a config-less dashboard present; component fast path unaffected)
  • All automated tests pass (uv run pytest)
  • Code follows style guidelines (uv run ruff check)

Checklist

  • I have updated documentation if needed

…ting auto-generated dashboards as scan failures

ha_search(search_types=["dashboard"]) was forwarded to the ha_mcp_tools
component, whose search command has no dashboard surface — the request
bounced off the component schema into a warning-laden legacy fallback on
every call. Requests naming a surface the component lacks now stay on
the legacy path silently, like the other route-ineligible modes;
supported-type pins keep the component fast path.

The legacy dashboard scan also counted auto-generated dashboards
(never taken control, lovelace/config answers config_not_found) as
failed scans, so a stock install reported partial: true with
"N dashboard(s) not scanned". A config-less dashboard has nothing to
scan and now reads as a clean no-match.

Fixes #2008

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxGQhYBQg7681uCdr9w9qB
@ghhamcp

ghhamcp commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@codex review — apply the review criteria in .gemini/styleguide.md in addition to AGENTS.md guidance

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: b2aef86c5b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

kingpanther13 and others added 2 commits July 23, 2026 23:44
…ng gate to component schema

Review round: config_not_found is HA's code for BOTH "No config found."
(auto-generated dashboard — clean skip) and "Unknown config specified"
(dashboard deleted since the registry-list snapshot — a genuine gap), so
the skip now matches the message too, via the canonical error extractors.
A lockstep contract test pins the routing gate's allowlist to the real
component schema and the public search_types vocabulary, since the silent
legacy route removed the warning that would have exposed future drift.
Also: seam test composing both fixes through ha_search, e2e assertions
against the real component, and a stale client-envelope comment corrected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxGQhYBQg7681uCdr9w9qB
@kingpanther13

Copy link
Copy Markdown
Member Author

/review

@ghhamcp

ghhamcp commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@codex review — apply the review criteria in .gemini/styleguide.md in addition to AGENTS.md guidance

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: dbcb02aecd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

kingpanther13 and others added 2 commits July 24, 2026 09:16
…ss search

The ha_mcp_tools component already answers a cross-dashboard search in
one in-process frame, and ha_config_get_dashboard(mode="search") routes
through it — ha_search's dashboard surface never did, fanning out one
lovelace/config read per dashboard even with the component installed.
The bucket now rides the component search for the exact-match, no-body
shape (the default ha_search call), with the legacy walk kept for fuzzy
scoring, include_config bodies, truncated frames, and every component-
fallback case. YAML-mode dashboards, which the component deliberately
never scans (their bodies can carry resolved !secret values), surface as
an explicit partial reason instead of looking exhaustive.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxGQhYBQg7681uCdr9w9qB
Live parity check: the component match only knows the config body's
(often absent) title, so records fell back to the url_path where the
legacy walk emits the registry row's title. The rows are already
fetched for the YAML exclusion count — join them for the title.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxGQhYBQg7681uCdr9w9qB
@kingpanther13

Copy link
Copy Markdown
Member Author

/review

@ghhamcp

ghhamcp commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@codex review — apply the review criteria in .gemini/styleguide.md in addition to AGENTS.md guidance

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac03dca116

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ha_mcp/tools/smart_search/_deep.py Outdated
Comment thread src/ha_mcp/tools/smart_search/_deep.py Outdated
Comment thread src/ha_mcp/tools/smart_search/_deep.py Outdated
Codex review round on the component wiring: the card-scoped matches walk
narrowed ha_search's dashboard coverage (a view-title-only hit vanished),
the yaml exclusion count missed a YAML-mode default dashboard (no list
row), and fail-soft load errors made unreadable dashboards look clean.
The component's search mode now also emits document_matches (a per-
dashboard whole-config substring verdict, ported leaf-for-leaf from the
server's _search_in_dict), yaml_skipped counted in-process over the full
map, and load_failed with ConfigNotFound kept a clean skip. The server
requires the new dashboards_doc_search capability (component 1.3.0) and
those keys, or falls back to the full legacy walk — a pre-1.3.0
component never narrows coverage. Registry titles ride a separate doc
key so MODE 4 match-record parity keeps the body title.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxGQhYBQg7681uCdr9w9qB
@kingpanther13

Copy link
Copy Markdown
Member Author

/review

@ghhamcp

ghhamcp commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@codex review — apply the review criteria in .gemini/styleguide.md in addition to AGENTS.md guidance

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: b772bf141b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

CI round: the info drift guard and manifest parity test pin the literal
capability list and version — updated for dashboards_doc_search / 1.3.0.
The guarded ConfigNotFound import resolves to Any under mypy's
homeassistant override, so the assignment ignore was unused.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxGQhYBQg7681uCdr9w9qB
@kingpanther13

Copy link
Copy Markdown
Member Author

/review

@ghhamcp

ghhamcp commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@codex review — apply the review criteria in .gemini/styleguide.md in addition to AGENTS.md guidance

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 8133393713

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The dashboard search coverage was supposed to be there all along, so
this is a patch on the pending version line, not a new-feature minor.
Capability negotiation (dashboards_doc_search), never the version,
gates the server routing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxGQhYBQg7681uCdr9w9qB
@kingpanther13

Copy link
Copy Markdown
Member Author

/review

@ghhamcp

ghhamcp commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@codex review — apply the review criteria in .gemini/styleguide.md in addition to AGENTS.md guidance

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f76caf0d13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread custom_components/ha_mcp_tools/websocket_api.py
… path

Codex round: the legacy walk always emits ("default", "Default
Dashboard") for the built-in dashboard; a taken-control default can
carry its own title, which the component-served record must not leak
into the envelope — record-shape parity between the two paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxGQhYBQg7681uCdr9w9qB
@kingpanther13

Copy link
Copy Markdown
Member Author

/review

@ghhamcp

ghhamcp commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@codex review — apply the review criteria in .gemini/styleguide.md in addition to AGENTS.md guidance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] ha_search search_types=["dashboard"]: component path rejects 'dashboard', legacy fallback is incomplete (partial: true)

2 participants