Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved product-ID collisions and model-ID mismatches can serve the wrong or Android-only plugin, while the documented raw user-data import fails because it omits the username override.
4 open issues
What changed in this PR
Expands the local server’s Android device-plugin fallback beyond three models, building on #288’s requested-product filtering and #224’s cloud-import support.
Changes:
- Adds a generated EU catalog containing numeric IDs for 81 models and 79 Android plugin records, plus a refresh script.
- Prioritizes imported product IDs and plugin records, with catalog fallback and a cross-region model guard.
- Adds tests for ID precedence, plugin selection, catalog consistency, and refresh generation.
| File | Description |
|---|---|
tests/test_refresh_device_plugin_catalog.py |
Tests bulk fetching and sorted catalog generation. |
tests/test_product_response.py |
Tests product-ID precedence and end-to-end plugin lookup. |
tests/test_plugin_routes.py |
Tests filtering, snapshot precedence, and fallback guards. |
src/roborock_local_server/bundled_backend/shared/device_plugin_catalog.py |
Loads built-in model IDs and Android plugin records. |
src/roborock_local_server/bundled_backend/shared/device_plugin_catalog.json |
Supplies generated EU product and plugin data. |
src/roborock_local_server/bundled_backend/shared/constants.py |
Removes the three-model ID overrides. |
src/roborock_local_server/bundled_backend/https_server/routes/plugin/common.py |
Replaces hardcoded plugin records with catalog data. |
src/roborock_local_server/bundled_backend/https_server/routes/api/v1/appplugin.py |
Filters requested IDs and guards catalog fallback. |
src/roborock_local_server/bundled_backend/https_server/routes/api/product_service.py |
Resolves IDs using import, inventory, catalog, then hash. |
src/roborock_local_server/bundled_backend/https_server/endpoint_rules.py |
Updates the legacy product builder to use catalog IDs. |
scripts/refresh_device_plugin_catalog.py |
Rebuilds the bundled catalog using a cloud login. |
Review effort: Balanced
9ba0071 to
dee8f75
Compare
|
I pushed fixes for the four review findings. Beyond them, 85740de and dee8f75 make the catalog regional. The plugin files differ by region, so the server merges the catalogs of all regions per model. A model takes its record from the catalog of the server's region first, then from the EU catalog, then from the other catalogs. The server's region is the region of the cloud import, else |
…cloud import Without a cloud import, the server knew the numeric product id and the Android plugin record of three models only (a87, a15, sc05). Every other model got a hashed product id in /api/v5/product, and /api/v1/appplugin had no record for it. The new shared/device_plugin_catalog.json holds the EU cloud's numeric product id of 81 models in five categories, and the Android plugin record of the 79 products that have one. It replaces MODEL_PRODUCT_ID_OVERRIDES and the hardcoded APPPLUGIN_LIST. scripts/refresh_device_plugin_catalog.py rebuilds it with any cloud login, in two requests. /api/v5/product takes the product id from the account's cloud import first, then a numeric id in home data, then the catalog id of the model, then the hashed id. Product ids differ by cloud region, so the import's id now also wins over the old hardcoded ids. Before, the a87 got 110 even with an EU import, and in the EU cloud 110 is the Zeo Lite washer (roborock.wm.a91). Without an import, the a87 now gets the EU id 103. /api/v1/appplugin answers the catalog records for the product ids that the cloud snapshot has no record for, like the built-in list before. It skips an id that the cloud import gives to another model than the catalog does, because that record would be the plugin of another model.
…ogin A raw user data file has no username, and the import helper needs one. The refresh script did not pass --email on, so --source-json with raw user data failed with "Username is missing". It now passes the email as the username override, and the help text says so.
…model The local /api/v5/product gives a model the id of the cloud's product list, but the import fetched the plugins by the numeric home data id. If the two ids differed, the snapshot had no record for the id that the app requests, and the app got the Android-only built-in record, also on iOS. The import now takes the product list id of each model first, then the numeric home data id, like /api/v5/product.
Product ids differ by cloud region, so a built-in record looked up by its EU id could be the plugin of another model, like the washer record of 110 for an a87 with a US import. /api/v5/product now resolves the ids of all home data products in one helper: the import's id, then a numeric home data id, then the built-in id if no other model holds it, then the hashed id. For an id that the snapshot has no record for, /api/v1/appplugin answers the built-in record of the model that gets the id, with the requested id. An id that no device has, or that two models get, gets no record.
The built-in catalog is now one file per cloud region, shared/device_plugin_catalog_<region>.json, and the current one is the EU catalog. The server takes the region of its cloud import: the region of meta.base_url, else the region in the user data. Without an import, or if the import's region is unknown, it takes network.region from the config. The id resolution and the plugin lookup by model use the catalog of that region. A region without its own catalog uses the EU catalog, so a device gets the EU record of its model. The refresh script writes the file of the region. It takes the region from the cloud host, or from --region for an unknown host.
…errors Two devices of one model get one product id, and the id still gets the plugin record of the model. A shared device gets its built-in id and record from both inventory spellings of the shared device list. A failed product or appplugin request in the snapshot falls back to the built-in id and record. The import stores the error of a failed product list and fetches the plugins by the numeric home data id, if there is one.
…odel A model that the catalog of the server's region lacks now takes its record from the EU catalog, then from the other catalogs by region name. Before, the server used one catalog only, so such a model got no plugin. The id comes from the same catalog as the record. If an earlier catalog gives that id to another model, the model gets a hashed id, and /api/v1/appplugin still finds its record by model. Only the EU catalog exists so far, so nothing changes yet.
dee8f75 to
046a0ed
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved plugin ID collisions can cause /api/v1/appplugin to serve the wrong model’s plugin when product catalog retrieval fails or an inventory ID conflicts with a snapshot mapping.
2 open issues
4 resolved since last review
Review effort: Balanced
/api/v1/appplugin matches a snapshot plugin record by its product id alone. If the record's device has left the inventory or has not paired, no model holds that id. Another model then got the id as its built-in id, and the app installed the record's plugin for it. For example, a US import stored the a199 plugin at 199. The EU catalog gives 199 to the a226, so an a226 got 199 and the a199 plugin. This happens if the import has no product list. Imports before Python-roborock#224 stored none, and neither does an import whose product list request failed. Such an import fetched the records by the numeric home data ids. The record now holds its id for the model that the snapshot's home data names, else for an unknown model. A paired device of the named model keeps the id and the record. The iOS test fixture gets the product list of a current import, because a real import never writes records without home data.
There was a problem hiding this comment.
🔵 Needs a closer look
Replacing non-EU plugin binaries with EU fallbacks leaves cross-region runtime compatibility unverified, requiring human review or representative non-EU on-device validation.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
Lash-L
left a comment
There was a problem hiding this comment.
Automated review: passed (nits)
Now that this has passed the automated review, I'll do a human review and then either request changes or merge it.
What was checked
- The data in
device_plugin_catalog_eu.jsonmatchesRR_API/hermes/update_manifest.json(the EU product list): all 81 models have the same numeric ids, with no differences. The manifest also backs up the PR's claims. In the EU list, 103 is the a87 and 110 isroborock.wm.a91. In the US list, the a87 is 110, and 199 is the a199 (185 in the EU, where 199 is the a226). 53 models have different ids in the two regions, so looking records up by model and not by id is the right design. - The app gets its product list from
GET /api/v5/product(theProductServicein the bundled feature plugins of the 4.64.06 APK). The part of the app that calls/api/v1/apppluginis not in the decompiled sources, so the claim that the app sends back the id from/api/v5/productcan't be checked here. - SSRF / open proxy: this PR adds no new outbound fetches at runtime. Every catalog URL still goes through
proxied_plugin_records, then through the existing host allowlist inis_allowed_plugin_source(https only). The catalog's hosts areapp-files.roborock.com(51 records),files.roborock.com(9) andcdn.awsde0.fds.api.mi-img.com(19). The last one is allowed by the.fds.api.mi-img.comsuffix rule, so the EU mirror URLs (for example the a15) still go through the proxy. The proxy, its cache file name (a sha256 digest, so no path traversal) and its write through a temp file are unchanged. - Auth: this PR adds no new route.
/api/v1/apppluginand/api/v5/productkeep their current access rules. The data they answer is the public plugin catalog. - Stacking: this PR is not stacked on #292. They share no commits. Both PRs edit
shared/constants.pyin hunks next to each other (this one removesMODEL_PRODUCT_ID_OVERRIDES, and #292 addsREGION_COUNTRYright after it), sogit merge-treereports a conflict. Whichever PR is merged second needs a small rebase.
Nits
https_server/endpoint_rules.py:508: nothing calls_build_product_response./api/v4/productand/api/v5/productboth useproduct_service.build_product_response. This PR updates both copies. Delete the unused one, so a later id change can't update only one of them.- Each
/api/v1/apppluginrequest with ids now reads and parses the cloud snapshot JSON several times on the request path: inserver_cloud_region(routes/plugin/common.py:124), insnapshot_plugin_records, insnapshot_plugin_catalog_data, insnapshot_plugin_record_ownersand insidehome_payload. It also rebuilds the merged catalog incatalog_for_region(shared/device_plugin_catalog.py:71)./api/v5/productdoes most of this too. With a large snapshot, this blocking IO slows the event loop. Suggestions: cachecatalog_for_regionper region (the catalog files are fixed at import time), and load the snapshot once per request and pass it down. scripts/refresh_device_plugin_catalog.py:106: if/api/v1/apppluginanswers something other than a list (an error dict, for example),records or []keeps no records. The script then writes a catalog with no plugin records, without an error. It writes the file in place (line 156), so a crash in the middle leaves a truncated JSON file. The server reads everydevice_plugin_catalog_*.jsonat import time, so it would then fail to start. Fix: raise an error when the answer is not a non-empty list, and write to a.tmpfile first, thenreplace()it.shared/device_plugin_catalog.py:147and:163: a numeric home-data id (fixed_id) is used without checkingholders. If an inventory from an older version still has a numeric id that the import's product list gives to another model, two models share that id. The built-in fallback then refuses the id (correctly), but the snapshot records still match the id alone. Real imports probably can't produce this (see the earlier Copilot thread). A one-line comment, or the sameholderscheck for numeric home-data ids, would make it safe.- Release note: imports made before this PR fetched the plugin records by the numeric home-data id. A model whose product list id is different now falls back to the EU built-in record until the user runs the import again. It is worth telling users who imported before this PR to run the import again.
This is an automated review by Claude Code, checked against the decompiled Roborock app (APK + device plugin bundles), python-roborock and a vacuum firmware dump. It can be incorrect, so please reply if any finding looks wrong.
Nothing called _build_product_response in endpoint_rules.py. /api/v4/product and /api/v5/product both use product_service.build_product_response. The two helpers of the copy have their used versions in routes/user/homes/service.py. So a later change of the product ids has one place to go.
…talog atomically If /api/v1/appplugin answered something other than a list of records, refresh_device_plugin_catalog.py wrote a catalog without plugin records and reported no error. It also wrote the file in place, so a crash left a truncated file, and the server failed to start on it. The script now raises an error if the answer has no record. It writes a .tmp file first and replaces the catalog with it. A failed write removes the .tmp file, so a package build can't ship it.
catalog_for_region merged the catalogs of all regions on each call, and /api/v1/appplugin and /api/v5/product call it on every request. The catalog files load at import time and do not change at runtime. So the merged catalog is now cached per region. Tests that swap a region catalog also swap the cache.
A numeric home data id can only be the import id of another model if the inventory and the import come from different regions. The comment says so, as the review asked.
|
Thanks for the review. I addressed the nits in four commits:
|
Lash-L
left a comment
There was a problem hiding this comment.
Automated review: passed (nits)
Now that this has passed the automated review, I'll do a human review and then either request changes or merge it.
Since the last review (57c3634 → ca3df62)
- Unused
_build_product_responseinendpoint_rules.py: fixed (4d1d8b8). It is gone with its two helpers and the test variants that called it./api/v4/productand/api/v5/productnow have one builder,product_service.build_product_response. - Repeated work on the request path: partly fixed (a7b07e8).
catalog_for_regionnow caches the merged catalog per region in_MERGED_CATALOGS. That is safe, becauseCATALOGSis fixed at import time and every caller copies a record before changing it (dict(record, productid=...)inappplugin.py,dict(record)inproxied_plugin_records). The snapshot is still read and parsed several times per/api/v1/apppluginand/api/v5/productrequest. Deferring that to a follow-up is fine. - Refresh script writing an empty or truncated catalog: fixed (ba13a53).
fetch_cloud_answersraises when/api/v1/apppluginreturns no dict record.write_catalogwritesdevice_plugin_catalog_<region>.json.tmp, then callsreplace(), and removes the.tmpfile if that fails. The server's globdevice_plugin_catalog_*.jsondoes not match the.tmpname. The tests cover both. - Numeric home-data id skipping the
holderscheck: addressed with a comment (ca3df62). The comment is accurate. The id of an import's product list is used first for every model in that list, so the two ids can only clash when the inventory and the import come from different regions. - Release note about running the import again: done in the PR body.
Conflicts: rebase needed
GitHub shows this PR as conflicting with main. git merge-tree finds two conflicts:
shared/constants.py: main addedREGION_COUNTRY/region_country()right afterMODEL_PRODUCT_ID_OVERRIDES. Keep main's additions and dropMODEL_PRODUCT_ID_OVERRIDES.https_server/endpoint_rules.pyimports: main moved todefault_timezonefromshared.data_helpers(#294), andDEFAULT_TIMEZONEis no longer imported there. Once_build_product_responseis gone, the imports should befrom shared.constants import DEFAULT_HOME_NAME, DEFAULT_PRODUCT_SCHEMAandfrom shared.data_helpers import as_bool, as_int, default_home_id, default_product_name, default_timezone, get_value.stable_intandMODEL_PRODUCT_ID_OVERRIDESare no longer needed.
product_service.py, data_helpers.py, the importer and tests/test_product_response.py merge cleanly. The merged build_product_response keeps main's "agreements": product_agreements() (#292) next to resolve_product_ids. With the two conflicts resolved as above, the full suite passes on the merge result (917 passed). On the PR head alone, 797 pass.
The two PRs fit together. #253 (now on main) refreshes the plugin catalogs through _fetch_plugin_catalogs, which calls _plugin_product_ids. With this PR, that refresh fetches the records by the product-list id too. So an admin Refresh plugins (POST /admin/api/cloud/refresh-plugins) should be enough for users who imported before this PR, and they don't need a full re-import. Consider mentioning that in the release note.
Overlap with #208
#208 (scene tiles) conflicts with this PR in routes/api/product_service.py and tests/test_product_response.py. #208 reads snapshot_plugin_catalog_data(ctx, "product") inline in build_product_response, and this PR moves that read into _served_products. Whichever is merged second has to read the cloud product payload once in build_product_response. It then passes the payload to _cloud_product_details (#208) and gets the ids from _served_products / resolve_product_ids (this PR). The two don't clash in behaviour: #208 also looks up productTags by model, not by id. #208 is also behind main's product_agreements() change.
Nits
shared/device_plugin_catalog.py:71:_MERGED_CATALOGSis a module-level cache keyed by region. A test that changesCATALOGShas to reset the cache too. Two tests already do this (tests/test_product_response.py:482,:531). A small_reset_merged_catalogs()helper, or a fixture, would keep a future test from picking up a stale merged catalog.- The snapshot is read several times per request (item 2 above). Still open, and fine as a follow-up.
Device compatibility remains unverified for serving an EU-hosted plugin record to a server in another region. The PR already says so.
This is an automated review by Claude Code, checked against the decompiled Roborock app (APK + device plugin bundles), python-roborock and a vacuum firmware dump. It can be incorrect, so please reply if any finding looks wrong.
|
Can you Fix conflicts? @Hoeze |


What does this PR do?
Without a cloud import, the server now answers the right Android device plugin for every model in the Roborock cloud's product list, not only for the a87, a15 and sc05. The data is a generated JSON file with the cloud's numeric product ids and plugin records. A script rebuilds it with any cloud login.
Problem
The app requests its device plugin with the numeric product id from
/api/v5/product. With a cloud import, #224 takes that id from the import. Without one, the server knew the id for three models only, throughMODEL_PRODUCT_ID_OVERRIDES. Every other model got a hashed id, for example 659231 for the a307, and the hardcodedAPPPLUGIN_LISThad no record for it. So a scratch-onboarded server could not serve the plugin of most models.Change
bundled_backend/shared/device_plugin_catalog_eu.jsonholds the numeric product id of 81 models and the Android plugin record of 79 products, from the EU cloud. The file records the cloud base URL, the region and the fetch time.bundled_backend/shared/device_plugin_catalog.pyloads everydevice_plugin_catalog_<region>.jsonand merges them per model. It replacesMODEL_PRODUCT_ID_OVERRIDES, andAPPPLUGIN_LISTnow holds the EU catalog records. The merged catalog is built once per region.resolve_product_ids, gives each product its numeric id, for/api/v5/productand/api/v1/apppluginalike. The order: the id from the account's cloud import (fix(plugin): resolve string product ids and serve the iOS app plugin #224), a numeric id from the inventory, the catalog id of the model, and the hashed id as before. A model gets its catalog id only if no other model on the server holds that id. A snapshot plugin record also holds its id, for the model that the snapshot's home data names. So each id belongs to one model, and the record of a device that has left the inventory never reaches another model./api/v1/apppluginkeeps the rules of fix(plugin): answer /api/v1/appplugin with the requested products only #288. For each requested id, it takes the snapshot's records. Otherwise, it finds the model that has the id, and answers that model's catalog record, withproductidset to the requested id. An id without a model, or with two models, gets[]./api/v5/productsends. Before, it used the numeric home-data id, so a different id left the imported plugin unused.scripts/refresh_device_plugin_catalog.pyrebuilds a regional file. With--source-jsonand raw user data, it takes--emailas the username. It stops with an error if/api/v1/apppluginanswers no record. It writes a.tmpfile first, so a crash keeps the old catalog, and a failed write removes the.tmpfile.endpoint_rules.pyloses_build_product_response. Nothing called it, because/api/v4/productand/api/v5/productuseproduct_service.build_product_response.Ids, models and regions
The app takes the numeric product id from the server's
/api/v5/productand sends it back to the server's/api/v1/appplugin. The cloud never sees it. So the ids only have to agree inside the server: each id belongs to one model, and the answer for an id is that model's plugin. The ids differ by region: the a199 is 199 in the US and 185 in the EU, and 199 is the a226 in the EU. That is why this PR looks up catalog records by model and not by id. A US import and the EU catalog can then never hand a device another model's plugin.The plugin files differ by region too, because each region hosts its own. For the a87 and the a15, the old built-in records (US hosts) and the EU records have the same versions (6058 and 5208), but different files. The sc05 differs (90 against 108). So the server merges the catalogs of all regions per model. A model takes its record and its id from the first catalog that has a record for it: the catalog of the server's region, then the EU catalog, then the other catalogs by region name. The server's region is the region of the cloud import (
meta.base_url, else the account's region), elsenetwork.region. An earlier catalog may give the same id to another model. Then the model gets a hashed id, and it still gets its record. Only the EU catalog exists so far. So a server in another region gets the EU record of the same model, which is unverified. Without the catalog, that device would get[]. A catalog for another region needs only a run of the refresh script with an account there.robot.vacuum.cleanerroborock.wetdryvacroborock.mowerroborock.wmroborock.mowbsThe two models without a record are
roborock.mowbs.a355androborock.mowbs.a384(WiFi Amplifier Charging Station). A second request with only their ids also answered no record.The data comes from the EU cloud (
https://euiot.roborock.com), with an account that owns no devices. The product list came fromGET /api/v5/product. The records came from onePOST /api/v1/apppluginrequest with{"type": 2, "apilevel": 10046, "productids": [all 81 ids]}, which is the body of the Android app 4.60.06.Changed behavior
roborock.wm.a91). With both ids in one list, two models would share 110. The a87 record keeps version 6058./api/v5/product, which lists the paired devices.roborock.vacuum.s6) instead of the a87 record.APPPLUGIN_LIST. The iOS records of fix(plugin): resolve string product ids and serve the iOS app plugin #224 still come from the snapshot. fix(plugin): answer /api/v1/appplugin with the requested products only #288's comment on Android zips for iOS requests still applies.How to refresh the data
Any Roborock account works, also one without devices:
The script asks Roborock for a login code and reads it from the terminal.
--source-jsonreuses a stored login in the formats thatimport_web_inventory_from_cloud.py --source-jsonaccepts.--base-urlselects another region. The script takes the region from the cloud host, or from--region, and writesdevice_plugin_catalog_<region>.json. It makes two cloud requests, writes only the catalog, and prints the models without a plugin record.Open question: rriotids differ from
product_catalog.jsonThe EU cloud gives every model a different rriotid than
product_catalog.json. All 51 models that both lists have differ, and none match. So the rriotid seems to depend on the cloud region, andproduct_catalog.jsonlikely comes from another region. The numeric ids partly agree: the a15 (23) and the sc05 (10001) match the old overrides, and the a87 does not (110 against 103).This PR leaves
product_catalog.jsonas it is. Onboarding stores the catalog rriotid, and/api/v5/productanswers the same value, so the app still joins device and product. The server uses the numeric id only between its own/api/v5/productand/api/v1/appplugin. Without an import, these ids only need to agree with each other. With an import, the import's ids win, and the guard keeps the two id spaces apart.Models in only one of the two lists:
product_catalog.json:roborock.vacuum.a140,roborock.vacuum.a246,roborock.vacuum.a34.roborock.vacuum.a226,roborock.vacuum.a232,roborock.vacuum.a328,roborock.vacuum.a389,roborock.vacuum.a62.All 51 rriotid mismatches
product_catalog.jsonroborock.vacuum.a085PHxDTl0lbtWBEi22ov6hj6t5OGALwYyq9vFnl62BYuWroborock.vacuum.a104StIrRPopvz0ZzPN2o1sWy7ggJhlYqQs58zKFAOgBPc1roborock.vacuum.a1013rMctAN2h7gewWfZgLNOdz2MFSO1n8JFiRfv62xlADmhroborock.vacuum.a1047AQWqICyaBLKFcOiDtu8kyZfkRY1ldQav0ZV7HwEng3roborock.vacuum.a1173hVxBJoGbDP2kv93Pcc1pb2hQn0JzHiNQ35vO5ivl8b3roborock.vacuum.a12315zrEeDGib2Rn15gviBrvv7S6884nZ0mDrq7kp19RZ3proborock.vacuum.a1252BNKSSVJ0bsXHxTH3KLi6H4Xf12di720F6qesRKfycCAroborock.vacuum.a1353D9rSKoTaOfI0gcf6zcbdufbns45APpnI0M72jVDwd9roborock.vacuum.a1445OY3uePAU3xCcBKUfFxcED2p7GFUkE4SOOSIO5HfDQpSroborock.vacuum.a147585rv0Obq0bq7yzrcmEdVf1KtYm84Say3qrqaqNAWebEroborock.vacuum.a151YYW18rpgyAJTISwb1NM914oT3mL3dB7GpIS77ZADOLsroborock.vacuum.a156g0hm04CP4C1iT8sS0Bnpn6IApKn1vVzqlFpLYe0LFaQroborock.vacuum.a1592j5VnNUMBJLRelsHF7Njmg6GyGRYzZqDFUCSYVPRgzcHroborock.vacuum.a1684ERRv6L8uw8POy0ueLjFxjpbz98A77my6QRtHQskKdzroborock.vacuum.a1707M4dAzHEgGusWLXkvgbLbL4oVepXHU3bW0MB4kRHnOWmroborock.vacuum.a179h53cll17CJO53LaiWx3vd4Ov5HOF4DSflrFPHptk0w7roborock.vacuum.a1856O6vtRc0hqwOUrgCla43LY6GGPVYxOuz6vbimp0SVp5wroborock.vacuum.a1872CjvhDFL7Q9NdJQmhE86zn7gkjgsDwbTIwhqpDKoETBiroborock.vacuum.a195fLhydOIblbngogVGdU8Jw497pdG4KW89b2fXwXXbAp9roborock.vacuum.a1975BvMJHXT8IKv4x4l0LU0er5ha5sFvFvdITRP5QUAJXtaroborock.vacuum.a1993PWf17rt73QjM3F1DaZelu52SDKUl9N1mAqUTUlVlBnkroborock.vacuum.a2053oaoyfO05M0tZoOXvtH2v65AyfS82NRjCTWyqaZ33iOFroborock.vacuum.a211Gc3InagdnSm1JPhQ7TPiU7XJg0gp4iNM0FDtdcLl48droborock.vacuum.a24564Pgg7cwjxHqT2qQrEh7Ib35UTzLf1vJNv8ZUV67TcNCroborock.vacuum.a273FvTMilsXUPmxlqAeOsIrB42yfoQm5eOY3gARZw6xgUroborock.vacuum.a2791yhOql5rqTWqyFtU4dg8O92TbfeYcHq0FOyKskAVGTHvroborock.vacuum.a2881KuWrSJHhHe7lOvyuefM7x3eizObJLFvPAxXvdW96ftdroborock.vacuum.a29472bzD7888QqxdmRHNA74E7aZagb9tLAoAq2UbmGnFx0roborock.vacuum.a296RzNz70g002C6hAyIppc9Q3PlD6TMLNY5LwI8kwxntCLroborock.vacuum.a2986Thza6zTK1AHOYGiNPugak3KsqEpbY6FTrU4mKH46SmBroborock.vacuum.a301v5nXqpWY8FiCfmsoIApP7tvrfviO3uXoYL72vcXYOsroborock.vacuum.a3074J89YHjAc2uUG9W0HLxKPP2Rr24hQJmvHyJzqB7ljK2yroborock.vacuum.a3264Snq4xVLaWSyq2PjbSGV1j6HlbEc7sRDfEaxFEwBeHJGroborock.vacuum.a3863dnvWbeJYQ09VhrqvUJ4g7kamVau2Xpgoj0dCdS7230roborock.vacuum.a40uqdBrJSn1yke0E5AayqmE40NMBhdhC1ML9ptLiMIC2Troborock.vacuum.a512LwHTkAMUb3RKxUBFvQzgM1YHt9M9RESPHmiQFrrPw1Sroborock.vacuum.a651jWVq0qkthUqXggImMutvrsFW9mQ4M0YyE8OptxSbmGroborock.vacuum.a705sYzP4uUXS6dTMZPoTakvU2rqIfLiubPlddpYoWfBTl7roborock.vacuum.a721yyDvxjxA23iHkUtnq6k5D5ZuoVsCgt96KKxvDKCGEHeroborock.vacuum.a731y5FvZEz6L6rtsFcFwWuGH6cwszeXau9M2YrquXiSjJdroborock.vacuum.a751JaaBKwzW2RFF9XZmH04TJldHlB6hwVPMvdm6AdkxJvroborock.vacuum.a875gUei3OIJIXVD3eD85Balg7HYigCZR9rr0vBtYPvch90roborock.vacuum.a954CO3m8q3uF1h9s7n1FQ3dm2YRm17wk0BaK6uu8bI1aKNroborock.vacuum.a97FI9ykCmTQOgMLP1i1Xyww1vbAfJdO7IlyJyRGRfMQvroborock.vacuum.s4NYgv2MvTxT7UjaAS0ujPh6kmXQYR5B2Canw2AuscVNOroborock.vacuum.s5e73EnOOM2NhDujvnvb7hvvv42qYXusGAhtBh5L2Sa4SMVroborock.vacuum.s67G2eVYbclOehHcpTf7P2mF2ttN5avau73W2bjOwzn71aroborock.vacuum.sc016yaImeCA2aoQAJQ5aAvwKD1Wl34RgS6nWzI4LewgdLWKroborock.vacuum.sc055ayEx3aKgStqZZ0v5IpMBP4qmLTqSG6Tb0WbnVhU0dfXroborock.vacuum.ss071O9BlCxWe4loekRE624qPv3gKDz7BnDrjXOVBAEXj4uwroborock.vacuum.ss095SmbDEjAG5fpNlETF3jGK037p53dchJVjuUzqRopp3gbRelated
REGION_COUNTRYtoconstants.py, right next toMODEL_PRODUCT_ID_OVERRIDES, which this PR removes. fix(devices): default the device time zone to the server time zone #294 edits the same import line ofendpoint_rules.pyas this PR. Whichever lands second needs a small rebase.appplugin.py,product_service.pyand the tests.Before you open this PR (optional, but very helpful)
PRs I reviewed:
Proof that it works
Tested on:
roborock.vacuum.a307)02.17.50a307-pluginbranch. That build is upstream main 2069fc7 plus this PR, my other open PRs, feat(api): enable scene tiles via productTags and category cardSpec #208 and one more a307 fix. The tests ran on this branch, rebased on upstream main f1e49fd.What I did and what happened:
On main, the a307 gets the hashed id 659231. No plugin record has that id, so the a307 gets no plugin. Before #288, the app installed the a87 plugin instead and crashed.
After the deploy, the app requested its plugin with id 263. The server answered exactly the a307 record of the catalog (version 7046). The a307 opened, and its map loaded.
The fixes for the review came after this device test. My server has no cloud import and an EU config, so they leave its path unchanged: the a307 still gets 263 and the same record.
Tests:
tests/test_plugin_routes.py:tests/test_product_response.py:/api/v5/product. An unknown model keeps the hashed id. A numeric inventory id wins over the catalog id. The import's id wins over both./api/v5/product, and/api/v1/apppluginwith that id answers exactly the a307 record.productid110. An a87 that keeps a numeric 110 without a snapshot also gets the a87 record, and never the washer's.[].meta.base_url, the account's region or the config. A US server takes a model from a US catalog first, then from the EU catalog, then from the other catalogs by region name. A record wins over an id without a record. An id that an earlier catalog gives another model becomes a hashed id, and the model still gets its record.receivedDevicesorreceived_devices, gets 263 and its record.tests/test_refresh_device_plugin_catalog.py: the script asks for all ids in one request and writes a sorted catalog with its region. Raw user data with--emailgets that username. An answer without a record stops the script. The catalog file is replaced, and a failed write keeps the old file and leaves no.tmpfile.tests/test_cloud_plugin_catalogs.py: the a307 at 4242 in home data and 263 in the product list fetches the plugin for 263. If the product list fails, a string id stores an error and requests no plugin, and a numeric home-data id is still fetched.uv run --extra dev pytest -qpasses (797 tests).uvx ruff checkreports no new findings on the changed files.Screenshots (required for any UI change)
No UI changes.