Skip to content

Enrich unknown entity issues across all repairs - #1369

Merged
frenck merged 1 commit into
mainfrom
frenck/enrich-more-repairs
Jul 3, 2026
Merged

frenck merged 1 commit into
mainfrom
frenck/enrich-more-repairs

Conversation

@frenck

@frenck frenck commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Description

Follow-up to #1368. The remaining repairs that build their own entity placeholder now use the shared async_describe_unknown_entities helper instead of an inline bullet join: Lovelace, scene, template helpers, group members, and both proximity repairs (tracked entities and ignored zones).

Every unknown-entity issue across Spook now carries the same context: (deleted on <date>, was provided by `<integration>`) or (did you mean `<entity>`?), not just automations and scripts. Mechanical one-line swap per repair plus the import; no behavior change beyond the enriched text.

Motivation and Context

Consistency: the enrichment that landed for automation and script entity issues is just as useful on dashboards, scenes, groups, template helpers, and proximity, so all of them get it.

How has this been tested?

The enrichment engine is covered by its own tests (#1368). Each repair's existing tests continue to pass: with no deleted entry or close match, the helper produces the same plain bullets as before, so the placeholder assertions are unchanged. Full suite passes (593 tests), ruff, pylint (10.00/10), and all prek hooks pass.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Copilot AI review requested due to automatic review settings July 3, 2026 20:14
@frenck frenck added the enhancement Enhancement of the code, not introducing new features. label Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 42575780-37e4-4f8d-bcbb-07759c65d2a1

📥 Commits

Reviewing files that changed from the base of the PR and between 62170dd and ee76b24.

📒 Files selected for processing (6)
  • custom_components/spook/ectoplasms/group/repairs/unknown_members.py
  • custom_components/spook/ectoplasms/lovelace/repairs/unknown_entity_references.py
  • custom_components/spook/ectoplasms/proximity/repairs/unknown_ignored_zones.py
  • custom_components/spook/ectoplasms/proximity/repairs/unknown_tracked_entities.py
  • custom_components/spook/ectoplasms/scene/repairs/unknown_entity_references.py
  • custom_components/spook/ectoplasms/template/repairs/unknown_entity_references.py

📝 Walkthrough

Walkthrough

Six repair modules across group, lovelace, proximity (two files), scene, and template ectoplasms are updated to import and use async_describe_unknown_entities for generating translation_placeholders["entities"]/"zones" values, replacing manually constructed bullet-list strings with the shared helper applied to sorted unknown entity IDs.

Changes

Unknown Entity Placeholder Unification

Layer / File(s) Summary
Group unknown members repair
custom_components/spook/ectoplasms/group/repairs/unknown_members.py
Imports async_describe_unknown_entities and uses it to build the entities placeholder instead of a manual bullet list.
Lovelace unknown entity references repair
custom_components/spook/ectoplasms/lovelace/repairs/unknown_entity_references.py
Imports and applies async_describe_unknown_entities for the entities placeholder in issue creation.
Proximity unknown ignored zones repair
custom_components/spook/ectoplasms/proximity/repairs/unknown_ignored_zones.py
Imports and applies async_describe_unknown_entities for the zones placeholder.
Proximity unknown tracked entities repair
custom_components/spook/ectoplasms/proximity/repairs/unknown_tracked_entities.py
Imports and applies async_describe_unknown_entities for the entities placeholder.
Scene unknown entity references repair
custom_components/spook/ectoplasms/scene/repairs/unknown_entity_references.py
Imports and applies async_describe_unknown_entities for the entities placeholder.
Template unknown entity references repair
custom_components/spook/ectoplasms/template/repairs/unknown_entity_references.py
Imports and applies async_describe_unknown_entities for the entities placeholder.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • frenck/spook#1172: Both PRs modify the lovelace unknown entity references repair's async_inspect logic.
  • frenck/spook#1347: Adds tests asserting issue placeholders for dangling entities that must align with the new placeholder formatting introduced here.

Suggested labels: refactor

Poem

Six little repairs, once bullet-list bound,
Now speak with one voice, a helper renowned. 🐇
Sorted and tidy, no more messy strings,
Just async_describe_unknown_entities sings!
Hop, hop, hooray for consistent things~ ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: enriching unknown entity issues across repairs.
Description check ✅ Passed The description is directly related to the changeset and accurately explains the shared helper swap across repairs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch frenck/enrich-more-repairs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.88%. Comparing base (62170dd) to head (ee76b24).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1369      +/-   ##
==========================================
+ Coverage   81.85%   81.88%   +0.02%     
==========================================
  Files         135      135              
  Lines        3736     3742       +6     
  Branches      471      471              
==========================================
+ Hits         3058     3064       +6     
  Misses        587      587              
  Partials       91       91              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@frenck
frenck merged commit 4458869 into main Jul 3, 2026
21 checks passed
@frenck
frenck deleted the frenck/enrich-more-repairs branch July 3, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR is a follow-up to #1368. It replaces the inline "\n".join(f"- \{entity_id}`" ...)placeholder construction in the remaining unknown-entity repairs with the sharedasync_describe_unknown_entities` helper, so that dashboards, scenes, groups, template helpers, and both proximity repairs now carry the same enriched context (deleted-on/provided-by, or "did you mean") as the automation and script repairs. The change is purely cosmetic to the issue text; no detection behavior changes.

Changes:

  • Import and call async_describe_unknown_entities(self.hass, sorted(unknown_entities)) in six repairs (template, scene, lovelace, group, proximity tracked entities, proximity ignored zones).
  • The scene, group, and both proximity repairs now sort their entity list, making the placeholder output deterministic (previously set-iteration order).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ectoplasms/template/repairs/unknown_entity_references.py Uses shared helper for entities placeholder
ectoplasms/scene/repairs/unknown_entity_references.py Uses shared helper; now sorts entities
ectoplasms/proximity/repairs/unknown_tracked_entities.py Uses shared helper; now sorts entities
ectoplasms/proximity/repairs/unknown_ignored_zones.py Uses shared helper for zones placeholder; now sorts
ectoplasms/lovelace/repairs/unknown_entity_references.py Uses shared helper for entities placeholder
ectoplasms/group/repairs/unknown_members.py Uses shared helper; now sorts entities

I verified the helper's signature and behavior, confirmed all six call sites pass the correct arguments, checked that proximity ignored zones are entity IDs (zone.*) so the enrichment is semantically valid, and confirmed no inline-bullet joins remain in the repairs. The changes are mechanical, consistent, and complete.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

enhancement Enhancement of the code, not introducing new features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants