Skip to content

fix: bump pyrate#775

Merged
Lash-L merged 1 commit intomainfrom
pyrate_bump
Mar 1, 2026
Merged

fix: bump pyrate#775
Lash-L merged 1 commit intomainfrom
pyrate_bump

Conversation

@Lash-L
Copy link
Collaborator

@Lash-L Lash-L commented Feb 28, 2026

Done for a request here: home-assistant/core#164133

Replaces: #753

Fixes: #751

Not sure if there is a cleaner way to somehow still support older versions or not. I believe nothing else in core should be requiring under 4.0 now.


Note

Medium Risk
Updates a core dependency and rewires rate-limiting behavior around login and home-data fetches, which could change throttling semantics and user-visible error timing.

Overview
Upgrades pyrate-limiter to >=4,<5 (and updates uv.lock) and adapts RoborockApiClient rate limiting to the v4 API.

web_api.py drops BucketFullException handling and switches to boolean-based try_acquire_async(..., blocking=True, timeout=1) for login and non-blocking try_acquire(..., blocking=False) for home data, raising RoborockRateLimit when acquisition fails. Tests update the skip_rate_limit fixture to mock the new async limiter call via AsyncMock.

Written by Cursor Bugbot for commit ee95225. This will update automatically on new commits. Configure here.

@Lash-L Lash-L requested review from allenporter and Copilot and removed request for Copilot February 28, 2026 17:27
@codecov
Copy link

codecov bot commented Feb 28, 2026

Codecov Report

❌ Patch coverage is 20.00000% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
roborock/web_api.py 14.28% 7 Missing and 5 partials ⚠️
Files with missing lines Coverage Δ
tests/fixtures/web_api_fixtures.py 100.00% <100.00%> (ø)
roborock/web_api.py 52.61% <14.28%> (-0.13%) ⬇️
🚀 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.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Free Tier Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@greptile-apps
Copy link

greptile-apps bot commented Feb 28, 2026

Greptile Summary

This PR upgrades the pyrate-limiter dependency from v3 to v4, adapting the rate limiting implementation to the new API. The main changes include:

  • Removed BucketFullException import and exception handling pattern
  • Removed max_delay parameter from Limiter constructor (deprecated in v4)
  • Changed rate limiting from try-catch pattern to checking boolean return values of try_acquire and try_acquire_async
  • Updated login rate limiting to use blocking=True, timeout=1 for async operations
  • Updated home data rate limiting to use blocking=False for non-blocking immediate checks
  • Updated test fixtures to properly mock the new API with AsyncMock

Important verification needed: The new timeout=1 parameter should be confirmed to be in seconds (matching the old max_delay=1000 milliseconds behavior). Based on standard Python async conventions, this appears correct, but it's worth verifying against the pyrate-limiter v4 documentation since the PR author expressed uncertainty about the migration approach.

Confidence Score: 4/5

  • This PR is generally safe to merge with minor verification recommended
  • The migration to pyrate-limiter v4 is well-executed with appropriate API changes, updated tests, and consistent error handling. The score is 4 instead of 5 because: (1) the PR author expressed uncertainty about the migration approach, and (2) the timeout parameter semantics should be verified to ensure the rate limiting behavior remains equivalent to v3
  • Verify roborock/web_api.py timeout parameter semantics match expected behavior

Important Files Changed

Filename Overview
pyproject.toml Updated pyrate-limiter dependency from v3 to v4 (>=3.7.0,<4 → >=4.0.0,<5)
roborock/web_api.py Migrated rate limiting to pyrate-limiter v4 API; removed BucketFullException handling, updated to use boolean return values with blocking and timeout parameters
tests/fixtures/web_api_fixtures.py Updated test fixtures to mock new pyrate-limiter v4 API with AsyncMock for try_acquire_async
uv.lock Lock file updated to pyrate-limiter 4.0.2 (previously 3.9.0)

Last reviewed commit: ee95225

@Lash-L Lash-L merged commit 57083ab into main Mar 1, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to pyrate-limiter 4+

2 participants