Repository navigation
fix(v1): report empty trait list replies as parsing errors - #1056
Merged
allenporter merged 1 commit intoNov 22, 2026
Merged
allenporter merged 1 commit into
allenporter merged 1 commit into
Conversation
hCoureau
force-pushed
the
submit/fix/empty-list-trait-response
branch
from
November 16, 2026 21:24
0003065 to
340034a
Compare
Lash-L
reviewed
Nov 21, 2026
Lash-L
left a comment
Collaborator
There was a problem hiding this comment.
Automated code review by Gemini 4 Neon in Antigravity using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).
Summary by Architectural Layer
- Priority 1 — Public Trait APIs & Consumer Contracts (
common.py,device_features.py,led_status.py,maps.py): Clean. All five single-record V1 converters (DefaultConverter,SingleValueConverter,DeviceTraitsConverter,LedStatusConverter,MultiMapsListConverter) now guard against empty list replies (and non-dict first elements inDeviceTraitsConverter) by raisingValueError, whichV1TraitMixin.refresh()wraps intoRoborockParsingExceptionwith command and payload context—matching the precedent set in #1034 (CleanRecordConverter). Legitimate empty-list V1 getters (RoomsConverter,CustomizeCleanModeConverter) remain untouched. - Priority 2 — Data Lifecycle & State Management: Clean. Raising before
merge_trait_values()(and before cache writeback inDeviceFeaturesTrait.refresh()) preserves prior trait state and avoids caching malformed replies. All converters remain pure value-returning helpers. - Priority 3 — Wire Protocols, Codecs & Cryptography: No wire/codec changes; dynamic wire-payload type narrowing is properly scoped inside
V1TraitDataConverter.convert(). - Tests & CI: Clean. Regression tests are colocated in the matching mirror suites under
tests/devices/traits/v1/(including the newtest_led_status.pymirroringled_status.py), reuse existing fixtures and parametrization, and verify bothRoborockParsingExceptionwrapping and state preservation. All CI checks pass.
Verdict
No findings survived adversarial self-check. This PR is clean, tightly scoped, and ready to approve.
DefaultConverter, SingleValueConverter, MultiMapsListConverter, LedStatusConverter and DeviceTraitsConverter indexed the first element of a list reply without checking for an empty list, and DeviceTraitsConverter passed a non-dict element to from_dict. These raised IndexError or AttributeError instead of RoborockParsingException. They now raise ValueError, which refresh() wraps as a parsing error, leaving the previous values in place.
hCoureau
force-pushed
the
submit/fix/empty-list-trait-response
branch
from
November 21, 2026 21:36
340034a to
d5c2ce7
Compare
allenporter
approved these changes
Nov 22, 2026
Contributor
|
Thanks for the cleanup @hCoureau |
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.
Context
V1 traits parse device replies through converters, and
V1TraitMixin.refresh()turns a converter'sValueErrorintoRoborockParsingExceptioncarrying the command and payload. #1034 madeCleanRecordConverterreject empty replies this way.Problem
DefaultConverter,SingleValueConverter,MultiMapsListConverter,LedStatusConverterandDeviceTraitsConvertertake the first element of a list reply without checking that the list is non-empty, andDeviceTraitsConverteralso passes a non-dict first element tofrom_dict. An empty or malformed reply therefore raisesIndexErrororAttributeErrorfromrefresh()instead ofRoborockParsingException.Changes
ValueErrorfor an empty list, andDeviceTraitsConverteralso for a non-dict element.refresh()already wraps that asRoborockParsingException; the trait keeps its previous values.Testing
IndexErrororAttributeErrorwithout the fix.main.Evidence
roborock.vacuum.a294, firmware 02.40.54), normal replies for 14 traits still parse through all five converters with this change.