Raise InvalidDefaultResponse on unsuccessful default response#1778
Draft
Raise InvalidDefaultResponse on unsuccessful default response#1778
InvalidDefaultResponse on unsuccessful default response#1778Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1778 +/- ##
==========================================
- Coverage 99.51% 99.46% -0.06%
==========================================
Files 63 63
Lines 12778 12825 +47
==========================================
+ Hits 12716 12756 +40
- Misses 62 69 +7 ☔ View full report in Codecov by Sentry. 🚀 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 PR changes zigpy's behavior with default responses: any default response with a status code other than
SUCCESSwill turn into an exception. This is still a bit annoying to deal with typing-wise because practically any request can be responded to with a default response with aSUCCESSstatus code. We should perhaps modify our request sending to explicitly opt into accepting a default response, with the default being not to?Most general commands have been moved to exact types: for example,
foundation.DefaultResponse. The same has been done for the attribute reading and writing commands. This allows us to more precisely pass around these response types and to fully restrict the types ofread_attributes_raw,write_attributes_raw, andconfigure_reporting_raw. (This unfortunately brings up an issue with zigpy that has no simple fix: our easy-to-defineschema={"param": type}is utterly unusable by type checkers).Related: zigpy/zha#678