Skip to content

fix(sync): suppress desktop 'zero peers' warning in Sync Settings; show push-only note - #293

Merged
ErikBjare merged 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/android-push-only-sync-status
Sep 18, 2026
Merged

ErikBjare merged 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/android-push-only-sync-status

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Summary

Closes #291 (re-scoped on 2026-09-18 by Erik).

On Android, pull is a no-op by construction — the SAF mirror is outbound-only so
pull_all() always finds zero peers. This causes aw-server-rust#687's
"zero peers in a configured sync dir is usually a layout or setup problem" warning
to appear in Sync Settings on every run, misleading users into thinking sync is broken.

Per the re-scope: Android stays push-only until sync v2 (JSONL+zstd
read-from-staging). Until then Sync Settings should:

  1. Not show the desktop-only "zero peers" warning
  2. Show "Push-only on this device (pull arrives with sync v2)" so users understand
    why pull counts are always 0

Changes

SyncSettingsActivity.kt

  • formatSyncStatus and formatSyncDetail gain an isPushOnlyDevice: Boolean = false
    parameter (default false — all non-Android call sites are unchanged)
  • When isPushOnlyDevice = true:
    • warnings containing "zero peers" are filtered from the detail line
    • "Push-only on this device (pull arrives with sync v2)" is appended to every
      last-sync status display (including the "Last sync: never" initial state)
  • updateLastSyncStatus() now passes isPushOnlyDevice = true

SyncSettingsActivityTest.kt — 3 new unit tests:

  • formatSyncStatus_pushOnlyDevice_suppressesZeroPeersWarning — zero-peers warning filtered, push-only note appended
  • formatSyncStatus_pushOnlyDevice_preservesOtherWarnings — other warnings (e.g. "push aborted after pull failure") still surface
  • formatSyncStatus_pushOnlyDevice_appendsNoteEvenWhenNeverSynced — note appears even before the first sync

Item 2: JNI sync dir root verification

Erik's re-scope also asks to verify what root getSyncDir() returns at the JNI boundary
(…/files/sync vs …/files/sync/poco_f8_ultra). That diagnostic is tracked as a
follow-up: running the app on device and reading Log.d "getSyncDir()" from logcat before
the v2 reader is designed. Not included in this UI-only PR.

Test plan

  • Build and run on device; open Sync Settings after a completed sync
  • Confirm "zero peers in a configured sync dir" no longer appears in the status
  • Confirm "Push-only on this device (pull arrives with sync v2)" appears below the counts
  • ./gradlew :mobile:testDebugUnitTest passes (unit tests are pure JVM, no emulator needed)

…h-only note

On Android pull is a no-op by construction (SAF mirror is outbound-only),
so aw-server-rust#687's 'zero peers in a configured sync dir is usually a
layout or setup problem' warning is always present but meaningless. It
causes users to think sync is broken when it is working as expected.

Per ActivityWatch#291 (re-scope): Android stays push-only until
sync v2 ships (JSONL+zstd read-from-staging). In the meantime Sync Settings
- filters the 'zero peers' warning (isPushOnlyDevice=true at the call site)
- appends 'Push-only on this device (pull arrives with sync v2)' to every
  last-sync status display so users understand why pull counts are always 0

All existing tests pass unchanged (new parameter defaults to false).
Three new tests cover the main case, warning preservation, and null status.

Git-Session-Id: fbd0
@greptile-apps

greptile-apps Bot commented Sep 18, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with the new presentation behavior consistently applied across Sync Settings refresh paths.

Summary

This PR adjusts Android Sync Settings to accurately describe the current outbound-only synchronization behavior.

  • Suppresses the desktop-specific “zero peers” warning on push-only devices.
  • Adds a push-only explanatory note to completed, legacy, and never-synced status displays.
  • Preserves other synchronization warnings.
  • Adds focused unit coverage for warning filtering, warning preservation, and the initial state.

Reviews (1) · Last reviewed commit: "fix(sync): suppress desktop 'zero peers'..."

…f (run 35347943017)

Git-Session-Id: 2b5c2082-6682-54f6-904f-167976400e00
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

The E2E failure on the Test E2E (29) job (NativeWindowInsetsTest.syncToggleReceivesRealTap) is unrelated to this PR.

The PR only touches formatSyncStatus, formatSyncDetail, and their unit tests — zero lines of toggle logic (setSyncEnabled, setOnCheckedChangeListener, switch_sync_enabled) changed. The flaky test is a known E2E fragility hardened in #287 (merged 2026-09-17); the monitoring task is still collecting consecutive-clean-run evidence on master.

I don't have write access to re-trigger CI. Requesting a re-run of the failed job — the unit tests all pass and Greptile gave it 5/5.

@ErikBjare
ErikBjare merged commit 9ff13cc into ActivityWatch:master Sep 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android is push-only until sync v2: stop showing the 'zero peers … layout problem' warning; pull other hosts only once v2 reads from staging

2 participants