Repository navigation
Find themes in dashboards that do not exist - #1930
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 33 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to This adds a new dashboard repair that flags themes which do not exist. The change is additive, has broad tests, and no concrete merge-blocking risk was found. Pre-merge checks |
|
There was a problem hiding this comment.
🟡 Changes recommended
Theme extraction misses nested sections and can both suppress valid findings and report ignored card properties.
2 open findings
What changed in this PR
Adds Lovelace repair detection for references to unavailable frontend themes.
Changes:
- Extracts theme references from dashboard views, sections, and supported cards.
- Raises and refreshes repair issues when dashboards or themes change.
- Adds tests, translations, and documentation.
| File | Description |
|---|---|
tests/ectoplasms/lovelace/repairs/test_unknown_theme_references.py |
Tests theme detection and repair lifecycle. |
plugins/spook/skills/spook/references/repairs.md |
Lists the new repair kind. |
documentation/integrations/lovelace.md |
Documents unknown-theme detection. |
custom_components/spook/translations/en.json |
Adds repair text. |
custom_components/spook/repair_documentation.py |
Maps the repair to documentation. |
custom_components/spook/ectoplasms/lovelace/repairs/unknown_view_references.py |
Reuses shared template markers. |
custom_components/spook/ectoplasms/lovelace/repairs/unknown_theme_references.py |
Implements repair inspection and issue creation. |
custom_components/spook/dashboard_extraction.py |
Adds dashboard theme extraction. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
66d2ef5 to
a238d4a
Compare
a238d4a to
e8f999d
Compare
e8f999d to
b9630ff
Compare
894e288 to
5164e4c
Compare

Description
A card, section or view with
theme: Midnightafter that theme was renamed or removed gets the default look, and nothing says why. The frontend only applies a theme it has (src/common/dom/apply_themes_on_element.ts:114-131, an exact, case sensitive lookup).Spook now raises one issue per dashboard listing those themes, with an edit link to the first view that has one. It checks views and sections of any type (the frontend applies their theme whatever the type), and the 24 core cards that apply a theme themselves, nested ones too (stacks, grids, conditional and entity filter cards, view header and footer cards, sidebar sections). Cards that ignore
theme(tile, heading, stacks and others) are not reported: fixing those would change nothing on screen.default,noneand every loaded theme are fine. Templates, custom cards and their contents, contents of custom views and sections, and strategies are left alone. It looks again when themes are reloaded, so adding the theme back clears the issue.Not included, on purpose:
frontend.set_themewith an unknown name (core refuses it with an error, so it is not silent), the backend default themes (core resets those itself when their theme is gone), and the per user profile theme (same ghost, but it needs reading every user's frontend store; possible as its own PR).New repair kind
lovelace_unknown_theme_referenceswith a new{themes}placeholder, so it needs a Weblate pull and pass before release.TEMPLATE_MARKERSmoved intodashboard_extraction.py, shared with the navigation repair.Motivation and Context
A renamed or removed theme leaves every card and view using it in the default look, with nothing pointing at the cause.
How has this been tested?
31 tests through the real repair with real themes loaded through the frontend integration: card, view and section themes, sidebar sections, nested cards, all 24 theming card types, ignored card types, built in and known names, near misses (case, trailing space,
Default,None), templates, custom cards, custom views and sections, strategies,frontend.reload_themesadding and removing a theme, saving the dashboard to clear the issue. 23 mutations, one per guard, all caught. Full suite: 4679 passed; pylint, ruff and prettier clean.Screenshots (if appropriate):
Types of changes
Checklist