-
-
Notifications
You must be signed in to change notification settings - Fork 138
Compatibility patch for aw-import-screentime #740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- buckets: detect 'aw-import-screentime' as android-compatible buckets - queries: preserve 'title' attribute during android event merging - activity: add post-processing to support iOS attributes (mapping 'title' to 'app' for readability) - visualization: add 'Bundle IDs' view for technical detail while keeping 'Top Apps' human-readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed everything up to d18d09f in 53 seconds. Click for details.
- Reviewed
125lines of code in4files - Skipped
0files when reviewing. - Skipped posting
6draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/components/SelectableVisualization.vue:36
- Draft comment:
New 'Bundle IDs' view uses window.top_titles as its data source. Confirm that reusing top_titles for iOS bundle IDs is intentional. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
2. src/queries.ts:121
- Draft comment:
Updated merge key for Android events now includes 'title'. Verify that this consistently preserves the human‐readable name in all cases. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
3. src/queries.ts:203
- Draft comment:
In appQuery, merging with keys ['app', 'classname', 'title'] ensures iOS titles are retained. Confirm that dropping other fields is acceptable for later processing. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
4. src/stores/activity.ts:321
- Draft comment:
iOS bucket detection is based on 'aw-import-screentime' prefix. Ensure that bucket naming remains consistent across data sources. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
5. src/stores/activity.ts:325
- Draft comment:
Swapping 'app' and 'title' for iOS events and re-aggregating app_events ensures standardized structure. Note that only 'app' and '$category' are retained—verify if additional fields are needed later. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
6. src/stores/buckets.ts:100
- Draft comment:
The bucketsAndroid getter now combines Android and iOS buckets by filtering on prefixes. Ensure that the chosen prefixes ('aw-watcher-android' and 'aw-import-screentime') cover all expected cases. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
Workflow ID: wflow_rj1I21YyKP0WmBzS
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Greptile SummaryThis PR adds iOS compatibility for ActivityWatch WebUI by supporting data imported via the Key Changes:
Issues Found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant WebUI
participant BucketsStore
participant ActivityStore
participant QueryEngine
participant Server
User->>WebUI: View Activity Dashboard
WebUI->>BucketsStore: Load buckets
BucketsStore->>Server: getBuckets()
Server-->>BucketsStore: Return all buckets
BucketsStore->>BucketsStore: bucketsAndroid(host)
Note over BucketsStore: Filter 'currentwindow' buckets<br/>starting with 'aw-watcher-android'
Note over BucketsStore: Filter 'app' buckets<br/>starting with 'aw-import-screentime'
BucketsStore->>BucketsStore: Merge Android + iOS buckets
BucketsStore-->>WebUI: Return combined bucket list
WebUI->>ActivityStore: query_android(options)
ActivityStore->>QueryEngine: Generate appQuery
Note over QueryEngine: canonicalEvents merges by<br/>["app", "title"]
Note over QueryEngine: title_events merge by<br/>["app", "classname", "title"]
Note over QueryEngine: app_events merge by ["app"]
ActivityStore->>Server: Execute query
Server-->>ActivityStore: Return aggregated events
alt iOS Bucket Detected
ActivityStore->>ActivityStore: Post-process iOS events
Note over ActivityStore: For each title_event:<br/>1. classname = original app (Bundle ID)<br/>2. app = title (Human Name)<br/>3. title = title (unchanged)
ActivityStore->>ActivityStore: Re-aggregate app_events
Note over ActivityStore: Group modified title_events by app<br/>Sum durations per app<br/>Keep only app and $category
end
ActivityStore-->>WebUI: query_window_completed(data)
WebUI->>WebUI: Render visualizations
Note over WebUI: Top Applications shows<br/>human-readable names
Note over WebUI: Bundle IDs shows<br/>raw bundle identifiers
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 3 comments
| // Clone event to avoid reference issues | ||
| new_app_events_map[app] = { ...e, duration: 0, data: { ...e.data } }; | ||
| // Ensure we only keep the 'app' key for app_events to match standard structure | ||
| new_app_events_map[app].data = { app: app, $category: e.data.$category }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Only preserving app and $category in re-aggregated events discards classname and title which may be needed elsewhere
| new_app_events_map[app].data = { app: app, $category: e.data.$category }; | |
| new_app_events_map[app].data = { app: app, classname: e.data.classname, $category: e.data.$category }; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/stores/activity.ts
Line: 344:344
Comment:
**logic:** Only preserving `app` and `$category` in re-aggregated events discards `classname` and `title` which may be needed elsewhere
```suggestion
new_app_events_map[app].data = { app: app, classname: e.data.classname, $category: e.data.$category };
```
How can I resolve this? If you propose a fix, please make it concise.| if (e.data.title) { | ||
| const originalApp = e.data.app; | ||
| e.data.classname = originalApp; // Bundle ID (e.g. com.google.ios.youtube) | ||
| e.data.app = e.data.title; // Human Name (e.g. YouTube) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Events without title are skipped but still contribute to aggregated durations from server-side query. This creates mismatch between title_events and app_events returned from query vs post-processed versions. Are there iOS events that legitimately don't have a title field, and if so should they be handled differently?
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/stores/activity.ts
Line: 329:333
Comment:
**logic:** Events without `title` are skipped but still contribute to aggregated durations from server-side query. This creates mismatch between `title_events` and `app_events` returned from query vs post-processed versions. Are there iOS events that legitimately don't have a title field, and if so should they be handled differently?
How can I resolve this? If you propose a fix, please make it concise.| const ios = this.bucketsByType(host, 'app').filter((id: string) => | ||
| id.startsWith('aw-import-screentime') | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Filtering by generic type 'app' could match unintended buckets. Consider using a more specific filter or adding additional validation.
The PR description mentions these are from aw-import-screentime which should have a specific bucket type. Check actual bucket type from iOS imports to ensure correct filtering. What is the actual bucket type created by aw-import-screentime - is it truly just 'app' or something more specific?
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/stores/buckets.ts
Line: 105:107
Comment:
**logic:** Filtering by generic type `'app'` could match unintended buckets. Consider using a more specific filter or adding additional validation.
The PR description mentions these are from `aw-import-screentime` which should have a specific bucket type. Check actual bucket type from iOS imports to ensure correct filtering. What is the actual bucket type created by aw-import-screentime - is it truly just 'app' or something more specific?
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #740 +/- ##
==========================================
- Coverage 26.30% 25.92% -0.39%
==========================================
Files 29 29
Lines 1684 1709 +25
Branches 288 302 +14
==========================================
Hits 443 443
+ Misses 1219 1203 -16
- Partials 22 63 +41 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @Guracc thanks for the changes, could you address the AI reviewer comments? Thanks :) |
Feature:
I modified the codebase to enable better compatibility out of the box with IOS imports using the aw-import-screentime utility. I also added a new visualization called BundleIDs to view the "app" attribute of the bucket.
Changes
src/stores/buckets.ts
)
Updated
bucketsAndroid
getter to recognize buckets starting with aw-import-screentime.
src/queries.ts
)
Fix: Modified
canonicalEvents
to merge Android events by ["app", "title"] instead of just ["app"].
Reason: Previous logic stripped the title attribute during the initial query, preventing us from accessing the Human Readable Name present in iOS exports.
src/stores/activity.ts
)
Added post-processing in
query_android
.
Detects iOS buckets and maps attributes to align with WebUI expectations:
App Name (
app
): Set to the Human Readable Name (from title).
Bundle ID (classname): Set to the Bundle ID (from original
app
).
Original Title (title): Kept as Human Readable Name.
src/components/SelectableVisualization.vue
)
Enabled top_titles ("Top Window Titles") for Android sources.
New Visualization: Added "Bundle IDs" (top_bundle_ids).
Displays the raw Bundle ID (classname) for technical detail.
Added to the configuration menu (gear icon).
Verification
Import iPhone data.
Top Applications: Should show readable names (e.g., "YouTube") instead of bundle IDs.
Top Window Titles: Should show readable titles.
Bundle IDs: Select this new view to see the underlying com.google.ios.youtube style IDs.
Important
Enhance iOS import compatibility and add Bundle IDs visualization in
SelectableVisualization.vue.bucketsAndroidgetter inbuckets.tsto recognize iOS buckets starting withaw-import-screentime.canonicalEventsinqueries.tsto merge Android events by['app', 'title'].appQueryinqueries.tsto merge events by['app', 'classname', 'title'].query_androidinactivity.tsto swapappandtitlefor iOS buckets.SelectableVisualization.vueto display raw Bundle IDs.top_titlesfor Android sources inSelectableVisualization.vue.This description was created by
for d18d09f. You can customize this summary. It will automatically update as commits are pushed.