fix: Handle AppInitStatus with omitted new_feature_info_str#688
Merged
allenporter merged 3 commits intoPython-roborock:mainfrom Dec 17, 2025
Merged
Conversation
The approach taken here is: (1) add an example of this response type to the json examples to exercise the decoder. (This succeeds already, but is just used to record the payload) (2) Add a test for passing the decoded data to the dataclass. In the future this can be improved with trait tests that use these payloads, but this is a way to do it incrementally for now.
Lash-L
reviewed
Dec 17, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where the new_feature_info_str field can be omitted in AppInitStatus responses from some devices, which was causing deserialization failures (issue #158049). The fix makes this field optional and handles the None case appropriately.
Key changes:
- Made
new_feature_info_strfield optional inAppInitStatusdata class - Added null coalescing in the trait parsing code to convert None to empty string
- Added comprehensive tests including real-world payload examples
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| roborock/data/v1/v1_containers.py | Made new_feature_info_str field optional with default value of None |
| roborock/devices/traits/v1/device_features.py | Added null coalescing (or "") when passing new_feature_info_str to DeviceFeatures.from_feature_flags() |
| tests/protocols/testdata/v1_protocol/app_get_init_status2.json | Added real-world test payload demonstrating response without new_feature_info_str field |
| tests/protocols/snapshots/test_v1_protocol.ambr | Added snapshot expectations for the new test payload showing successful deserialization |
| tests/test_containers.py | Added test verifying AppInitStatus can be created from dict without new_feature_info_str |
| tests/test_supported_features.py | Added test verifying DeviceFeatures works correctly with empty new_feature_info_str |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Lash-L
approved these changes
Dec 17, 2025
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.
The approach taken here is:
(1) add an example of this response type to the json examples to exercise the decoder. (This succeeds already, but is just used to record the payload) (2) Add a test for passing the decoded data to the dataclass.
In the future this can be improved with trait tests that use these payloads, but this is a way to do it incrementally for now.
Issue: home-assistant/core#158049