Skip to content

Enhance cloud-call serialization to prevent active-device races#207

Merged
MTrab merged 1 commit intomainfrom
fix/serialize-cloud-operations
Mar 2, 2026
Merged

Enhance cloud-call serialization to prevent active-device races#207
MTrab merged 1 commit intomainfrom
fix/serialize-cloud-operations

Conversation

@MTrab
Copy link
Copy Markdown
Owner

@MTrab MTrab commented Mar 2, 2026

Summary

  • introduce a coordinator-level async lock and async_execute_cloud_call helper to serialize cloud operations
  • route coordinator polling (cloud.update) and write commands (switch/number) through the same serialized execution path
  • add race-focused unit coverage for serialized cloud calls and update existing write-path/coordinator tests

Why

  • improves robustness in concurrent poll + service-call scenarios where the backend active device context is mutable

Test strategy

  • python3 -m pytest -q tests/test_api_coordinator.py tests/test_write_updates_without_refresh.py tests/test_coordinator_cloud_lock.py

Known limitations

  • serialization is scoped per config entry/coordinator; multiple entries are still independent
  • this change does not alter pywebasto internals, it enforces ordering at integration level

Configuration changes

  • none

@github-actions github-actions Bot added the bug Something isn't working label Mar 2, 2026
@MTrab MTrab removed the bug Something isn't working label Mar 2, 2026
@MTrab MTrab changed the title Serialize cloud operations to prevent active-device race conditions Enhance cloud-call serialization to prevent active-device races Mar 2, 2026
@MTrab MTrab added the enhancement New feature or request label Mar 2, 2026
@MTrab MTrab merged commit 32b4a5d into main Mar 2, 2026
3 checks passed
@MTrab MTrab deleted the fix/serialize-cloud-operations branch March 2, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant