Skip to content

sort the entity list in the unknown entity repair message for dashboards#1163

Open
besteru wants to merge 1 commit intofrenck:mainfrom
besteru:sort_unknown_entity_list_in_repari
Open

sort the entity list in the unknown entity repair message for dashboards#1163
besteru wants to merge 1 commit intofrenck:mainfrom
besteru:sort_unknown_entity_list_in_repari

Conversation

@besteru
Copy link

@besteru besteru commented Jan 10, 2026

Description

Sorted the list of unknown entities printed in the repair message for Lovelace dashboards.
Related to #1161

Motivation and Context

Cosmetic change - it is easier to parse the list of unknown entities if they are sorted. It is easier to visually inspect the list and decide which need to be updated/corrected.

How has this been tested?

Ran on Home Assistant Container, Core 2026.1.0, Frontend 20260107.0.
Change is minimal and affects only message printed in the repair text.

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 10, 2026

📝 Walkthrough

Walkthrough

Modified the construction of translation placeholders for unknown entities to use sorted iteration when building the entities list for issue creation. This ensures deterministic ordering in translation strings while log output remains unaffected. Lines changed: +1/-1.

Changes

Cohort / File(s) Summary
Translation Placeholder Determinism
custom_components/spook/ectoplasms/lovelace/repairs/unknown_entity_references.py
Changed entities list construction to use sorted iteration over unknown_entities when building translation placeholders, ensuring deterministic order in translation strings while preserving original log output behavior.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 The entities now dance in a sorted line,
No more chaos in translations divine,
One little sort, so tiny yet fine,
Makes every placeholder perfectly aligned! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: sorting the entity list in the unknown entity repair message for dashboards, which matches the actual code modification.
Description check ✅ Passed The description is directly related to the changeset, explaining the sorting of unknown entities, the motivation (easier to parse), and testing performed on a relevant Home Assistant version.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

@sonarqubecloud
Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
custom_components/spook/ectoplasms/lovelace/repairs/unknown_entity_references.py (1)

89-89: Consider sorting the log output for consistency.

The log output still uses unsorted iteration over unknown_entities. For consistency with the repair message and to make log output deterministic (helpful when comparing logs across runs), consider sorting here as well.

♻️ Proposed fix
-                    ", ".join(unknown_entities),
+                    ", ".join(sorted(unknown_entities)),
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd4ecf9 and 1804d53.

📒 Files selected for processing (1)
  • custom_components/spook/ectoplasms/lovelace/repairs/unknown_entity_references.py
🔇 Additional comments (1)
custom_components/spook/ectoplasms/lovelace/repairs/unknown_entity_references.py (1)

77-77: LGTM! Sorting improves readability.

The addition of sorted() ensures deterministic, alphabetically ordered output in the repair message, making it easier for users to visually parse and identify unknown entities. Since sets have non-deterministic iteration order, this change is a clear improvement.

@besteru
Copy link
Author

besteru commented Jan 10, 2026

Could someone with write access add the "enhancement" label to this PR?

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.

1 participant