Repository navigation
fix(v1): update wash towel mode after setting it - #1060
Merged
allenporter merged 2 commits intoNov 22, 2026
Merged
allenporter merged 2 commits into
allenporter merged 2 commits into
Conversation
WashTowelModeTrait.set_wash_towel_mode sent the command but left wash_mode unchanged, so the trait kept reporting the previous mode until the next refresh. Update wash_mode optimistically after the command, like the other V1 trait setters.
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 (
roborock/devices/traits/v1/wash_towel_mode.py): Clean.WashTowelModeTrait.set_wash_towel_mode(self, mode: WashTowelModes)updatesself.wash_modewith the typedWashTowelModesenum value, matchingWashTowelMode.wash_mode: WashTowelModes | Noneandrefresh()deserialization with no API surface changes or untyped boundaries. - Priority 2 — Data Lifecycle & State Management (
roborock/devices/traits/v1/wash_towel_mode.py): Clean. The optimistic update afterawait self.rpc_channel.send_command(...)satisfiesV1TraitMixin's setter contract and matches sibling single-field V1 setters (ChildLockTrait,LedStatusTrait,FlowLedStatusTrait,MopDryerTrait,SoundVolumeTrait,ValleyElectricityTimerTrait,DoNotDisturbTrait). Because the assignment runs aftersend_commandawaits, failed RPC calls leaveself.wash_modeunchanged. - Priority 3 — Wire Protocols, Codecs & Resilient Enums: No wire protocol or codec changes;
set_wash_towel_mode({"wash_mode": mode.code}) maps 1:1 to the single-fieldWashTowelModemodel. - Tests & CI (
tests/devices/traits/v1/test_wash_towel_mode.py): Clean. Colocated assertion added directly to the existing parametrizedtest_set_wash_towel_modetest, verifying the publicwash_modeattribute. All CI checks pass.
Verdict
No findings survived adversarial self-check. This PR is tightly scoped, consistent with sibling V1 traits, and clean and ready to approve.
allenporter
approved these changes
Nov 22, 2026
Contributor
|
I'm not so sure how i feel about this, but OK. I think we may want to have the opinion that commands do start a refresh after, and/or rely on an ayns update, but seems ok to do this for now. |
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
V1TraitMixinexpects a setter to leave the trait's own state current, either by updating it optimistically or by refreshing. The other V1 setters, such aschild_lock,led_status,mop_dryerandvolume, do this.Problem
WashTowelModeTrait.set_wash_towel_mode()sendsset_wash_towel_modebut does not updatewash_mode. After a successful set the trait keeps reporting the previous mode until the nextrefresh().Changes
wash_modeoptimistically after the command, using the same idiom as the switch traits.Testing
test_set_wash_towel_modenow also asserts the trait state. The new assertion fails on unchanged code.main.Evidence
On a Qrevo 2 Pro (
roborock.vacuum.a294, firmware 02.40.54), for each wash mode the library offers on this device (light 0, balanced 1, deep 2, super_deep 8):get_wash_towel_modereturned the new value, butwash_modestill held the previous one.The original mode was restored afterwards.