Skip to content

fix(client): 🐛 write RMW results back into the register cache - #62

Merged
svasek merged 1 commit into
mainfrom
fix/rmw-cache-writeback
Aug 25, 2026
Merged

fix(client): 🐛 write RMW results back into the register cache#62
svasek merged 1 commit into
mainfrom
fix/rmw-cache-writeback

Conversation

@svasek

@svasek svasek commented Aug 25, 2026

Copy link
Copy Markdown
Owner

🐛 What

Three client setters perform a read-modify-write against self._cached_result but never store the new value back into it. The cache is refreshed only by async_read_all, so two writes into the same shared register within one poll window make the second write start from the stale word and drop the first change.

Concrete failure: turn the hydrolysis cover-reduction flag on, then the high-temperature shutdown flag on before the next poll. Both live in the same register. The second write reads the pre-first-write value from the cache, ORs in only its own bit, and writes a word that has the first bit cleared.

🔧 Changes

  • 🩹 async_set_bitmask_flag, async_set_masked_register, and async_set_filtration_speed now write the new value back into _cached_result after a successful write, so back-to-back writes stay consistent until the next full poll refreshes the cache with device truth.
  • ✅ Add a regression test per affected setter asserting the cache is updated and a second consecutive write into the same register preserves the first change.

✅ Verification

  • pytest 659 passed, 100% coverage
  • ruff check / ruff format --check clean
  • basedpyright 0 errors

- async_set_bitmask_flag / async_set_masked_register / async_set_filtration_speed
  performed a read-modify-write against _cached_result but never stored the new
  value, so a second write into the same shared register within one poll window
  started from the stale word and dropped the first change
- write the new value back into _cached_result after a successful write so
  back-to-back writes stay consistent until the next full poll refreshes it
- add regression tests for consecutive writes on each affected setter
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (5df0c56) to head (e97e9a9).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #62   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines         1222      1226    +4     
=========================================
+ Hits          1222      1226    +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@svasek
svasek merged commit 8489cb4 into main Aug 25, 2026
11 checks passed
@svasek
svasek deleted the fix/rmw-cache-writeback branch August 25, 2026 16:49
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.

1 participant