Repository navigation
Add unknown entity extractor tests - #1275
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds comprehensive golden-path pytest suites for unknown-entity extraction in two Spook ectoplasms: automation (value/trigger/condition/action/automation aggregation) and Lovelace (dashboard, card, badge, element traversal), plus package docstrings and test helpers/fixtures. ChangesAutomation unknown-entity extraction tests
Lovelace unknown-entity extraction tests
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1275 +/- ##
==========================================
+ Coverage 36.84% 46.35% +9.50%
==========================================
Files 117 117
Lines 3029 3029
Branches 411 411
==========================================
+ Hits 1116 1404 +288
+ Misses 1898 1587 -311
- Partials 15 38 +23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/ectoplasms/automation/repairs/test_unknown_entity_references.py`:
- Around line 185-193: The test test_action_if_then_else_nested uses a subset
assertion (<=) which permits extra unexpected entities; update the assertion to
require exact equality by replacing the subset check with an equality check so
the result must equal {"binary_sensor.door", "light.hall"} when calling
extract_entities_from_action_config(hass, config).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 29ad5ddd-b38a-42b0-8bf1-1bb22ab1935f
📒 Files selected for processing (6)
tests/ectoplasms/automation/__init__.pytests/ectoplasms/automation/repairs/__init__.pytests/ectoplasms/automation/repairs/test_unknown_entity_references.pytests/ectoplasms/lovelace/__init__.pytests/ectoplasms/lovelace/repairs/__init__.pytests/ectoplasms/lovelace/repairs/test_unknown_entity_references.py
|
There was a problem hiding this comment.
Pull request overview
Adds pytest coverage for the unknown-entity-reference extractors in the automation and Lovelace ectoplasms. The tests pin down the current observable behavior of the helpers/private walkers so an upcoming refactor (consolidating duplicated repair logic into a single recursive walker) can be validated against a baseline. This is a tests-only change with no production code modified.
Changes:
- New automation test module covering
extract_entities_from_value, the trigger/condition/action extractors, and the top-levelextract_entities_from_automation_configorchestrator (including a parametrized "missing section" case). - New Lovelace test module that exercises the name-mangled private walkers on
SpookRepairfor dashboards, views, sections, cards, badges, picture elements, actions, visibility, and mushroom chips. - New
__init__.pypackage markers for theautomationandlovelacetest subpackages and theirrepairschildren.
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 |
|---|---|
| tests/ectoplasms/automation/init.py | Marks the automation tests subpackage. |
| tests/ectoplasms/automation/repairs/init.py | Marks the automation repairs tests subpackage. |
| tests/ectoplasms/automation/repairs/test_unknown_entity_references.py | Async tests pinning the automation extractor behavior across value/trigger/condition/action/full-config paths. |
| tests/ectoplasms/lovelace/init.py | Marks the Lovelace tests subpackage. |
| tests/ectoplasms/lovelace/repairs/init.py | Marks the Lovelace repairs tests subpackage. |
| tests/ectoplasms/lovelace/repairs/test_unknown_entity_references.py | Tests for SpookRepair's name-mangled dashboard/card/badge/element walkers, including mushroom chips and visibility. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



Description
Add tests for the automation and Lovelace unknown entity reference extractors.
The automation tests cover the current helper behavior for extracting entity references from values, triggers, conditions, actions, and full automation configs. The Lovelace tests cover the dashboard walker across views, cards, badges, sections, picture elements, actions, visibility, and custom mushroom chips.
Motivation and Context
This ports the useful remaining test coverage from the old #1254 draft without bringing along the stale scaffold, dependency, workflow, or lockfile changes.
The tests give the unknown entity repair code a better baseline before refactoring the duplicated repair logic.
How has this been tested?
uv run pytest tests/ectoplasms/automation/repairs/test_unknown_entity_references.py tests/ectoplasms/lovelace/repairs/test_unknown_entity_references.py -quv run pytest -quv run ruff check tests/ectoplasms/automation tests/ectoplasms/lovelaceuv run ruff format --check tests/ectoplasms/automation tests/ectoplasms/lovelaceuv run pylint tests/ectoplasms/automation/repairs/test_unknown_entity_references.py tests/ectoplasms/lovelace/repairs/test_unknown_entity_references.pyScreenshots (if appropriate):
Not applicable.
Types of changes
Checklist