Repository navigation
fix(v1): decode unrecognized error and status codes as unknown - #1057
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/unknown-v1-status-codes
branch
from
November 16, 2026 21:24
51113ce to
94cfa63
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
Clean, well-scoped fix with no blocking or non-blocking findings — ready to approve.
Priority 1: Public Trait APIs & Consumer Contracts
RoborockErrorCode,RoborockDockErrorCode,RoborockInCleaning,RoborockFinishReason,RoborockCleanType, andRoborockStartTypenow exposeunknown = -1, bringingkeys(),as_dict(), andStatus.error_code_namein line with sibling resilient enums (RoborockStateCode,RoborockChargeStatus,RoborockDockTypeCode).StatusTrait.resolve_error()preserves its public signature and expliciterror_codeoverride behavior while preventing unrecognized codes from being sent as-1.
Priority 2: Data Lifecycle & State Management
- Checked all usages of the six enum fields across
roborock/for truthiness regressions now that unknown codes decode to-1(truthy) rather than0(ok/none/complete, falsy).StatusTrait.resolve_error()is the only affected control-flow path and is properly guarded so an unknown dock error falls through to a known robot error and an unknown robot error is a no-op. StatusTrait.update_from_dps()continues to convertERROR_CODEcleanly viaRoborockBase.convert_dict.
Priority 3: Wire Protocols, Codecs & Resilient Enums
- Cross-verified against the V1 app protocol (
com.roborock.tanos): wire codes for all six fields are non-negative integers, sounknown = -1cannot collide with valid firmware values. - All six enums are removed from
KNOWN_ENUMS_MISSING_UNKNOWNintests/conformance/test_enum_conformance.py, permanently enforcing their fallback contract.
Tests & CI
- Parametrized unit tests are properly colocated in
tests/data/test_code_mappings.pyandtests/devices/traits/v1/test_status.py, covering all six enum fallbacks andresolve_error()skip/fallthrough cases. - All CI checks pass on
94cfa63.
RoborockErrorCode, RoborockDockErrorCode, RoborockInCleaning, RoborockFinishReason, RoborockCleanType and RoborockStartType had no unknown member, so an unrecognized code fell back to the first member: an unmapped robot or dock error read as none/ok and an unmapped in_cleaning value as complete. These enums now decode such codes as unknown, and StatusTrait.resolve_error() without an explicit code skips an unknown error instead of sending -1.
hCoureau
force-pushed
the
submit/fix/unknown-v1-status-codes
branch
from
November 21, 2026 21:36
94cfa63 to
ac17429
Compare
allenporter
approved these changes
Nov 22, 2026
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
RoborockEnum._missing_decodes a code the library does not know as the enum'sunknownmember when it has one, and as the first member otherwise. The enum conformance test keeps a baseline of enums that still lackunknown.Problem
RoborockErrorCode,RoborockDockErrorCode,RoborockInCleaning,RoborockFinishReason,RoborockCleanTypeandRoborockStartTypehave nounknownmember, so an unrecognized code is reported as a real value. An unrecognized robot or dock error reads asnone/ok,in_cleaning: 4reads ascomplete(#929), and finish reason 78 reads asmanual_interrupt(#523).Changes
unknown = -1to these six enums and remove them from the conformance baseline.StatusTrait.resolve_error()called without a code skips anunknowndock or robot error, so it never sends-1. This keeps the previous behaviour, where such codes decoded asok/noneand nothing was sent.keys()andas_dict()on these enums now includeunknown, so consumers that build option lists from them will see the extra value.Testing
resolve_error(): an unknown dock error falls through to the robot error, and nothing is sent when only an unknown error is reported. They fail without thestatus.pyguard.main.Evidence
roborock.vacuum.a294, firmware 02.40.54), known codes still decode to their names with this change: error 0, dock error 0,in_cleaning3, start type 2, clean types 1, 2 and 3, and finish reasons 43, 54 and 56.resolve_error()skipping it use simulated codes only. My device reports no unmapped code, andresolve_errorwas not sent to it.Related to #929 and #523.