feat(android): add migration for aw-watcher-android-test bucket names#628
Conversation
|
Addressed both Greptile review findings: P1 Fixed: Changed P2 Fixed: Replaced |
Adds migrate_test_bucket_names() to DatastoreInstance and the Datastore worker, which renames any bucket whose name starts with 'aw-watcher-android-test' to 'aw-watcher-android' (e.g. aw-watcher-android-test_hostname → aw-watcher-android_hostname). This covers the old debug-build bucket naming convention and complements the existing migrateAndroidBucketName() exact rename that handles the 'aw-android-test' → 'aw-android' legacy case. Exposes a JNI entry point: Java_net_activitywatch_android_RustInterface_migrateWatcherAndroidBucketNames Requested in ActivityWatch/aw-android#150.
…g and prefix-only rename - P1: Change UPDATE to UPDATE OR IGNORE so a UNIQUE constraint collision on any single target name skips conflicting rows instead of aborting the entire batch migration - P2: Replace REPLACE() with prefix-based SUBSTR() so only the leading 'aw-watcher-android-test' prefix is swapped, not all substring occurrences
fb8a00a to
9157941
Compare
|
Rebased this PR onto current Conflict resolution was in Local verification:
GitHub now shows the branch as mergeable again, and CI is running on |
|
@greptileai review |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #628 +/- ##
==========================================
+ Coverage 70.81% 76.03% +5.21%
==========================================
Files 51 62 +11
Lines 2916 5020 +2104
==========================================
+ Hits 2065 3817 +1752
- Misses 851 1203 +352 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PR Ready for Review — All CI Green, Review Threads ResolvedThis PR directly addresses the question raised in aw-android#150 about migrating existing State:
Remaining Greptile finding (4/5): Flags two Also references: Includes the same migration as PR #577 (with the JNI fix already applied), and renames helper was adapted to current worker API during rebase. Maintainer merge needed 🙏 |
|
Fixed the Greptile summary-body finding in
Verified locally:
|
|
@greptileai review |
Implements the
aw-watcher-android-test->aw-watcher-androidbucket name migration requested in #577 (comment) and ActivityWatch/aw-android#150, plus themigrate_hostname()andrename_bucket()infrastructure from #577 with the JNI naming fix already applied.Changes
aw-datastore/src/datastore.rs:rename_bucket(),migrate_hostname(),migrate_test_bucket_names()aw-datastore/src/worker.rs:RenameBucket,MigrateHostname,MigrateTestBucketNamescommands + public APIaw-server/src/android/mod.rs: Three JNI entry points using camelCase naming (no JNI_1encoding issues)migrate_test_bucket_names()Renames all
aw-watcher-android-test*buckets toaw-watcher-android*using safe prefix-only replacement. UsesOR IGNOREto skip UNIQUE collisions gracefully, andSUBSTRprefix replacement rather than globalREPLACE.Status
OR IGNORE, P2:SUBSTRprefix swap)_1encoding issues)Ref: ActivityWatch/aw-android#150, #577