fix(android): migrate aw-watcher-android-test buckets on startup - #244
fix(android): migrate aw-watcher-android-test buckets on startup#244TimeToBuildBob wants to merge 1 commit into
Conversation
The server-side rename from aw-server-rust#628 never ran because BackgroundService only called migrateHostname(). Wire the JNI and mark the preference complete only when no aw-watcher-android-test* buckets remain, so a collision leftover retries on the next start. Collision merge itself is ActivityWatch/aw-server-rust#661; this PR does not bump the submodule, so the current pin still rename-only skips the both-buckets-exist case. Refs: ActivityWatch#149, ActivityWatch#150, ActivityWatch#243
Greptile SummaryThe PR invokes the existing native Android watcher-bucket migration during background-service startup and records completion only after confirming that no legacy bucket IDs remain.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking defects identified. The startup path invokes the migration off the main thread, preserves retries after native failures or collision leftovers, and marks completion only after the legacy bucket prefix is absent. Important Files Changed
Sequence DiagramsequenceDiagram
participant OS as Android
participant Service as BackgroundService
participant Prefs as AWPreferences
participant Native as RustInterface
OS->>Service: Start or recreate service
Service->>Native: startServerTask()
Service->>Prefs: Read migration flags
opt Hostname migration pending
Service->>Native: migrateHostname(deviceName)
Native-->>Service: Migration result
Service->>Prefs: Mark hostname migrated on success
end
opt Watcher bucket migration pending
Service->>Native: migrateWatcherAndroidBucketNames()
Native-->>Service: Migration result
Service->>Native: getBucketsJSON()
alt No legacy bucket IDs remain
Service->>Prefs: Mark watcher migration complete
else Legacy bucket IDs remain
Service->>Service: Log and retry next startup
end
end
Reviews (1): Last reviewed commit: "fix(android): call migrateWatcherAndroid..." | Re-trigger Greptile |
|
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. |
Summary
aw-server-rust#628addedmigrateWatcherAndroidBucketNames(), butBackgroundServicenever called it. Upgrades from pre-rename builds keep writing/readingaw-watcher-android-test_*history that the Activity view no longer queries (#243).This PR:
hasMigratedWatcherAndroidBucketNames. Completes the preference only when noaw-watcher-android-test*buckets remain. Collision leftovers retry on the next start instead of being marked done forever.WatcherAndroidBucketMigrationwith JVM unit tests.What this does not do
The current
aw-server-rustsubmodule pin still usesUPDATE OR IGNORE. If both the legacy and canonical buckets exist, the rename is skipped. The SQL merge for that collision case is ActivityWatch/aw-server-rust#661. After that merges, bump this submodule — the Kotlin leftover check already matches the new merge (including partial overlap leftovers).I did not bump the submodule in this PR: the merge commit is not yet on
ActivityWatch/aw-server-rust, so a SHA bump would break CI checkout.Tests
WatcherAndroidBucketMigrationTest(canonical ID, leftover detection, success-prefix parsing)Refs