Codex updated: Harden device entity lifecycle and command forwarding#834
Draft
dmulcahey wants to merge 1 commit into
Draft
Codex updated: Harden device entity lifecycle and command forwarding#834dmulcahey wants to merge 1 commit into
dmulcahey wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #834 +/- ##
==========================================
+ Coverage 97.27% 97.30% +0.03%
==========================================
Files 55 55
Lines 10930 10946 +16
==========================================
+ Hits 10632 10651 +19
+ Misses 298 295 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
This pull request was created with Codex and is an updated version of the pull request it supersedes.
Original pull request: #689
This pull request introduces important improvements to entity and device lifecycle management in the Zigbee integration, focusing on robust cleanup, initialization, and manufacturer-specific command handling. The main goals are to prevent stale state accumulation, ensure proper error handling during entity and endpoint removal, and guarantee that manufacturer codes are correctly forwarded in cluster commands.
Entity and Device Lifecycle Improvements:
on_removecallbacks in platform entities, preventing a single callback failure from aborting entity cleanup and ensuring all tracked tasks are cancelled and removed properly (zha/application/platforms/__init__.py). [1] [2]zha/zigbee/device.py).async_initializepasses do not accumulate pending entities by clearing the pending list after each initialization, and keeping entity instances stable across re-initialization (zha/zigbee/device.py).INITIALIZEDif all endpoints initialize successfully (zha/zigbee/device.py). [1] [2]Cluster Command Handling:
issue_cluster_commandto correctly forward manufacturer codes in bothargsandparamsinvocation paths, ensuring manufacturer-specific commands are properly framed for compatibility and reliability (zha/zigbee/device.py).Testing Enhancements:
tests/test_device.py). [1] [2]These changes collectively strengthen the reliability and maintainability of device and entity management in the Zigbee integration, reducing lifecycle errors and improving support for manufacturer-specific device interactions.## Summary
Hardens device/entity lifecycle initialization and cluster command forwarding.
Failing tests addressed
tests/test_device.py::test_issue_cluster_commandtests/test_device.py::test_platform_entity_on_remove_callback_failure_does_not_abort_cleanuptests/test_device.py::test_async_initialize_does_not_grow_pending_entities_between_passestests/test_device.py::test_async_initialize_does_not_mark_initialized_if_endpoint_init_failstests/test_sensor.py::test_device_counter_sensorstests/test_sensor.py::test_device_unavailable_or_disabled_skips_entity_pollingtests/test_light.py::test_light_refreshVerification
pytest(branch-local targeted run): all listed tests pass.