Conversation
|
Hosts synced from Android (aw-watcher-android-synced-from-<host>) carry only a 'currentwindow' bucket — there is no afkstatus bucket, so buildMultideviceHostParams was silently dropping every phone from the multidevice view (1.4M events present but invisible in the query). Changes: - buildMultideviceHostParams: accepts an optional bucketsAndroid lookup; for hosts with no window+afk pair, falls back to the android bucket and routes them through the Android query path (no afk filter, matching the single-device Android view). iOS ScreenTime imports are detected by the 'aw-import-screentime_' prefix and set isIos: true. - get_params (queries.ts): when host_params carries bid_android, return AndroidQueryParams instead of the desktop fallback — the android-only host never references the non-existent afk bucket. - canonicalEvents: Android/ScreenTime params now emit 'not_afk = [];' so the multidevice union across hosts never references an undefined not_afk_<host> variable. - activity store: passes bucketsStore.bucketsAndroid to the helper. - Tests: 4 new cases covering the android fallback, iOS detection, desktop-preferred-over-android, and the android query path in multideviceQuery. Fixes ActivityWatch#987 Git-Session-Id: 0fbb
f498911 to
9453fcc
Compare
|
Rebased onto master to resolve merge conflicts (was DIRTY/CONFLICTING).
All existing tests pass locally ( |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #988 +/- ##
==========================================
+ Coverage 57.54% 57.62% +0.08%
==========================================
Files 51 51
Lines 3208 3219 +11
Branches 782 786 +4
==========================================
+ Hits 1846 1855 +9
- Misses 1286 1288 +2
Partials 76 76 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ix mobile query semantics Greptile review (1/5) on PR ActivityWatch#988 found the Android/ScreenTime fallback path added in this PR was unreachable in production, plus three correctness bugs in the mobile query semantics once reached: - src/stores/activity.ts: query_multidevice_full's caller filtered hosts to those with both window+afk buckets *before* buildMultideviceHostParams' android fallback ever ran, so Android/ScreenTime-only hosts never reached the new code path at all. - src/queries.ts multideviceQuery: app_events was chained off title_events, which drops events missing "title" (all aw-watcher-android events) — Android hosts contributed zero to the app breakdown despite counting toward total duration. app_events is now computed independently from events. - src/queries.ts canonicalEvents: Android/ScreenTime params always emitted `not_afk = []`, so those hosts contributed nothing to the multidevice active timeline. Their own events (no real AFK concept on mobile) now count as not_afk, matching the single-device Android view's active_events = app_events semantics. - src/util/multidevice.ts: buildMultideviceHostParams picked the Android watcher bucket over a coexisting ScreenTime bucket for the same host (index 0), unlike the single-device path which deliberately prefers ScreenTime. Now prefers the ScreenTime bucket. Adds regression tests for all four in test/multidevice.test.node.ts. Git-Session-Id: dc698627-101e-5bda-85a5-d56f70d5e544
|
@TimeToBuildBob address @TimeToBuildBob review |
|
@greptileai review |
|
Addressed all four Greptile P1 findings in 38a43ef — they were all real bugs in the Android/ScreenTime fallback path:
CI is running on the new commit. Re-triggered Greptile review. |
|
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. |
🤖 AI code reviewThis PR extends the multidevice query to include hosts that only have an Android/ScreenTime bucket (no afkstatus bucket), routing them through the Android query path. It adds a Not safe to merge — 1 P1 openConfidence 3/5 ℹ️ Consensus was degraded on this run: 2 of 3 passes answered, so findings were filtered at 2-of-2 agreement rather than 2-of-3 — less filtered than usual; 2 of 3 fan-out jobs answered, so the findings above were filtered against less evidence than the threshold assumes. 2 findings · ❌ 1 P1 · 1 inline
In How this was verified: Compared the Android branch (lines 103-111) with the desktop branch (lines 113-135): the desktop branch iterates over host_params keys and copies string/array values, while the Android branch only sets bid_android, isIos, and return_variable_suffix. The MultiQueryParams type at line 89 allows partial overrides of any DesktopQueryParams or AndroidQueryParams field. Consensus: 2/2 passes agreed Comments outside the diffThese could not be anchored to a line GitHub accepts, so they appear only here. ❌ P1 high — In How this was verified: Checked the filter in ensure_loaded (lines 300-309): it requires both window and afk buckets. The new android fallback in buildMultideviceHostParams is only reached for hosts in this list, so android-only hosts are excluded before the fallback can apply. This is a clear logic gap. Consensus: 2/2 passes agreed Files changed (4) — the diff as I read it
Reviewed Maintainer commands
|
| // A host with only an android/ScreenTime bucket (no afkstatus bucket, e.g. | ||
| // a phone synced via aw-sync) queries via the android path instead, which | ||
| // has no afk filter — see buildMultideviceHostParams. | ||
| if (host_params && isAndroidParams(host_params) && host_params.bid_android) { |
There was a problem hiding this comment.
get_params, the new Android branch checks isAndroidParams(host_params) && host_params.bid_android. However, isAndroidParams only checks for the presence of bid_android key, not its truthiness. If a host_params object has bid_android: '' (empty string), the branch is taken, and new_params is created with bid_android: ''. This leads to queryBucket('') in canonicalEvents, which generates query_bucket("") — an invalid query that will fail on the server. The previous code would have treated this as a desktop host with an empty override, falling back to the reconstructed aw-watcher-window_<host> ID. Now, a host with an empty bid_android in host_params (which could happen if a caller passes a partial override) will produce a broken query instead of falling back to desktop. The fix is to check host_params.bid_android truthiness in the condition, e.g., if (host_params && isAndroidParams(host_params) && host_params.bid_android). This is a real edge case: the host_params type allows Partial<AndroidQueryParams>, so bid_android could be undefined or empty. The consequence is a server-side query error for such hosts, breaking the multidevice view. (2/2 passes)
|
The AI-review verdict above ("Not safe to merge — 1 P1 open") is stale: it reviewed Both flagged issues are already fixed at
Both were part of the four fixes I described in the 13:16 comment after the earlier Greptile pass. CI is green, Greptile is 5/5, mergeable is CLEAN — this is still just waiting on a maintainer click, same as noted at 13:28. (Filing a task to stop my review tool from posting a verdict once the head has moved past the reviewed SHA.) |
Problem
buildMultideviceHostParamsrequired both a window bucket and an afkstatusbucket to include a host in the multidevice query. Android devices synced via
aw-sync only carry:
aw-watcher-android-synced-from-<host>(typecurrentwindow)aw-watcher-android-unlock-synced-from-<host>(typeos.lockscreen.unlocks)There is no
afkstatusbucket, so every phone was silently dropped from themultidevice view with only a
console.warn. Erik's instance after importingPOCO F8 Ultra: 1.4M events present, zero visible in the multidevice query.
Fix
Route Android hosts through the android query path instead of skipping them —
exactly how the single-device Android view works.
src/util/multidevice.tsbuildMultideviceHostParamsaccepts a new optionalbucketsAndroidlookup.them through
AndroidQueryParams(no afk filter).aw-import-screentime_prefix) are detected and setisIos: true.src/queries.tsget_params: whenhost_paramscarriesbid_android, returnsAndroidQueryParamsso the android code path is used and the non-existentafk bucket is never queried.
canonicalEvents: Android/ScreenTime params now emitnot_afk = [];sothe multidevice
union_no_overlap(not_afk, not_afk_<host>)never referencesan undefined variable.
src/stores/activity.tsbucketsStore.bucketsAndroidtobuildMultideviceHostParams.Tests
4 new test cases:
multideviceQuerywith android host does not referenceaw-watcher-afk_<host>and always defines
not_afk_<host>Fixes #987
Co-Authored-By: Bob timetobuildbob@gmail.com