Skip to content

fix(v1): gate obstacle photos on camera hardware - #1030

Open
hCoureau wants to merge 1 commit into
Python-roborock:mainfrom
hCoureau:fix/qrevo2-pro-obstacle-photo-discovery
Open

hCoureau wants to merge 1 commit into
Python-roborock:mainfrom
hCoureau:fix/qrevo2-pro-obstacle-photo-discovery

Conversation

@hCoureau

@hCoureau hCoureau commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What

ObstaclePhotoTrait was gated on is_ai_recognition_obstacle_supported (ProductFeatures.AIRECOGNITION_OBSTACLE). Single-line structured-light models (CAMERA_SINGLELINE) report that flag too, so discovery exposed photo downloads on robots with no camera to take them. The Qrevo 2 Pro (roborock.vacuum.a294) is where this was found.

Following the review, the capability is now modeled on DeviceFeatures instead of a model list:

  • New DeviceFeatures.is_obstacle_photo_supported field, gated on ProductFeatures.CAMERA_RGB, CAMERA_DOUBLERGB and CAMERA_DUALLINE.
  • ObstaclePhotoTrait.requires_feature points at it.
  • No DeviceFeaturesTrait property or raw model strings. As a declared field it shows in diagnostics and get_supported_features(), and it invalidates stale cached features through DeviceFeatures.from_dict().

Behaviour change

device.v1_properties.obstacle_photos is now None for every CAMERA_SINGLELINE model (for example Qrevo 2 Pro QUINN a293/a294, Q Revo PEARL, Qrevo S/Pro PEARLS/PEARLC). RGB, double-RGB and dual-line models are unchanged. Dual-line stays enabled to be conservative, because TANOSSPLUS, TANOSSMAX and ULTRON are in the app's isShowObstaclePhoto list; dropping it later is a one-line change.

Hardware evidence for the Qrevo 2 Pro: Roborock's CE manual identifies hardware model RRE0QUI, and its external-sensor inventory lists single-line laser obstacle sensing and no RGB camera. Related: #1018.

Depends on #1100

This adds a DeviceFeatures field that gates a trait. Without #1100, upgrading with an existing FileCache would make discovery raise on the missing field. Merge #1100 first.

Testing

  • tests/test_supported_features.py: new test_obstacle_photo_support_from_camera pins each camera class (QUINN and PEARL single-line → no photos; TOPAZSV RGB, TANOSV double-RGB, ULTRON dual-line → photos).
  • tests/devices/traits/v1/test_obstacle_photos.py: the discovery test covers the Qrevo 2 Pro and Q Revo fixtures (generic recognition on, obstacle_photos absent) and the S7 MaxV (present).
  • DeviceFeatures snapshots updated. The only change is the new field.
  • Rebased onto 7.38.0 as a single commit. ruff check, ruff format --check, and pytest pass (3303 passed, 45 xfailed). mypy reports only the existing tests/map/test_b01_q10_render.py:502 error, also on main.

🤖 Generated with Claude Code

@saruk-vedant

Copy link
Copy Markdown
Contributor

Thanks for the clear write-up and the hardware evidence, this reads well. I checked the mechanism end to end and the behavior is right: the Qrevo 2 Pro reports AI obstacle recognition through the Quinn product features, so the old gate exposed photo downloads for a robot with no camera to take them with, and the new test pins that generic recognition stays on while obstacle_photos disappears. The S7 MaxV case staying on is a good control.

Two questions before this lands:

  1. The codebase already distinguishes single-line laser from RGB cameras in the product feature map: Quinn maps to SINGLE_LINE_CAMERA_FEATURES (CAMERA_SINGLELINE, no CAMERA_RGB) while the S7 MaxV maps to RGB_CAMERA_FEATURES. Would gating photo downloads on the product having CAMERA_RGB (or DOUBLERGB) be a better fit than a model string blocklist? It would cover future laser-only models automatically and use the capability vocabulary that is already here. I understand the conservative case for scoping to a294 only, since that is the model with hardware evidence, so I am asking rather than insisting.

  2. code_mappings lists Quinn as covering short models a293 and a294, but the blocklist only has a294. Is a293 a sibling with the same sensor set that would still expose photo downloads, or is it a different variant that does have a camera? If it shares the hardware, it probably belongs in the set too.

One small note: the dependency on #1028 looks resolved now, that fixture is on main and this diff is just the three photo files, so nothing is blocked on it anymore.

@hCoureau

Copy link
Copy Markdown
Contributor Author

Thanks for the careful look, both are fair questions.

  1. I agree the camera capability is the better long-term gate. Quinn (the Qrevo 2 Pro's internal codename, hardware RRE0QUI) maps to PEARL_FEATURES with CAMERA_SINGLELINE and no CAMERA_RGB. But switching would also turn obstacle photos off for every other single- and dual-line model that reports obstacle recognition, roughly 20 product lines across the Pearl, Ultron, Topaz, Tanos, Beryl and Quinn families. I only have hardware evidence for the a294, so I'd rather keep this PR scoped to that and do the capability gate as a follow-up, where the wider change can be reviewed on its own.

  2. a293 shares the Quinn mapping, but I don't know whether it's the same Qrevo 2 Pro hardware, so I've left it out rather than guess. If someone with an a293 can confirm it, they're welcome to raise a PR adding it.

And yes, #1028 is merged, so the diff here is just the three photo files and nothing's blocking it.

@hCoureau
hCoureau marked this pull request as ready for review November 23, 2026 22:28

@saruk-vedant saruk-vedant left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the answers. Keeping this scoped to the a294 and doing the capability gate as a follow-up makes sense, and leaving a293 out until someone confirms the hardware is the right call.

@allenporter allenporter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough investigation and hardware evidence—this is definitely a real bug. When ObstaclePhotoTrait was added in #880, gating on is_ai_recognition_obstacle_supported (ProductFeatures.AIRECOGNITION_OBSTACLE) swept in single-line laser models that report obstacle recognition icons on the map without having a camera to capture photos.

However, we shouldn't implement this as a raw model-string blocklist (_MODELS_WITHOUT_OBSTACLE_PHOTOS) and @property on DeviceFeaturesTrait in roborock/devices/traits/v1/device_features.py. That diverges from how device capabilities are modeled across python-roborock:

Why this should live in roborock/device_features.py

  1. DeviceFeatures is the single source of truth for V1 capabilities.
    DeviceFeaturesTrait is a thin transport/caching wrapper around DeviceFeatures—every other trait's requires_feature (camera, child_lock, customize_clean_mode, flow_led_status, led_status, valley_electricity_timer) points to a declared @dataclass boolean field on DeviceFeatures. Putting a capability predicate as a @property on DeviceFeaturesTrait splits the capability model:

    • Callers using DeviceFeatures.from_feature_flags(...) directly (CLI, tests, diagnostics) won't see the capability.
    • DeviceFeatures.get_supported_features() inspects vars(self), so @property methods are omitted from diagnostics.
    • tests/test_supported_features.py snapshot coverage and DeviceFeatures.from_dict() stale-cache invalidation (which checks fields(cls)) only track declared dataclass fields.
  2. We gate on ProductFeatures / RoborockProductNickname, not raw "roborock.vacuum.*" strings.
    Models are mapped once in roborock/data/code_mappings.py (SHORT_MODEL_TO_ENUM → RoborockProductNickname), and DeviceFeatures fields declare their capability source via field metadata—for example, right alongside is_ai_recognition_obstacle_supported in roborock/device_features.py:

    is_support_water_mode: bool = field(
        metadata={
            "product_features": [
                ProductFeatures.MOP_ELECTRONIC_MODULE,
                ProductFeatures.MOP_SHAKE_MODULE,
                ProductFeatures.MOP_SPIN_MODULE,
            ]
        }
    )
  3. PRODUCT_FEATURE_MAP already distinguishes camera hardware.
    Every nickname in PRODUCT_FEATURE_MAP with AIRECOGNITION_OBSTACLE already has one of four mutually exclusive camera tags pulled from the Roborock app:

    • CAMERA_RGB (28 nicknames, e.g., S7 MaxV TOPAZSV, Saros 10/10R, Qrevo MaxV/Curv)
    • CAMERA_DOUBLERGB (1 nickname: S6 MaxV TANOSV)
    • CAMERA_DUALLINE (6 nicknames, e.g., S8 ULTRON, S8 Pro Ultra ULTRONSPLUS, S7 Max Ultra TOPAZSPLUS)
    • CAMERA_SINGLELINE (16 nicknames, e.g., Q Revo PEARL, Qrevo S/Pro PEARLC/PEARLS, Qrevo 2 Pro QUINN)

    Single-line structured-light models (CAMERA_SINGLELINE) have no camera hardware at all (our existing home_data_device_q_revo.json and home_data_device_pearls.json fixtures have the same false positive as a294). The only ambiguous group is CAMERA_DUALLINE (since TANOSSPLUS, TANOSSMAX, and ULTRON appear in is_show_obstacle_photo_supported).

Suggested Approach

Define a declarative DeviceFeatures field in roborock/device_features.py using ProductFeatures, and point ObstaclePhotoTrait.requires_feature at it. To stay conservative around CAMERA_DUALLINE (S8 / S8 Pro Ultra) while cleanly excluding all camera-less CAMERA_SINGLELINE models (including QUINN, PEARL, etc.):

--- a/roborock/device_features.py
+++ b/roborock/device_features.py
@@ -578,6 +578,13 @@ class DeviceFeatures(RoborockBase):
     is_ai_recognition_obstacle_supported: bool = field(
         metadata={"product_features": [ProductFeatures.AIRECOGNITION_OBSTACLE]}
     )
+    is_obstacle_photo_supported: bool = field(
+        metadata={
+            "product_features": [
+                ProductFeatures.CAMERA_RGB,
+                ProductFeatures.CAMERA_DOUBLERGB,
+                ProductFeatures.CAMERA_DUALLINE,
+            ]
+        }
+    )
--- a/roborock/devices/traits/v1/obstacle_photos.py
+++ b/roborock/devices/traits/v1/obstacle_photos.py
@@ -74,7 +74,7 @@ class ObstaclePhotoTrait(RoborockBase, common.V1TraitMixin):
     command = RoborockCommand.GET_PHOTO
     converter = ObstaclePhotoConverter()
     blob_rpc_channel = True
-    requires_feature = "is_ai_recognition_obstacle_supported"
+    requires_feature = "is_obstacle_photo_supported"

(If we confirm CAMERA_DUALLINE models don't support get_photo either, dropping CAMERA_DUALLINE later is a one-line change in the same field—and adding a field on DeviceFeatures also automatically invalidates stale cached features via DeviceFeatures.from_dict().)

Then remove _MODELS_WITHOUT_OBSTACLE_PHOTOS and the @property from roborock/devices/traits/v1/device_features.py, and update the DeviceFeatures snapshots (tests/__snapshots__/test_supported_features.ambr, etc.) alongside your discovery test in tests/devices/traits/v1/test_obstacle_photos.py.

@Lash-L Lash-L left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Summary

Verdict: Does not pass /review.

Reviewed head 9c16c6f against origin/main (cfa413e). It merges cleanly. The bug is real. ObstaclePhotoTrait is gated on AIRECOGNITION_OBSTACLE, and single-line laser models such as Quinn (a293/a294) report that flag even though they have no camera that can take photos. The fix has the right effect for a294 and changes nothing for other models. The blocker is where the gate lives and how it is written, which is the same point as the maintainer's open CHANGES_REQUESTED review on this commit. I checked that review against the code and the app bundle, and it holds up.

Claims checked against the RR_API app bundle (hermes/com.roborock.tanos/output)

  • a294 is Qrevo 2 Pro / Quinn. Confirmed. module_1567.js:357-359 maps PD.Quinn to short models ['a293', 'a294'], which matches QUINN in roborock/data/code_mappings.py:220.
  • Quinn is a single-line (no RGB) model that still reports obstacle recognition. Consistent. Quinn inherits its config chain in module_1567.js:340-362. SingleLineCameraFeatures contains Camera_SingleLine + AIRecognition_Setting + AIRecognition_Obstacle (module_1566.js:61-83). This matches PEARL_FEATURES in roborock/device_features.py:135-150.
  • The app limits photo features to RGB-camera models. Confirmed. The photo-privacy / map-object-photo control in the AI-recognition settings page only shows when MF.Camera_RGB or MF.Camera_DoubleRGB is supported (module_3234.js:1293-1310). isShowObstaclePhoto (module_443.js:812) is a separate debug whitelist (TanosSPlus etc.), as the PR body says.
  • No RGB camera on RRE0QUI hardware: unverifiable from RR_API (it comes from the external manual and sensor inventory). It is consistent with the above.

Priority 1: Public Trait APIs & Consumer Contracts

  1. roborock/devices/traits/v1/device_features.py:13 and :77-80: the capability is a model-string blocklist in a @property on DeviceFeaturesTrait, not a DeviceFeatures field.
    • What breaks:

      • Every other requires_feature points at a declared field on DeviceFeatures (roborock/device_features.py). This one points at a property that only exists on the trait wrapper.
      • DeviceFeatures.from_feature_flags(...) callers never see the capability. get_supported_features() uses vars(self) (roborock/device_features.py:712-714), so diagnostics leave it out.
      • Snapshot coverage and the from_dict() stale-cache check (:693-706, fields(cls)) don't track it either.
      • "roborock.vacuum.a294" is also a raw string, where the codebase models devices through RoborockProductNickname / ProductFeatures. Quinn's sibling a293 still exposes obstacle_photos.
    • Fix: do what the maintainer review suggests:

      • Add is_obstacle_photo_supported: bool = field(metadata={"product_features": [ProductFeatures.CAMERA_RGB, ProductFeatures.CAMERA_DOUBLERGB, ProductFeatures.CAMERA_DUALLINE]}) to DeviceFeatures. Keeping CAMERA_DUALLINE avoids changing S8 / TanosS behaviour until that is confirmed.
      • Point ObstaclePhotoTrait.requires_feature at the new field.
      • Delete _MODELS_WITHOUT_OBSTACLE_PHOTOS and the property.
      • Regenerate tests/__snapshots__/test_supported_features.ambr.

      This removes photos only for CAMERA_SINGLELINE models, and the app bundle above says those have no photo capability. That makes it the evidence-backed version of "about 20 product lines" rather than a speculative one. If the wider change is still not wanted in this PR, a model_blacklist: [RoborockProductNickname.QUINN] field on DeviceFeatures is the smallest form that fits the codebase's conventions.

Priority 2 / 3

No findings. The trait-discovery path (roborock/devices/traits/v1/__init__.py:335-340) works with the property through getattr, and there are no protocol changes.

Tests & PR hygiene

  • tests/devices/traits/v1/test_obstacle_photos.py:122-139: the parametrized discovery test with qrevo_2_pro / s7_maxv fixtures is placed and structured well. Keep it when you move to the field, and add a single-line fixture already on main (home_data_device_q_revo.json / pearls) plus a dual-line one, so each camera class is pinned.
  • Local run on 9c16c6f (Python 3.13): pytest 2818 passed / 46 xfailed, 168 snapshots passed; ruff check, ruff format --check and mypy roborock are clean. CI is green.

This is an automated review and can be incorrect, so please reply if any finding looks wrong.

@Lash-L Lash-L added the /review run Code review skill (/review) has been run label Nov 25, 2026
ObstaclePhotoTrait was gated on AIRECOGNITION_OBSTACLE, which single-line
structured-light models (Qrevo 2 Pro, Q Revo, Qrevo S, ...) also report
even though they have no camera to take photos. Add an
is_obstacle_photo_supported DeviceFeatures field gated on the RGB,
double-RGB and dual-line camera product features, and use it for trait
discovery.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hCoureau
hCoureau force-pushed the fix/qrevo2-pro-obstacle-photo-discovery branch from 9c16c6f to 04d5e7b Compare December 5, 2026 00:52
@hCoureau hCoureau changed the title fix: omit obstacle photos for Qrevo 2 Pro fix(v1): gate obstacle photos on camera hardware Dec 5, 2026
@hCoureau

hCoureau commented Dec 5, 2026

Copy link
Copy Markdown
Contributor Author

@allenporter Sorry for the delay in picking this up, and thanks for the detailed write-up. I've redone it the way you suggested:

  • New DeviceFeatures.is_obstacle_photo_supported field, gated on CAMERA_RGB, CAMERA_DOUBLERGB and CAMERA_DUALLINE.
  • ObstaclePhotoTrait.requires_feature now points at it.
  • The model list and the DeviceFeaturesTrait property are gone.
  • Snapshots updated. New tests cover one model of each camera class, plus the Q Revo and Qrevo 2 Pro discovery.

I rebased onto 7.38.0 as a single commit and retitled the PR.

@saruk-vedant heads-up: the scope is wider than the a294-only version you approved. Every CAMERA_SINGLELINE model now loses photos, as the maintainer review asked.

One dependency: adding a gating field exposed a stale-cache bug. Features pickled by FileCache from 7.38.0 come back without the new field, and discovery then raises. The fix is split out as #1100, so please merge that first.

@codecov

codecov Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
roborock/device_features.py 98.10% <100.00%> (+<0.01%) ⬆️
roborock/devices/traits/v1/obstacle_photos.py 85.45% <100.00%> (ø)
tests/devices/traits/v1/test_obstacle_photos.py 100.00% <100.00%> (ø)
tests/test_supported_features.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working /review run Code review skill (/review) has been run V1 V1 platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants