Widget shows 0 h 0 m when the category query fails, overwriting good totals
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start with widget/CategoryTimeWidgetUpdater.kt, especially parseCategories at lines 420–447, and compare its handling with parseEventsJSON and parseBucketsJSON. Run the failing queryErrorObjectIsAFailureNotZeroMinutes test in CategoryTimeWidgetUpdaterTest; done means the error object propagates as a failure while a genuine empty array still represents no categories, allowing onUpdateFailed to preserve the displayed totals.
Written by the indexing model from the issue text.
Description
When the native query fails, the home-screen widget shows 0 h 0 m for today and replaces totals that were already rendered.
androidQuery returns {"error": "Something went wrong when trying to query: …"} when the query fails (aw-server-rust aw-server/src/android/mod.rs, create_error_object). This happens, for example, when the aw-watcher-android bucket has been deleted, when a category regex doesn't compile, or when the datastore errors. CategoryTimeWidgetUpdater.parseCategories (widget/CategoryTimeWidgetUpdater.kt:420-447) passes that string to JSONArray(...), which throws. The exception is caught and the function returns the same empty list as a genuine "[]". loadData therefore counts as a success, and the widget renders zero minutes with a fresh timestamp. The KDoc of onUpdateFailed says a load failure renders "no data yet" and keeps the data already shown; that path is never reached.
Failing test (CategoryTimeWidgetUpdaterTest):
@Test
fun queryErrorObjectIsAFailureNotZeroMinutes() {
// what androidQuery returns when the query fails
val error = """{"error":"Something went wrong when trying to query: x"}"""
assertThrows(Exception::class.java) { CategoryTimeWidgetUpdater.parseCategories(error) }
}
It fails today because parseCategories returns emptyList(), the same result as for "[]".
Fix direction: recognise the error object (as parseEventsJSON / parseBucketsJSON already do for getEvents / getBuckets) and let it propagate, so onUpdateFailed runs.
NotifyWorker has the same parse pattern with a different symptom; filed separately as #431.
Priority: medium (users see wrong totals). This repo only has a priority: high label, so no priority label is set.
fingerprint: widget/CategoryTimeWidgetUpdater.kt — androidQuery error object rendered as 0 minutes
Found by code review on master 3b820d61. I verified the trigger path against aw-server-rust 67432e66. I have not run it on a device.
- Dominant language
- Kotlin
- Stars
- 291
- Forks
- 73
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 27
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ActivityWatch/aw-android
-
WebWatcher: keyboard events still split visits in detected browsers (browserIsActiveWindow checks only the hard-coded list)Possibly taken @TimeToBuildBob claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ActivityWatch/aw-android#435 ·
Maintainers usually reply within 2 days
-
Widget ignores short hex category colors (#CCC), so Uncategorized gets a fallback colorPossibly taken @TimeToBuildBob claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ActivityWatch/aw-android#433 ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ActivityWatch/aw-android#431 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ActivityWatch/aw-android#383 · 2 comments ·
Maintainers usually reply within 2 days
-
Web watcher: add support for Brave (`com.brave.browser` missing from KNOWN_BROWSER_PACKAGES)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ActivityWatch/aw-android#306 · 1 comment · 2 reactions ·
Maintainers usually reply within 2 days
All issues in ActivityWatch/aw-android
Similar issues
-
Area: Java bug report needs triage OS: Windows
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
actions/runner-images#15458 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nwverse/persona#22164 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
bug 🐞
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
valkey-io/valkey-glide#8000 ·
Maintainers usually reply within 2 days
-
Declare two limitations the 2026-12-02/03 plausibility runs confirmed: Huxleys ticket link, Gretchen flyerPossibly taken A pull request linked to this issue is open or already merged. Openafk-ok area:data-quality importer size:S
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
enorm-labs/event-junkie#5887 ·
Maintainers usually reply within 1 day