Repository navigation
fix(scenes): return List<SceneOrder> from GET /user/scene/order - #211
Merged
Lash-L merged 1 commit intoOct 30, 2026
Merged
Conversation
The Android app (ISceneApi, GET user/scene/order with homeId and optional
duids) expects ApiReturn<List<SceneOrder>> with
SceneOrder = {"duid": String, "sceneIds": List<Long>}
The server returned a flat list of scene ids, which fails in the app with
"Expected start of the object '{', but had '['".
This is also the shape the cloud returns: the cloud import stores the cloud
response verbatim, so imported inventories hold
[{"duid": ..., "sceneIds": [...]}]. scene_order() ignored those dict entries
(as_int(dict) == 0), and create/delete dropped them when rewriting the order.
- group the ordered scene ids per device in the route response
- read both the cloud object form and the flat form of the stored order
- update the iOS contract fixture's expected get_scene_order response
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Looks correct, TY! |
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.
Related: #189 (same finding on iOS 4.74, reported by mbrunno together with POST persistence)
Problem
The Android app (
ISceneApi) reads the scene order asBoth
ISceneApimethods on this path (with and withoutduids) use this return type. The server returned a flat list of scene ids:{"success": true, "code": 200, "msg": "success", "data": [101, 102]}The app fails with
Expected start of the object '{', but had '['.This is also the shape the cloud returns.
import_web_inventory_from_cloud.pystores the cloud's/user/scene/orderresult verbatim, and an imported inventory containsscene_order()passes each entry throughas_int(), which turns a dict into0. So the imported order was silently ignored.create_sceneanddelete_scenedropped the dict entries whenever they rewrote the order.Fix
scene_order_by_device()groups the ordered ids per device, and the route returns the cloud shape._flatten_stored_scene_order()reads both stored shapes (cloud objects and a flat id list). It is used byscene_order(),create_sceneanddelete_scene.duidsfilter and the homeId check work as before.Contract fixture
tests/contracts/fixtures/ios_app_init_v4_59_02_anonymized.jsonexpected the flat list forget_scene_order. I changed it to the object form. The fixture's expected responses look like server output: for example,post_app_inforeturns{"stored": true, …}, which is not a cloud response. Its seedscene_orderis also a reduced flat list. #189 reports that iOS 4.74 ignores the flat list and falls back to the default order, and that the cloud returns[{"duid", "sceneIds"}]. Please double-check this with an iOS device if you can. I only have Android.Tests
tests/test_scene_order.pyduidsfilter, foreign homeId gives[]delete_scenekeeps the remaining order when the stored order is in cloud formFull suite: passing, with the updated contract fixture.
Live check (Oct 2026): verified together with the other fixes of this series (all based on current
main) against the Android app 4.60.06 and a real Q7 Max (roborock.vacuum.a38). The app called/user/scene/orderand showed the scene tiles in the stored (cloud-imported) order, which the previous code had silently dropped. No errors. iOS not tested.Overlap with #189
#189 proposes the same GET shape and dual-format reading, plus a
POST /user/scene/orderrule that persists the order. If you prefer that patch, this PR can be closed. The Android evidence above still applies to it. Alternatively, this PR is the smaller GET-only subset, and the POST part can follow on top of it.🤖 Generated with Claude Code