Skip to content

aw-sync: the daemon (what aw-qt/aw-tauri spawn) still pulls with the 2-level walker — Android's 3-level staging is never imported, v0.14.0b7 included #709

Description

@ErikBjare

Reproduced today on erb-m2 against a desktop instance, with aw-sync built from master (b0fab73, the revision v0.14.0b7 pins).

What happens

  • aw-sync status classifies the phone correctly: [peer 3-level] poco_f8_ultra/41662faa-…/test.db 299.2 MB buckets: 6 events: 1436166 imported locally: no.
  • aw-sync sync (plain, no --mode) imports it — that path is sync_wrapper::pull_alllist_remote_dbs (3-level).
  • aw-sync with no subcommand — the default, and exactly what aw-qt spawns (ps on the running daemon: /Applications/ActivityWatch.app/Contents/Resources/aw-sync, no args) — runs daemon()sync::sync_runfind_remotes_nonlocal_selectionfind_remotes, which is the 2-level walker ({sync_dir}/{x}/*.db). Result: Found 0 remote db files to pull, followed by the feat(aw-sync): add status doctor command and fail-loud empty-pull warnings #687 "zero peers … is usually a layout problem" warning, followed by a listing that includes the phone as a 3-level peer it did not select. Same for sync --mode pull.

So the daemon pushes every 5 minutes and never pulls an Android peer, on master. The doc comment on find_remotes says "Default-daemon pull is list_remote_dbs (3-level-only), not this function" — that is not what fn daemon does (main.rs, the sync_run call in its loop). I believe this is the original ActivityWatch/activitywatch#1445 symptom surviving every sync PR since, because each fix was verified through pull_all/status rather than through the daemon.

Invariant to enforce

Whatever status reports as a selectable peer, the daemon imports. Concretely sync_run (or daemon()) must select peers with the same list_remote_dbs + select_remote_dbs_detailed the doctor and pull_all use, keeping the legacy 2-level results as a union for old desktop peers (own-device exclusion and the #683 largest-wins dedupe already apply to both). A test that runs daemon's pass function once against a 3-level fixture and asserts the import is the regression guard — the existing tests cover pull_all, which is not the code path users run.

Side findings from the same session (separate, minor)

  • aw-sync status (read-only doctor) takes the aw-sync-at-<host>-on-<port> single-instance lock, so it cannot run while the daemon is running — the one time you need it. Doctor commands should not take the daemon's lock.
  • ~/Library/Caches/activitywatch/client_locks/ holds 9,012 lock files here; they are never removed.

cc @TimeToBuildBob — this is release-blocking for the "Android sync works in 0.14" story; the fix is small once the selection is shared.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions