fix(android): return an error object from getBuckets instead of panicking - #680
Conversation
…king If the datastore worker is gone (it panicked, e.g. the database could not be opened), get_buckets() fails with SendError/RecvError and the unwrap here panicked across the JNI boundary on the calling thread — usually the main thread. Observed while reproducing ActivityWatch/aw-android#261. Every other JNI entry point already returns create_error_object; the Kotlin callers of getBuckets tolerate a non-bucket JSON object.
|
|
Self-merge not eligible here (cross-repo / policy gate). Waiting for human review or merge. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #680 +/- ##
==========================================
+ Coverage 70.81% 80.14% +9.32%
==========================================
Files 51 67 +16
Lines 2916 6059 +3143
==========================================
+ Hits 2065 4856 +2791
- Misses 851 1203 +352 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
Follow-up from #679 / ActivityWatch/aw-android#261.
Java_…_RustInterface_getBucketswas the only JNI entry point that stillunwrap()ed the datastore result. When the worker is gone (it panicked, for example because the database could not be opened),get_buckets()returnsSendError/RecvErrorand the unwrap panicked across the JNI boundary on the calling thread. Seen in the emulator while reproducing #261:Now returns
create_error_objectlike the other entry points. The Kotlin callers (createBucketHelper,EventParsingWorker,WatcherAndroidBucketMigration.legacyBucketIds) already tolerate a non-bucket JSON object. Not needed for v0.14.1; it turns a crash in an already-broken state into a logged error.