Repository navigation
Conversation
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. |
|
Thanks @Lash-L, both reviews were right. Pushed 7780680: Reset
Gate
Tests
Still needs hardware testing
|
Lash-L
left a comment
There was a problem hiding this comment.
Automated code review by Claude Opus 5.5 in Claude Code using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).
Follow-Up Review (7780680, delta from 7b311e8)
Verdict: Passes /review with nits. It still needs a rebase before it can merge (see the last section).
Earlier findings and maintainer requests
- Reset / empty list (previous review,
clean_sequence.py): fixed.set_order([])now sendsset_clean_sequencewithparams=[], andreset_order()wraps it. That is the reset the app sends, andget_clean_sequenceanswers[]when no custom order is set. A repeated room is still refused before anything is sent. - Tests for an unsupported device and an empty response (previous review): fixed.
test_unsupported_clean_sequence,test_refresh_emptyand the parametrizedtest_reset_ordercover these. - Model and region gate (maintainer comment after the a87 test): fixed, and it matches the app. The app shows room order only when robot feature 123 is set and the model/region rule passes: no device location means no; RubyPlus, RubySC, RubySLite, Tanos, TanosE and TanosV are allowed in every region; every other product is allowed only when the location is not
us. The location islocal_info.locationfromapp_get_init_status.PRODUCTS_WITH_ORDER_CLEAN_IN_ALL_REGIONSlists the right six nicknames, and their short models incode_mappings.py(t6/s6,t7/a11,t7p/a09/a10,t4/s4,p5/a08,p6/s5e/a05) are the same models the app means.RubySEis left out, which is correct. The current V1 plugins all use this same rule.
Priority 1: Public Trait APIs & Consumer Contracts
No new findings. CleanSequence is a RoborockBase dataclass, the trait is gated through requires_feature, and the RPC names and payloads (get_clean_sequence with no params returning list[int], set_clean_sequence taking list[int]) are right.
Priority 2: Data Lifecycle & State Management
- Note, not blocking: cached features keep the old value (
roborock/devices/traits/v1/device_features.py,DeviceFeaturesTrait.refresh).refresh()returns cachedDeviceFeatureswhenever the cache has them. So a US non-Ruby/Tanos unit that was discovered before this change keepsis_order_clean_supported=True, and still getsclean_sequence, until its cache is cleared. You already mentioned this in your comment. Fixing it would need a feature-cache version or invalidation, which is out of scope here, so a line in the PR description is enough. The robots tested so far (a87, a144) store the order anyway, so a staleTruedoes not break anything.
Priority 3: Wire Protocols
- Nit (
roborock/device_features.py,_is_model_order_supported):location.lower() != "us"is case-insensitive, while the app compares exactly with== "us". Devices report lowercase, so this changes nothing in practice. Keep it or drop the.lower(), either is fine.
Tests & PR hygiene
- Rebase needed. The PR conflicts with
main, but only intests/devices/__snapshots__/test_device_manager.ambrandtest_v1_device.ambr(new feature fields from #1054). In a trial merge withmain, taking main's snapshots and runningpytest --snapshot-update tests/devicesreproduced exactly this PR's fiveisOrderCleanSupported: True → Falseflips, and then the full suite passed (3299 passed). - Please update the PR description. It still says
set_orderrefuses an empty list and that the gate is feature 123 only. Its hardware table also says the robot "cleaned room 7 first" afterset_clean_sequence, but your later comment says no clean has been run with a custom order yet. Please make the two agree. If the clean-order result is unconfirmed, also soften theCleanSequenceTraitdocstring line saying the device uses this order "whatever order the segments are sent in". - Checks on
7780680:pytest2382 passed,ruff checkandruff format --checkare clean, andmypyreports no errors in the changed files.
This is an automated review and can be incorrect, so please reply if any finding looks wrong.
Reads get_clean_sequence into CleanSequence.rooms and writes it with set_clean_sequence. Gated on is_order_clean_supported (robot feature 123).
…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.
7780680 to
31006fa
Compare
Adds
CleanSequenceTraitatdevice.v1_properties.clean_sequencefor reading and changing the device's stored room cleaning order.refresh()readsget_clean_sequenceintoCleanSequence.rooms.set_order(rooms)writesset_clean_sequence; duplicate segment IDs are rejected before sending.set_order([])clears the custom order, andreset_order()wraps that reset. Cached rooms update only after a successful write.local_info.locationfromapp_get_init_status. Offline callers passinglocation=Noneskip the region rule.Previously cached feature values remain in effect until the feature cache is cleared and rediscovered. This PR does not introduce cache versioning.
Hardware evidence is limited to stored settings. The previously reported Saros 10R (a144, US) check cleared
[8,7,3,10,1,9], read back[], then restored and read back the original order. The corrected discovery gate hides this trait on that US model, matching the app. No cleaning run has verified that a saved order overrides the segment order passed toapp_segment_clean; the docstring now says so. Positive discovery on a non-US unit or a US Ruby/Tanos unit also remains unverified. Hardware checks were not repeated for this rebase.Validation on the rebased branch (upstream
mainatcd6f263f, Python 3.12 on an isolated shared worker):uv run pytest -n 2: 3,299 passed, 45 expected failures. Broker-marked MQTT tests are excluded by the repository default; the Python 3.11/3.14 and broker matrices also passed in GitHub CI.uv run pre-commit run --all-files: passed, including Ruff formatting/lint, Codespell and Mypy; no formatter changes.isOrderCleanSupported: True → Falsechanges. The full suite verifies those snapshots without regenerating references.Rebased and pushed as
31006fa; the earlier functional fixes remain intact.