Exclude the entity itself from is_supported_in_list - #879
Draft
TheJulianJES wants to merge 1 commit into
Draft
Conversation
`recompute_entities` passed the full entity list including the entity being evaluated, forcing every `is_supported_in_list` implementation to defensively filter out `self` (the singleton checks in the RSSI sensor and identify button did). The caller now excludes the entity, matching `_add_pending_entities` (where the pending entity was never in the list), and the defensive checks are removed.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #879 +/- ##
=======================================
Coverage 97.19% 97.19%
=======================================
Files 57 57
Lines 10543 10543
=======================================
Hits 10247 10247
Misses 296 296 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Excludes each entity from its peer list during support recomputation, establishing a consistent caller-side contract.
Changes:
- Filters the evaluated entity from
is_supported_in_list. - Removes redundant self-filtering from singleton entity implementations.
- Documents the peer-list contract.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
zha/zigbee/device.py |
Passes only peer entities during recomputation. |
zha/application/platforms/sensor/__init__.py |
Simplifies RSSI singleton detection. |
zha/application/platforms/button/__init__.py |
Simplifies identify-button singleton detection. |
zha/application/platforms/__init__.py |
Documents the method contract. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the third item of #725.
recompute_entitiespassed the full entity list — including the entity being evaluated — tois_supported_in_list, forcing every implementation to defensively filter outself(the singleton checks in the RSSI sensor and identify button did). The caller now excludes the entity, matching_add_pending_entities(where the pending entity is never in the list, as it is only inserted after its own check), and the defensive checks are removed. The base docstring documents the contract.No behavior change:
test_entity_recomputationfails if the caller-side exclusion is removed while the implementations no longer self-filter, so the contract is pinned by the existing suite.