From 101678851455a7c105df5050bdebcdcea26fad53 Mon Sep 17 00:00:00 2001 From: Brummel Date: Mon, 27 Apr 2026 00:03:40 +0200 Subject: [PATCH] fix(watch): kick sync service unconditionally on app start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this, the watch would only run a poll cycle if the pending queue happened to be non-empty — meaning the case list was empty forever for users who didn't dictate before opening the app. Kicking on every launch makes the foreground service start, primes the case store from the snapshot cache, then polls /api/oneliners. Verified end-to-end on Wear OS 36 emulator-5556 against a live local server: - 4 server cases populate the list within ~150 ms of app start - Tap Neu → mic permission → record → stop completes in <3 s of UI - Sync service uploads, server transcribes (whisper) + classifies (ollama), watch's burst-poll hits within 2 s of upload-success and merges the OnelinerState.Empty (silence rule) back into the marker - unsynced/ ends empty (deletePair after ACK), cases/ has 5 markers with synced_to_server=true, snapshot_cache.json on disk --- .../app/src/main/java/com/doctate/watch/DoctateApp.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/watch/wearos/app/src/main/java/com/doctate/watch/DoctateApp.kt b/watch/wearos/app/src/main/java/com/doctate/watch/DoctateApp.kt index dc184da..50e554d 100644 --- a/watch/wearos/app/src/main/java/com/doctate/watch/DoctateApp.kt +++ b/watch/wearos/app/src/main/java/com/doctate/watch/DoctateApp.kt @@ -80,16 +80,16 @@ class DoctateApp : Application() { .launchIn(applicationScope) // One-shot data-minimization sweep before the sync worker starts, - // then kick the service if the pending queue still has work. + // then kick the service so it polls /api/oneliners and uploads any + // pending recordings. Kicking unconditionally — even with an empty + // queue we want the case list to populate from the server. applicationScope.launch { StartupCleanup.run( store = caseStore, pendingDir = File(filesDir, "recordings/unsynced"), ) - if (pendingStore.scan().isNotEmpty()) { - Log.i(TAG, "startup: pending queue non-empty → kicking sync service") - syncTrigger.kick(this@DoctateApp, SyncKick.NewPending) - } + Log.i(TAG, "startup: kicking sync service (queueLen=${pendingStore.scan().size})") + syncTrigger.kick(this@DoctateApp, SyncKick.NewPending) } }