fix(android): use ["app", "classname"] merge keys instead of ["app", "title"] - #964
TimeToBuildBob wants to merge 3 commits into
Conversation
…"title"] Android watcher events carry app/package/classname but NOT title. aw-transform skips events missing a requested merge key, so merge_events_by_keys with ["app", "title"] collapsed all events to empty — causing "Time active: 0s" in the Activity view (ActivityWatch#959). Fix: - canonicalEvents: ["app", "title"] → ["app", "classname"] for Android - appQuery: ["app", "classname", "title"] → ["app", "classname"] for title_events Adds regression test to guard both call sites. Closes ActivityWatch#959 Git-Session-Id: 0323
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #964 +/- ##
==========================================
+ Coverage 49.62% 50.05% +0.43%
==========================================
Files 46 46
Lines 2783 2789 +6
Branches 630 603 -27
==========================================
+ Hits 1381 1396 +15
- Misses 1322 1373 +51
+ Partials 80 20 -60 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Greptile SummaryThe PR corrects source-specific event aggregation so Android events merge by
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
B[Selected mobile bucket] --> D{ScreenTime bucket?}
D -->|Yes| I[Set isIos true]
D -->|No| A[Use Android defaults]
I --> IT[Merge by app and title]
A --> AC[Merge by app and classname]
IT --> Q[Categorize and aggregate events]
AC --> Q
Q --> V[Activity summaries and category views]
Reviews (2): Last reviewed commit: "fix(android): preserve ScreenTime merge ..." | Re-trigger Greptile |
| `events = flood(${queryBucket(bid_window)});`, | ||
| // On Android, merge events to avoid overload of events | ||
| isAndroidParams(params) ? 'events = merge_events_by_keys(events, ["app", "title"]);' : '', | ||
| isAndroidParams(params) ? 'events = merge_events_by_keys(events, ["app", "classname"]);' : '', |
There was a problem hiding this comment.
ScreenTime events lose aggregation
When an iOS/ScreenTime bucket is selected, the shared appQuery path sends events containing app and title through this merge requiring classname; the transform discards events missing that key, causing the iOS Activity view to report zero active time and no application data.
There was a problem hiding this comment.
Fixed in a0fe9f8. appQuery and canonicalEvents now select merge keys by source: Android keeps ["app", "classname"], while ScreenTime uses ["app", "title"]. The Activity store passes the ScreenTime flag through the app and category paths, and Category Builder does the same. Added an iOS query regression assertion; the focused query suite passes (19 tests).
… absence Since ActivityWatch/aw-server-rust#652, --testing servers log to ~/.cache/activitywatch-testing/ while released builds use ~/.cache/activitywatch/. Use shopt nullglob to gracefully handle both paths and avoid failing when no log files are present. Git-Session-Id: 8fb4
Git-Session-Id: b9c4e8f0-fc2a-57bb-92bd-c1eff3b7e568
|
@greptileai review |
Fixes #959
Problem
On Android, the Activity view shows
Time active: 0sandTop Applications: No dataeven when the Timeline for the same host/day is full of events.Root cause:
canonicalEvents()merges Android events with keys["app", "title"]:Android watcher events carry
app,package, andclassname— but nottitle. Theaw-transformmerge implementation skips any event that is missing a requested key, so the entire event list collapses to empty. The Activity view then sums zero duration.The same bug appears in
appQuery()wheretitle_eventsis merged with["app", "classname", "title"]— again dropping all Android events.Fix
Use
["app", "classname"]as the merge keys for Android, which matches the keys that Android events actually carry:Tests
Added a regression test suite in
test/unit/queries.test.node.tsthat guards both call sites:canonicalEventsforAndroidQueryParamsmust use["app", "classname"], not["app", "title"]appQuerymust not include"title"in its Android merge keysAll 84 tests pass.