fix(research): retain approved application names - #1431
Conversation
Greptile SummaryThis PR updates the Research Edition data flow to retain approved application names while continuing to remove URLs and raw window titles.
The previous finding about legacy application mappings surviving an upgrade is fully addressed by emitting an explicit empty Confidence Score: 5/5The PR appears safe to merge, with the prior upgrade-path defect fully corrected and no new actionable issues identified. The explicit empty application-category table replaces stale legacy mappings during the key-by-key configuration merge, while the accompanying tests verify retained application names and continued removal of raw browser content. No outstanding previous finding or accepted new issue remains. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Window event] --> B[Research watcher filter]
B -->|Non-browser application| C[Retain app name]
B -->|Recognized browser| D[Retain browser identity]
D --> E[Replace title with study category]
C --> F[Remove raw title and URL]
E --> G[Remove URL]
F --> H[Export sanitizer]
G --> H
H --> I[Rewrite hostname and bucket identity]
I --> J[Research export]
C --> K[Web UI preset]
E --> K
K --> L[Study taxonomy views]
Reviews (2): Last reviewed commit: "fix(research): emit explicit empty app-c..." | Re-trigger Greptile |
| f"[research_category_map]\n{entries}\n\n" | ||
| f"[research_app_category_map]\n{app_entries}" | ||
| ) | ||
| block = f"research_enabled = true\n\n[research_category_map]\n{entries}" |
There was a problem hiding this comment.
The generated post-#137 defaults omit research_app_category_map. Because these defaults are merged into the watcher configuration key by key, an upgrade from an earlier Research Edition can retain its previously populated app map. Those installations will continue replacing application names with categories, so this fix will not retain application names for existing participants. Add an empty table to explicitly clear the old map.
| block = f"research_enabled = true\n\n[research_category_map]\n{entries}" | |
| block = ( | |
| "research_enabled = true\n\n" | |
| f"[research_category_map]\n{entries}\n\n" | |
| "[research_app_category_map]" | |
| ) |
…remnants An upgrade from an earlier Research Edition may have a populated research_app_category_map saved in the user's config. Because research_defaults is merged into [aw-watcher-window] key-by-key, omitting the empty table left legacy entries intact and continued replacing app names with categories, defeating the primary behavior change of this PR. Add the empty [research_app_category_map] section to the post-ActivityWatch#137 block so the watcher's key-by-key merge resets the key on upgrade. Also update the post-ActivityWatch#137 test to assert the empty map is present (not absent), and add a dedicated test that verifies the section header appears in the raw defaults string. Addresses Greptile 4/5 P1 finding (stale app map survives upgrade).
|
@greptileai review |
Why
Lund/IIIEE has now confirmed the Research Edition data contract: application
names (including browser identity) may be stored, but browser URLs may not be
stored and must be reduced to study categories instead. The current build does
the opposite for desktop apps by replacing their names with categories.
This selects the already-designed retain-names branch before the next Research
Edition release. Tracking context: ErikBjare/bob#1108.
What changed
research_app_category_mapempty in release builds, so the watcherkeeps approved app names while still dropping non-browser titles and URLs;
identity plus a study-category title;
labels, so
Top Applicationscan show Word/Spotify/Teams whileTop Categoriesstill uses the study taxonomy;continues to reject every URL and every non-category window title;
build-matrix gap.
Unknown app names remain visible and
Uncategorized; the preset deliberatelydoes not use a catch-all that would overlap every specific category rule.
Validation
45 passedacrossscripts/tests/test_*.pyrustfmt --check --edition 2021passesMicrosoft Wordis retained while its raw title/URL are dropped;Safari+ a private Google Docs URL becomes{app: Safari, title: Work & Productivity}with no URL.