Repository navigation
fix(datastore): commit stopwatch changes before acknowledging - #743
Conversation
|
TimeToBuildBob
left a comment
There was a problem hiding this comment.
Verified at 3fa6fa1: applying only the new regression test to current master fails on the first independent SQLite read after heartbeat acknowledgement (QueryReturnedNoRows). At this head, cargo test -p aw-datastore passes: 17 unit tests plus 28 integration tests, 1 existing ignored test. The regression checks heartbeat/start, replacement/stop, and deletion through a second connection immediately after acknowledgement. Ordinary watcher batching remains unchanged by code inspection; this was not a separate behavioral test. Commit failures still return an error instead of successful acknowledgement. No blocking issue found; ready for maintainer review/merge. This verifies transaction visibility, not stronger power-loss guarantees than the existing SQLite settings.
Related: ActivityWatch/aw-android#70.
The stopwatch UI waits for the replace-event response, but the datastore can send it before SQLite commits. If Android kills the process before the next batch commit, the timer is still running when reopened.
Commit writes to
general.stopwatchbuckets before replying. Other buckets retain batching. The datastore test checks start, stop, and delete through a second SQLite connection immediately after each call.Reproduced the stop/reopen case on an Android 16 emulator. All 28 datastore integration tests pass.
Before / after (two-second blank gap):
aw-stopwatch-before-after.mp4