Skip to content

Proxy voice pack lists and packages for clients that pass our URL to the robot unchanged - #261

Merged
Lash-L merged 13 commits into
Python-roborock:mainfrom
virtitnerd:work/voice-packages
Nov 28, 2026
Merged

Lash-L merged 13 commits into
Python-roborock:mainfrom
virtitnerd:work/voice-packages

Conversation

@virtitnerd

@virtitnerd virtitnerd commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What and why

The official plugin's voice Language page lists the robot's voice packs and installs one by sending the robot a package URL. With the robot on the local server, the list request and the robot's download both go to cloud hosts that the local setup either answers with nothing or does not resolve. This PR lets the server fetch the list from Roborock, point every package URL at itself, and serve the packages to the robot.

This works for clients that hand the rewritten URL to the robot unchanged, such as LocalRock (installed end to end on an a245, see Testing). It does not make the official app's Language page work: the plugin rebuilds the robot URL as 'https://' + host + voice_pkg_url.split('.com')[1] on Roborock's own res host, which discards our host. Whether the firmware checks the TLS cert or the md5 for a server-hosted URL is unverified.

How it works

  • GET /voice-pkg/info?model=<model> maps the model to the plugin's product bucket (for example roborock.vacuum.a245 to beryllite) and builds the same info path the official plugin uses (/app/<bucket>/voice-pkg/info, the older /<bucket>/app/voice-pkg/info layout for tanos, tanose and the other legacy buckets, and debug/ for v2 to v5 models, which are looked up by their base model id). The model to bucket table comes from the plugin's device configs and follows inherited configs: where a config does not force its own resource bucket, the parent's bucket applies (for example pearleh uses pearle). An unknown model gets a 404.
  • The plugin's own path (/app/<bucket>/voice-pkg/info, with or without debug/) is answered the same way, so a request that reaches the server under the cloud path also works.
  • The list is fetched from the region's app host first (us-app.roborock.com, eu-app.roborock.com, cn-app.roborock.com), then the region's FDS host, in the order of the plugin's areaServerMap. For the a245 the list is only on the app host; the FDS host does not have it.
  • Each voice_pkg_url in voice_list, special_voice_list and factory_test_list is rewritten to <api_url>/voice-pkg/files/<host>/<path>.pkg, using the host the list came from. The original is kept in voice_pkg_source_url, and voice_pkg_md5 is left as is.
  • GET /voice-pkg/files/<host>/<path>.pkg downloads the package from that host once, stores it under <runtime_dir>/voice_pkg_cache/, and serves it to the robot from there afterwards.
  • This hooks into dispatch_plugin_zip_request: a path that is not a plugin zip is offered to the voice handler. Upstream failures become the existing 502 response with route voice_pkg_proxy.

Safety

  • Allowed hosts only. The list is fetched only from the fixed per-region hosts above. Packages are fetched only from the three Roborock app hosts or *.fds.api.xiaomi.com / *.fds.api.mi-img.com, and the path must contain /voice-pkg/, end in .pkg and not contain ... Anything else gets a 403 without a request upstream. Redirects are not followed, so an allowed host cannot send the server somewhere else.
  • Size cap. Lists over 2 MB and packages over 64 MB are refused and not cached. A declared Content-Length over the cap is refused before reading, and the body is read in chunks that stop at the cap.
  • Concurrency. Callers asking for the same package, or the same info path and region, share one in-flight fetch, and cache writes go through a unique temp file plus replace.
  • Loop guard. Upstream requests carry X-RR-Voice-Proxy: 1. If DNS sends the cloud host back to this server, the request with that header gets a 508 instead of being fetched again.
  • Cache. Packages are cached by source URL and written through a temp file, so a failed download leaves nothing behind. The cache keeps the newest 64 packages within 512 MB in total, oldest first, and removes temp files older than an hour. A cache hit that vanishes before it is read is served as a miss. The last good list is kept per path and served (header X-RR-Voice-Cache: stale) when every upstream host fails. Responses carry X-RR-Voice-Cache: hit, miss or stale.
  • A failure answers 502 with voice_pkg_proxy_failed (the plugin proxy keeps plugin_proxy_failed).
  • Like the existing plugin zip proxy, the routes are unauthenticated, and the upstream requests send no account data (no token, no cookies, only a generic User-Agent).

Testing

  • tests/test_voice_pkg_routes.py has 19 tests: model to path mapping (including the ppscouple, rubysc1 and rubyse special cases, the tanos/tanose legacy layout, the inherited buckets, v2 to v5 model strings and an unknown model), list fetched from the region host with URLs rewritten to this server, fallback to the FDS host and then to the cached copy, 502 with no upstream, 404 for an unknown model, a package proxied once and then served from the cache, a package from an unknown host refused, the loop guard, a redirect not followed, the size cap enforced while streaming and from Content-Length, concurrent requests sharing one upstream call, cache eviction, and what the plugin's split('.com') does to a rewritten URL. Full suite on this branch: 521 passed.
  • Live on 2026-11-14 with a Qrevo Curv 2 Flow (roborock.vacuum.a245):
    • The official app reads https://us-app.roborock.com/app/beryllite/voice-pkg/info. Through this route the server returned more than 20 packs with the URLs rewritten to <api_url>/voice-pkg/files/....
    • The German pack (5.7 MB) downloaded through the server, and its md5 matched the list.
    • The robot accepted dnld_install_sound with the server URL, reported progress 100, state 3 and sid_in_use 103 within about 4 seconds, and then switched back to English (sid 3) the same way.
  • Not verified: the official app's Language page (the plugin discards our URL), and whether the firmware checks the TLS cert or the md5 for a server-hosted URL.

Related

LocalRock PR: DonSidro/LocalRock#119 (the app side of the Language page).

@Lash-L Lash-L added area: official-app Official Roborock Android/iOS apps, login and plugins. feature PR adding capability; under this two-type scheme also covers additive documentation. labels Nov 15, 2026

@Lash-L Lash-L 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.

Automated review: changes requested

The proxy itself is safe and the tests pass. It works for a client that calls /voice-pkg/info and passes our URL to the robot unchanged, as in the a245 test via LocalRock, but not end to end for the official app's Language page.

Confirmed:

  • Info path: soundPackageFilePath builds /app/<bucket>/voice-pkg/ or /<bucket>/app/voice-pkg/, adds debug/ for v2–v5, and has the ppscouple/rubysc1 special cases (tanos 411.js:209-225).
  • Install RPC: dnld_install_sound {sid, url, md5, sver}, plus get_sound_progress.
  • Security is fine:
    • The hosts are fixed or allowlisted, and the path must contain /voice-pkg/, end in .pkg and contain no ...
    • Redirects aren't followed.
    • The size caps (2 MB / 64 MB) and timeouts are enforced while streaming.
    • No account data is sent.

Blocking:

  1. The official plugin undoes the URL rewrite. It builds the robot URL as 'https://' + getResHost(true) + url.split('.com')[1] (tanos 2512.js:537, hermes module_3672.js), so our host is discarded.

    • With no .com in api_url, the robot goes to Roborock's res host with the original path.
    • With .com in it, the URL comes out garbled.
    • us-app.roborock.com also isn't in mitm_redirect.py's list, so the official app reads the real cloud anyway.
  2. The legacy layout set is incomplete (voice_pkg.py:102). tanos and tanose also use /<bucket>/app/voice-pkg/ (411.js:217-218), so t6, s6, t7 and a11 get the wrong path.

  3. Buckets are wrong for inherited configs. Where forceRealResource is false or unset, the parent's bucket applies:

    Model Correct bucket Line
    pearleh pearle 44
    vivianf vivian 50
    pandora vivian 57
    pearlfpro viviansc 63
    talcsc tanosslite 86

Should fix:
4. Concurrent requests clash. Two requests for the same package write the same .tmp (lines 256-258), and info cache misses race too.
5. Minor:

  • ru lacks eu-app.roborock.com as its cosHost (line 29).
  • The package cache has no eviction.
  1. Tests: add cases for the tanos/tanose layout, the inherited buckets, and what the plugin's split('.com') does to the rewritten URL.

Unverifiable: whether the firmware checks the local TLS cert or the md5 for a server-hosted URL.

I've converted this PR to draft while these are addressed. Mark it ready for review again once they're fixed and it will go through another review.


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.

@Lash-L Lash-L added the failing auto review Automated review requested changes before merge label Nov 21, 2026
@Lash-L
Lash-L marked this pull request as draft November 21, 2026 16:07
virtitnerd and others added 8 commits November 21, 2026 19:13
…page

GET /voice-pkg/info?model=<model> (and the plugin's own
/app/<bucket>/voice-pkg/info path) fetches the official plugin's voice
pack info file from the region's cosHost, falling back to its FDS host,
and serves the last good copy when both fail. Each voice_pkg_url is
rewritten to /voice-pkg/files/<host>/<path>.pkg on this server, which
downloads the pack once, caches it, and serves it to the robot, so the
robot never needs to reach the cloud host itself.

Model to bucket follows the plugin's device configs. Upstream requests
carry X-RR-Voice-Proxy so a DNS loop back to this server answers 508
instead of recursing. Only allowlisted Roborock and Xiaomi FDS hosts
are fetched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plugin's soundPackageFilePath uses /<bucket>/app/voice-pkg/ for Tanos, TanosE, TanosV, RubyPlus, RubySE and RubySC (p223 L281411-281523). The set was missing tanos and tanose, so t6, s6, t7 and a11 asked for the wrong path.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
createDeviceModelConfig takes bucket = product only when forceRealResource is truthy, otherwise the inherited config's bucket (p223 L281131-281183). PearlEH, VivianF, Pandora and PearlFPro pass false and TalcSC passes nothing, so they use pearle, vivian, vivian, viviansc and tanosslite. Every other inheriting entry passes true and keeps its own product name.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two requests for the same package wrote the same .tmp file and both downloaded it, and concurrent info misses raced on the cache file. Callers with the same key now share one in-flight fetch, cache writes go through a unique temp file plus replace, and the package cache keeps the newest 64 files (hits refresh the mtime) and drops stale temp files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The plugin builds the robot URL as 'https://' + getResHost() + voice_pkg_url.split('.com')[1] (p223 L1318756-1318805), so our host never reaches the robot. Without a .com in our URL it falls back to the original path on Roborock's res host. With one it cuts at the first .com and sends a garbled path. Redirecting us-app.roborock.com through mitm_redirect.py is not a safe fix: the robot resolves that host itself and whether it accepts our TLS certificate or md5 is unverified. Only clients that pass the URL unchanged, such as LocalRock, install from this server. The module docstring and a test now state this.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Eviction can delete a package between the exists() check and read_bytes(). The hit path now reads once and falls through to a download if the file is gone.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
64 files of up to 64 MB each could fill 4 GB, and any client can request packages. Eviction now also drops the oldest packages once the cache passes 512 MB.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The plugin's model list holds <short>v2 to <short>v5 (p223 L280750-280830, concat of prefix, '.', short, 'vN'), but the bucket lookup used the whole suffix, so those models returned unknown and the debug/ path was unreachable.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@virtitnerd

Copy link
Copy Markdown
Contributor Author

Thanks for the careful review. The branch is rebased on current main and the pushed head is 808e282. The full suite passes (521 passed), and tests/test_voice_pkg_routes.py has 19 tests.

Blocking

  1. The official plugin undoes the URL rewrite. Confirmed, and not fixed. The plugin builds the robot URL as 'https://' + host + voice_pkg_url.split('.com')[1], so our host is discarded. I did not try to work around it: the robot resolves the res host itself, us-app.roborock.com is not something I can safely redirect for it, and whether the firmware accepts our TLS cert or the md5 for a server-hosted URL is unverified. So this PR serves clients that pass our URL to the robot unchanged, such as LocalRock, where a voice install on an a245 (Qrevo Curv 2 Flow) worked end to end. It does not serve the official app's Language page. I would like to retitle it to "Proxy voice pack lists and packages for clients that pass our URL to the robot unchanged" and the description now says so. The module docstring says it too, and a test shows what split('.com') does to a rewritten URL (e0877ca).
  2. Legacy layout. Fixed. tanos and tanose now use /<bucket>/app/voice-pkg/, so t6, s6, t7 and a11 get the right path, with a test (f8bd873).
  3. Inherited buckets. Fixed. I traced every inheriting device config: only pearleh, vivianf, pandora and pearlfpro pass forceRealResource as false, and talcsc passes nothing, so exactly your five rows change (pearleh to pearle, vivianf and pandora to vivian, pearlfpro to viviansc, talcsc to tanosslite). All other inheriting entries keep their own bucket. Test added (4ed9a7e).

Should fix

  1. Concurrent requests. Fixed. Callers asking for the same package, or the same info path and region, share one in-flight fetch. Cache writes go through a unique temp file plus replace, so no two writers share a .tmp and the info cache file is never half written. Tests cover four concurrent requests producing one upstream call (2e57b88).
  2. Minor.
    • ru cosHost: not changed. In the plugin's areaServerMap the ru entry is ksyru0-eco.fds.api.xiaomi.com; eu-app.roborock.com is the de cosHost. The current ru host list already matches the plugin.
    • Cache eviction: added. The cache keeps the newest 64 packages (a hit refreshes the mtime) and removes temp files older than an hour (2e57b88). It is also capped at 512 MB in total, oldest first (7c7f4da).
  3. Tests. Added for the tanos/tanose layout, the inherited buckets, what split('.com') does to a rewritten URL, and concurrency and eviction.

Three small fixes I found while rechecking: a cache hit that disappears between the existence check and the read is now served as a miss instead of raising (6af0ca9), and the model lookup accepts the plugin's <short>v2 to <short>v5 strings so those models get the debug/ path (808e282).

Still unverified: whether the firmware checks the TLS cert or the md5 for a server-hosted URL.

I have updated the title and description. I will mark it ready for review again.

@virtitnerd virtitnerd changed the title Pass through the voice pack list and packages for the app's Language page Proxy voice pack lists and packages for clients that pass our URL to the robot unchanged Nov 22, 2026

@Lash-L Lash-L 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.

Automated review: passed (re-review at 808e2826)

Now that this has passed the automated review, I'll do a human review and then either request changes or merge it. It's still a draft, so mark it ready when you're done.

Earlier findings:

Finding Status
The official plugin's split('.com') discards our host Scoped out, and accurately documented in the title, body, module docstring and a test. The official app's Language page still won't use it.
tanos/tanose legacy layout Fixed, and matches 411.js:213-221.
Inherited buckets (pearleh, vivianf, pandora, pearlfpro, talcsc) Fixed, with a test.
Concurrent .tmp clash Fixed. Same-key requests share one fetch, and writes use a unique temp file plus replace.
ru cosHost You were right. The refreshed Hermes bundle has ksyru0-eco.fds.api.xiaomi.com for ru. Our earlier review used the old nonhermes value.
No cache eviction; missing tests Fixed: capped at 64 files and 512 MB, and stale temp files are swept.

Security re-check: still fine.

  • Hosts are fixed or allowlisted.
  • The path must contain /voice-pkg/, end in .pkg, and contain no ...
  • Redirects aren't followed, the size caps are enforced, and there's a loop guard.

Nits:

  • The info cache file is keyed by path only, while the in-flight key includes the region. Add the region to the filename.
  • Corrupt cached JSON makes the stale fallback raise an unhandled error.
  • Files up to 64 MB are read and written with blocking calls on the event loop. Use asyncio.to_thread and FileResponse.

Unverifiable: whether the firmware checks the TLS cert or the md5 for a server-hosted URL.

Checks: all 521 tests pass.


This is an automated review by Claude Code, checked against the decompiled Roborock app (APK + device plugin bundles, refreshed 2026-11-21), python-roborock and a vacuum firmware dump. It can be incorrect, so please reply if any finding looks wrong.

@Lash-L Lash-L added passed auto review Automated review found no blocking issues and removed failing auto review Automated review requested changes before merge labels Nov 22, 2026
virtitnerd and others added 3 commits November 22, 2026 11:14
The in-flight key already included the region, but the cache file name did not, so a stale answer cached for one region could be served for another whose upstream hosts differ.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The stale fallback parsed the cache file without any guard, so a truncated or hand-edited file raised an unhandled error instead of the usual 502. It now reads through a helper that returns nothing for a missing, corrupt or wrongly shaped file, and the original upstream error is raised.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Packages up to 64 MB were read, written and evicted with blocking calls inside the request handler. The writes, the eviction scan and the info cache read and write now run through asyncio.to_thread, and a cache hit is served with FileResponse so the file is streamed rather than loaded into memory.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@virtitnerd
virtitnerd marked this pull request as ready for review November 22, 2026 19:38

@Lash-L Lash-L 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.

Automated review: passed (nits) (re-review at 3d18c5f)

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 (808e282 → 3d18c5f)

Earlier nit Status
The info cache file was keyed by path only, while the in-flight key included the region Fixed (79bb7b1). The file is now info-<sha256("region:path")>.json, and the in-flight key uses the same normalised region (voice_pkg.py:317-325). There is a test for it.
Corrupt cached JSON made the stale fallback raise Fixed (1068169). _read_cached_info returns None for missing, unreadable or wrongly shaped JSON, so the request gets the normal 502 (voice_pkg.py:302-311). There is a test for it.
File IO on the event loop Fixed (3d18c5f). The info cache write, the stale read, the package write and eviction now run in asyncio.to_thread. Cache hits are streamed with FileResponse instead of being read whole into memory (voice_pkg.py:291, 328, 348-359).

Security re-check of the delta. Still fine.

  • SSRF / open proxy: none. Info lists come only from the fixed _REGION_HOSTS, and the path is built from the model table or matched by _INFO_PATH. Packages need an allowlisted host, a path containing /voice-pkg/ and ending in .pkg, and no ... Redirects are not followed (voice_pkg.py:108-113, 122-126, 159, 423-435).
  • Path traversal: none. Every cache filename is a sha256 hex digest, so nothing from the client ends up in a filesystem path.
  • Atomic writes: each write goes to a unique temp file and is then renamed into place, and replacing a file that FileResponse is still serving is safe on POSIX.
  • Memory: a cache hit is now streamed. A miss still buffers up to 64 MB before replying, which is the same as before and acceptable.
  • Auth: the routes are unauthenticated, as for the plugin zip proxy, and no account data goes upstream.

Checked against the app: the info path builder (/app/<bucket>/voice-pkg/ or /<bucket>/app/voice-pkg/) is in hermes tanos module_1568.js:893-896. The voice_pkg_url.split('.com') rebuild onto the plugin's own host, followed by dnld_install_sound {sid, url, md5, sver, ota_url}, is in module_3672.js:1595-1611. Both match what the PR says, including the documented limitation that the official app's Language page does not use the rewritten URL.

Nits (non-blocking):

  1. voice_pkg.py:348-353: the hit path checks the file with os.utime and then returns a FileResponse. Starlette only stats the file when the response is sent. If the file is evicted or deleted in between, the request fails with a 500 (RuntimeError: File at path ... does not exist) instead of being treated as a miss. This window is much smaller than the one 6af0ca9 closed, because a just-touched file is the newest one and is unlikely to be evicted. The new test fakes the failure in utime, so it does not cover this window. Optional fix: have _touch return the os.stat result and pass it as stat_result=, or open the file in the worker thread and stream from that handle.
  2. voice_pkg.py:175-178: _cache_dir() still calls mkdir on the event loop on every request. This is trivial, but it could be done once or moved into the thread helpers.

Tests: the full suite passes on 3d18c5f (523 passed), and it merges cleanly with main. CI is green.


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.

virtitnerd and others added 2 commits November 24, 2026 20:48
The hit path touched the file and then returned a FileResponse, which
stats and opens the file only when the response is sent. A file evicted
in that gap raised instead of falling back to a download. The touch and
read now happen together in one thread call and a vanished file is a
cache miss. Packages are capped at 64 MB and the miss path already
holds them in memory.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
_cache_dir ran mkdir on the event loop for every request. Only the
atomic writer needs the directory, and it already runs in a worker
thread, so the mkdir moves there and lookups just build the path.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@Lash-L Lash-L 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.

Automated review: passed (nits) (re-review at 35f79fa)

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 (3d18c5f → 35f79fa)

Two commits went in after the 01:38Z review. Both only touch routes/plugin/voice_pkg.py and its tests.

Commit What changed Status
1bbf691 A cache hit is now read into memory (_read_cached_package, voice_pkg.py:210-216) and returned as a plain Response (voice_pkg.py:347-353) instead of a FileResponse. This closes the race where eviction could delete the file after the utime check but before FileResponse opened it, which gave a 500. Confirmed. The OSError from a missing file now falls through to a miss and a re-download. test_cache_hit_removed_after_the_touch_still_answers covers it.
35f79fa _cache_dir no longer runs mkdir on every lookup (voice_pkg.py:175-176). _write_atomic creates the parent directory instead (voice_pkg.py:203-207). Confirmed. Both writers (the info cache at :291 and the package write at :219-221) go through _write_atomic. Eviction only runs after a write, so iterdir() never sees a missing directory (:224-228). The info stale read already treats a missing file as no cache (:301-311). There's a test for this too.

Security re-check of the delta. Still fine.

  • SSRF / open proxy: unchanged. The host allowlist, the path checks (/voice-pkg/, .pkg, no ..) and the no-redirect policy are untouched. The cache filename is still sha256(source_url), so there's no path traversal.
  • Auth: unchanged. The route is unauthenticated, like the existing plugin zip proxy, and no account data goes upstream.
  • Secrets in logs: nothing new is logged.
  • Atomic writes: still a unique temp file plus replace. Creating the directory inside the worker thread doesn't change that.
  • Cloud unreachable: unchanged. You still get the stale info, or the 502 voice_pkg_proxy_failed.

Nits (non-blocking)

  1. Memory on cache hits. Hits now load the whole package into memory, up to the 64 MB VOICE_PKG_MAX_BYTES (voice_pkg.py:26, 214), and the hit path is not single-flighted. N concurrent hits mean N copies in memory. Real packs are about 6 MB, so this is fine in practice. Two options:
    • Wrap the hit read in _single_flight(f"pkg:{cache_file}", ...).
    • Open the file handle inside the thread, then stream from that already-open fd. An unlinked file stays readable through an open fd on POSIX, so eviction can't cause a 500 and memory stays flat.
  2. No Range support. Starlette's FileResponse honoured Range; a plain Response does not. If the firmware resumes an interrupted download with Range, it will now get the full body with a 200. Whether the robot sends Range is unverifiable: nothing in vac_firmware/Q7 mentions dnld_install_sound or a resume. The same is already true on the miss path, so this isn't a regression for first downloads.

Re-confirmed claims

  • Scope is still stated accurately. The plugin rebuilds the URL from host + split('.com')[1] (RR_API/nonhermes/com.roborock.tanos/index.android.bundle:2518-2519), so the official app's Language page is still out of scope. Confirmed as documented.
  • Robot-side download behaviour: unverifiable. This covers the TLS cert check, the md5 check and Range. It rests on the author's live a245 test only.

Tests and merge

  • uv run --extra dev pytest -q: 525 passed, including the 2 new tests.
  • git merge-tree merges cleanly against current main (which is 5 commits ahead), #255 and #252.

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.

@virtitnerd

Copy link
Copy Markdown
Contributor Author
  1. Cache hit can 500 if the file vanishes before send (1bbf691). Confirmed: FileResponse only stats and opens the file when the response is sent, so an eviction in that gap raised instead of falling back to a download. Passing stat_result would not close the window, because the open still happens at send time. The hit path now touches and reads the file in one thread call and returns a plain Response. A vanished file counts as a cache miss and is downloaded again. Packages are capped at 64 MB and the miss path already holds them in memory. The new test removes the file right after the real utime call and fails without the fix.

  2. mkdir on the event loop for every request (35f79fa). Confirmed. _cache_dir now only builds the path. The directory is created inside _write_atomic, which already runs in a worker thread. A new test checks that a lookup creates nothing and that a miss creates the directory and the .pkg file.

The full suite passes (525 passed), and tests/test_voice_pkg_routes.py has 23 tests. Cache hits are now served from memory, so Range requests are no longer handled for them; I will note that in the description.

@Lash-L Lash-L 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 @virtitnerd

@Lash-L
Lash-L merged commit 1d437e2 into Python-roborock:main Nov 28, 2026
3 checks passed
@virtitnerd
virtitnerd deleted the work/voice-packages branch November 28, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: official-app Official Roborock Android/iOS apps, login and plugins. feature PR adding capability; under this two-type scheme also covers additive documentation. passed auto review Automated review found no blocking issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants