Repository navigation
feat: add V1 feature flag bits needed to gate dock and cleaning options - #1054
allenporter merged 2 commits into
Conversation
Lash-L
left a comment
There was a problem hiding this comment.
Automated code review by Gemini 4 Hydrogen in Antigravity using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).
Scope & Stacking
This PR is stacked on #1046 (0a153bee, b2b0258f, ccf43c0f). This review covers only PR #1054's own commit 7c5fd01e.
Summary by Architectural Layer
- Layer 1 (Public Trait APIs & Capability Model —
roborock/device_features.py,docs/V1_DEVICE_FEATURES.md):- All 41 new
NewFeatureStrBitindices (6,121–169),robotFeaturesIDs (111,112,114,116),robotNewFeaturesmask (65536), and the model rules forRubySC/RubyPlus(is_map_segment_supported) andBerylLite/CoralProSAw(is_support_wash_phase_pumping_supported) match the Roborock app. - 1 issue found:
is_smart_water_supporteduses|= kwargs["is_roller_mop_supported"]inDeviceFeatures.from_feature_flags, whereas the app'sisSmartMopWaterSupportedrequires both bit 166 (SmartWaterSupported) andisSupportRollerMop(&&, not||).
- All 41 new
- Layer 2 & 3 (State, Cache & Feature Decoding):
DeviceFeatures.from_dictcontinues to reject stale cached entries missing new boolean fields, triggering clean re-discovery.
- Tests & Snapshots (
tests/test_supported_features.py,tests/**/__snapshots__/*.ambr):- Targeted tests (
test_supported_features.py,test_device_manager.py,test_file_cache.py,test_v1_device.py,tests/conformance/— 664 passed, 53 xfailed, 99 snapshots passed),ruff check, andmypyall pass on7c5fd01e. Snapshot updates consistently add only the new keys (withtests/test_supported_features.pyasserting the|=behavior onis_smart_water_supported, which should be updated alongside the fix).
- Targeted tests (
| kwargs["is_map_segment_supported"] |= product_nickname in _MAP_SEGMENT_MODELS | ||
| kwargs["is_support_wash_phase_pumping_supported"] |= product_nickname in _WASH_PHASE_PUMPING_MODELS | ||
| # The app offers smart mop water for roller mops even without the smart-water bit. | ||
| kwargs["is_smart_water_supported"] |= kwargs["is_roller_mop_supported"] |
There was a problem hiding this comment.
Layer 1 — Capability Gating (is_smart_water_supported uses OR instead of AND with roller mop)
In the app, isSmartMopWaterSupported requires both NewFeatureStrBit 166 (SmartWaterSupported) and isSupportRollerMop (bit 128), i.e. logical &&, not ||. Using |= here enables is_smart_water_supported for any roller-mop device even when bit 166 is unset.
Suggested fix: Either remove |= so is_smart_water_supported reports bit 166 directly (like is_change_mop_supported for bit 129) and note in the field comment and docs/V1_DEVICE_FEATURES.md that consumers should also check is_roller_mop_supported, or gate it with &=:
# Option A: report bit 166 directly (keeps single-bit tests passing; document that app also requires is_roller_mop_supported)
# (remove lines 849-850)
# Option B: match app's isSmartMopWaterSupported directly (update test_new_feature_str_bits_from_app & test_mop_support_from_roller_mop_bit)
kwargs["is_smart_water_supported"] &= kwargs["is_roller_mop_supported"]
There was a problem hiding this comment.
Thanks, you are right. Smart mop water needs both bit 166 and the roller-mop bit. Fixed in f75284d with &=, and there is a test for all four combinations of bits 128 and 166.
While checking this against the app plugin I found two more rules that were wrong, and the same commit fixes them:
is_map_segment_supportedhad the logic inverted. Map segments are supported on every model except RubySC and RubyPlus, which need robotFeatures 116.is_photo_upload_supportedis removed. The 65536 mask only applies to three older models in the China app, and the library cannot check the app region.
The PR description is updated to match.
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).
Follow-up Review on f75284d (delta from 7c5fd01)
- Scope & Stacking: Still stacked on #1046 (
0a153be,b2b0258,ccf43c0); PR #1054's own commits are7c5fd01andf75284d. - Prior Finding Resolved:
is_smart_water_supportednow uses&=withis_roller_mop_supported(roborock/device_features.py), matching the app'sisSmartMopWaterSupported(isNewFeatureStrSupport(SmartWaterSupported) && isSupportRollerMop()). All four bit combinations ([],[128],[166],[128, 166]) are covered intests/test_supported_features.py.
- Additional Changes in
f75284dVerified:is_map_segment_supportednow usesproduct_nickname not in _MAP_SEGMENT_FEATURE_REQUIRED_MODELS({RUBYSC, RUBYPLUS}), matching the app's!DM.is(RubySC) && !DM.is(RubyPlus) || isSupportFeature(116)rule, with tests covering both model fallback androbotFeatures116.is_photo_upload_supported(mask65536) is cleanly removed across code, docs, tests, and snapshots — appropriate given the app gates it on CN region and non-Mi app for three legacy models.- All 41 added
NewFeatureStrBitindices (6,121–169),robotFeaturesIDs (111,112,114,116), andis_support_wash_phase_pumping_supportedmodel rules match the app plugins.
- CI & Verdict: All CI checks (
lint,Lint Commit Messages,test&test-mqtton 3.11/3.14,Build Package,Test Semantic Release) are green onf75284d. No remaining findings — passes/review(ready to merge once #1046 lands).
f75284d to
84c1058
Compare
Add the 41 new_feature_str bits, robotFeatures 111/112/114/116 and robotNewFeatures 65536 that the newest app plugins read, with the app's extra rules for map segments, wash phase pumping and smart mop water.
Smart mop water needs both bit 166 and the roller-mop bit. Map segments are supported on every model except RubySC and RubyPlus, which need robotFeatures 116. The photo-upload mask only applies to three older models in the China app, so it is removed.
84c1058 to
9e5ce30
Compare
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 (9e5ce30, delta from f75284d)
Verdict: Passes /review.
What changed since f75284d. The branch was rebased onto main (merge base 321c6d5) and is no longer stacked on #1046. The commits were reworded to 49f7485 + 9e5ce30. roborock/device_features.py, docs/V1_DEVICE_FEATURES.md, tests/test_supported_features.py and tests/__snapshots__/test_supported_features.ambr are byte-identical to f75284d. The only other change is the regenerated device snapshots (test_device_manager, test_file_cache, test_v1_device). It merges cleanly with current main.
Earlier findings. The smart water |= → &= fix from the first review is still in (roborock/device_features.py:850). The map segment and photo upload corrections are also still in. There are no open threads.
Re-check against the app plugins
I re-checked every new flag against the decoded V1 plugins in RR_API. All 11 hermes plugins that carry the NewFeatureStr table agree, with no index conflicts. The reference used here is hermes/no_package/Qrevo Edge 2 Flow/output/module_459.js:175.
-
Confirmed: all 41
NewFeatureStrBitmembers. These are bit 6 (SupportSilentOta) and bits 121, 122, 125, 129–156, 158, 160, 161, 164–169. Each index and app name matches the PR (device_features.py:12-131). The app reads them throughisNewFeatureStrSupport, which the library maps tonew_feature_info_str. The PR'sSOUND_RECORDcomes from the app'sSoundRecordSupportedandSMART_WATERfromSmartWaterSupported, with theSupportedsuffix dropped as the PR body says. -
Confirmed:
robotFeatures111, 112 and 114. They matchisSupportFDSEndPoint→isSupportFeature(111)(module_459.js:2627-2630),isSupportAutoSplitSegments→112(:2636-2639) andisSupportOrderSegmentClean→114(:2645-2648). -
Confirmed: map segments (
robotFeatures116). The app'sisMapSegmentSupportedis!RubySC && !RubyPlus || isSupportFeature(116)(module_459.js:190-223). The PR implements this atdevice_features.py:322-325,847, and an unknown model getsTruein both. -
Confirmed: wash phase pumping. The app's
isSupportWashPhasePumpingisBerylLite || CoralProSAw || bit 148(module_459.js:5513-5541), which matchesdevice_features.py:848. -
Confirmed: smart water. The app's
isSmartMopWaterSupportedisbit 166 && isSupportRollerMop()(module_459.js:1514-1525), andisSupportRollerMopis bit 128 (:4525-4529). This matchesdevice_features.py:850. -
Confirmed: conditions the library leaves to the consumer.
- The zone replenish flags (132 and 154) also need
serverCode !== 'de'(module_459.js:3897-3920, 5596-5602). - Backup and restore (151) also needs
isSupportAESEncrypt(:5578-5586). isSupportChangeMopisisChangeMopMachine()(bit 129) plus a Shell4S or Shell4SA dock (:3837-3870).
The code comments and docs describe each of these accurately.
- The zone replenish flags (132 and 154) also need
Priority 1–3
No findings. The new fields follow the existing new_feature_str_bit / robot_features metadata pattern. The three derived rules are done in from_feature_flags with no new state, and no telemetry decoding is gated.
Tests & PR hygiene
uv run pytest -qon9e5ce30(Python 3.13): 2742 passed, 47 xfailed, 168 snapshots passed.ruff checkandruff format --checkare clean.mypyreports 1 error intests/map/test_b01_q10_render.py:502, which this PR does not touch, and the same error shows up onorigin/mainwith the same local toolchain. CI is green on9e5ce30.- Heads-up for the merge order: #1055 and #1064 are not stacked on this branch, and both conflict with it textually. #1055 conflicts in
tests/__snapshots__/test_supported_features.ambr. #1064 conflicts inroborock/device_features.py,docs/V1_DEVICE_FEATURES.mdand two snapshot files, because of its newrobotFeatures118 field next to the 111–116 block. The conflicts are not semantic, so whichever PR lands second needs a rebase and a snapshot refresh.
This is an automated review and can be incorrect, so please reply if any finding looks wrong.
Summary
Adds firmware capability flags that
DeviceFeaturesdid not expose yet. Later dock and cleaning mode PRs need them to offer options only on robots that support them.NewFeatureStrBitmembers: bit 6 and bits 121-169. Their names are the flag names used in the Roborock app plugins, without a trailingSupported(SmartWaterSupportedbecomesSMART_WATER). Each has aDeviceFeaturesfield namedis_<bit name>_supported, the same pattern as the existing bits.robotFeaturesids 111 (is_fds_endpoint_supported), 112 (is_auto_split_segments_supported), 114 (is_order_segment_clean_supported) and 116 (is_map_segment_supported).No existing bit, id or field changes meaning. The bit numbers were compared with all 24 Roborock app V1 plugins; none of them disagrees with another plugin or with the library.
Model rules
Three fields combine the firmware flag with another signal, so a consumer can use the field directly:
is_map_segment_supportedis true for every model except RubySC and RubyPlus. Those two older models support map segments only when they report feature id 116. It is also true when the model is unknown.is_support_wash_phase_pumping_supportedis also true for BerylLite and CoralProSAw, which support the pumping wash phase without bit 148.is_smart_water_supportedneeds both bit 166 and the roller-mop bit (128), because smart mop water is a roller-mop option.Some flags only apply together with conditions the library cannot check, so those fields report the firmware signal alone. Comments in the code and
docs/V1_DEVICE_FEATURES.mdsay so:is_change_mop_supportedtells whether the robot can change mops. Changing them also needs one of those docks, so a consumer that shows a mop-change control should check the dock too.The photo-upload mask in
robotNewFeatures(65536) is left out. It only applies to three older models in the China app, and the library cannot check the app region.Cache
DeviceFeatures.from_dictreturnsNonewhen a cached entry is missing any bool field. So after upgrading, cached features are discovered again from the device once. This is the existing behavior for new fields.Tests
robotFeaturesids, the map segment rule, the BerylLite and CoralProSAw rule, and smart water with and without the roller-mop bit.is_map_segment_supportedis true.docs/V1_DEVICE_FEATURES.mdhas entries for the new fields. It also adds theis_roller_mop_supportedentry, which was missing.Related issues
is_support_only_smart_wash_towel_supported), which the wash towel mode options need to offer Smart on the Qrevo 2 Pro (Smart mop-washing mode missing from Qrevo 2 Pro options #1032).Part of #738