Repository navigation
Conversation
Reads get_clean_sequence into CleanSequence.rooms and writes it with set_clean_sequence. Gated on is_order_clean_supported (robot feature 123).
Lash-L
left a comment
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).
Review Summary
Clean, well-scoped PR adding CleanSequenceTrait (device.v1_properties.clean_sequence) and CleanSequence. One functional API gap turned up during RR_API cross-verification, plus a small test-coverage gap.
Priority 1: Public Trait APIs & Consumer Contracts
- Good:
CleanSequencesubclassesRoborockBasewith@dataclass, avoidsAny/TypedDict/forward refs, keeps transport isolated viaV1TraitMixin, and gates initialization onrequires_feature = "is_order_clean_supported". - Finding (
clean_sequence.py):set_order()rejects an empty list ([]) withValueError, which prevents consumers from clearing/resetting a custom room cleaning order back to the robot's automatic sequence (see inline comment).
Priority 2: Data Lifecycle & State Management
- Good:
CleanSequenceConverter.convert()is a pure value-returning helper;set_order()performs a defensivelist(rooms)copy and only updatesself.roomsoptimistically aftersend_commandsucceeds (so firmware rejections like-10007leave local state unchanged).
Priority 3: Wire Protocols & RR_API Verification
- Verified against official Roborock app bundles (both legacy
com.roborock.tanosand modernSaros 10Rbundles):- RPCs & wire shape:
get_clean_sequence(params[]→ returnslist[int],[]when no custom order is set) andset_clean_sequence(paramslist[int]). - Reset semantics: Both bundles'
onResetOrder()handler explicitly sendsset_clean_sequencewithparams=[]to clear the custom cleaning sequence and restore automatic ordering. - Feature flag:
isOrderCleanSupported()checks robot feature123(is_order_clean_supportedinroborock/device_features.py).
- RPCs & wire shape:
Tests & Fixtures
- Colocated at
tests/devices/traits/v1/test_clean_sequence.pyusing shared fixtures and@pytest.mark.parametrize. - Finding (
test_clean_sequence.py): Add behavior-driven coverage for an unsupported device (clean_sequence_trait is None) and forrefresh()returning[](plus updating the empty-list expectation onceset_order([])/ reset is supported).
| cleaning or moving; set it while the device is idle or docked. | ||
| """ | ||
| if not rooms or len(set(rooms)) != len(rooms): | ||
| raise ValueError(f"rooms must be a non-empty list of distinct segment ids: {rooms!r}") |
There was a problem hiding this comment.
Priority 1 — Public Trait API / Protocol Parity (set_clean_sequence reset semantics)
Rejecting rooms=[] prevents consumers from clearing a custom cleaning order back to the robot's automatic sequence. In the official Roborock app (verified in both legacy com.roborock.tanos and modern Saros 10R app bundles), onResetOrder() explicitly calls set_clean_sequence with [] ("After deleting cleaning order settings, the robot will create an optimum sequence automatically"), and get_clean_sequence likewise returns [] when no custom order is set.
Consider allowing [] in set_order (only rejecting duplicate segment IDs) — and optionally exposing a convenience reset_order() / clear_order() method if you prefer an explicit helper:
if len(set(rooms)) != len(rooms):
raise ValueError(f"rooms must contain distinct segment ids: {rooms!r}")
await self.rpc_channel.send_command(RoborockCommand.SET_CLEAN_SEQUENCE, params=list(rooms))
# Optimistic update to avoid an extra refresh
self.rooms = list(rooms)|
|
||
| def test_requires_feature() -> None: | ||
| """The trait is only created on devices that report order cleaning (robot feature 123).""" | ||
| assert CleanSequenceTrait.requires_feature == "is_order_clean_supported" |
There was a problem hiding this comment.
Tests — Behavior-driven feature-gating & empty-list coverage
Per AGENTS.md (Behavior-Driven Assertions) and sibling optional-trait suites (test_customize_clean_mode.py, test_mop_dryer.py, test_dust_collection_mode.py), consider testing end-to-end discovery on an unsupported device (the default S7 MaxV fixture has is_order_clean_supported=False):
async def test_unsupported_clean_sequence(
clean_sequence_trait: CleanSequenceTrait | None,
) -> None:
"""Trait is not initialized when is_order_clean_supported is False."""
assert clean_sequence_trait is NoneIt would also be helpful to cover refresh() when the device returns [] (no custom cleaning order set), and update test_set_order_rejects_bad_input if set_order([]) is allowed to clear the order.
|
I tested this branch on a real Qrevo MaxV 2 (
The app has a second condition the gate is missingIn the app,
This Qrevo reports feature 123 and The robot does accept and store the order. I haven't checked whether it follows that order in a clean, because I didn't run one. Suggestion: add the location and product condition to the gate. |
…ion rule - set_order([]) now clears the custom order (the app's onResetOrder sends set_clean_sequence []); reset_order() is a helper for it. A repeated room is still refused. - is_order_clean_supported now also needs the app's isModelOrderSupported(): no location -> False; RubyPlus, RubySC, RubySLite, Tanos, TanosE, TanosV -> True; any other product only when local_info.location is not 'us'. DeviceFeaturesTrait passes local_info.location from app_get_init_status; location=None (offline callers) skips the rule. - Tests: unsupported device, empty response, reset, and the model/region table. Five snapshots flip isOrderCleanSupported to False for the US fixture device, as the app would.
|
Thanks @Lash-L, both reviews were right. Pushed 7780680: Reset
Gate
Tests
Still needs hardware testing
|
Summary
Adds
CleanSequenceTrait(device.v1_properties.clean_sequence) for the order in which a device cleans rooms.refresh()readsget_clean_sequenceintoCleanSequence.rooms(segment ids in cleaning order).set_order(rooms)writesset_clean_sequence. It refuses an empty list or a repeated room before anything is sent.is_order_clean_supported(robot feature 123), the same pattern as the other optional traits.Tested on a Saros 10R (a144)
get_clean_sequence[8, 3, 7, 10, 1, 9]app_segment_cleanof rooms 8 and 7 with that order, two runsset_clean_sequence [7, 8, 3, 10, 1, 9], then the same cleanset_clean_sequencewhile the robot was returning to the dock-10007 invalid status; accepted again once dockedThe device reports feature 123 in
app_get_init_status, sois_order_clean_supportedis True on it.SUPPORTED_FEATURES.mdcurrently shows no X for a144 in that row; the fixture data and this device's firmware may differ.Checks
uv run pytest: 2371 passedruff checkandruff format --check: cleanmypy: no errors in the changed files