Widget shows 0 h 0 m when the category query fails, overwriting good totals
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
从widget/CategoryTimeWidgetUpdater.kt开始,重点查看第420–447行的parseCategories,并将其处理方式与parseEventsJSON和parseBucketsJSON进行比较。在CategoryTimeWidgetUpdaterTest中运行失败的测试queryErrorObjectIsAFailureNotZeroMinutes;当错误对象作为失败传递,而真正的空数组仍表示没有类别,从而使onUpdateFailed能够保留显示的总计时,即为完成。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Kotlin
- 星标
- 291
- 派生
- 73
- 平均合并
- 4 天 5 小时
- 30 天内合并 PR
- 27
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ActivityWatch/aw-android 的其他 Issue
-
WebWatcher: keyboard events still split visits in detected browsers (browserIsActiveWindow checks only the hard-coded list)可能已有人在做 @TimeToBuildBob 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 82/100
ActivityWatch/aw-android#435 ·
维护者通常 2 天内回复
-
Widget ignores short hex category colors (#CCC), so Uncategorized gets a fallback color可能已有人在做 @TimeToBuildBob 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 82/100
ActivityWatch/aw-android#433 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
ActivityWatch/aw-android#431 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
ActivityWatch/aw-android#383 · 2 条评论 ·
维护者通常 2 天内回复
-
Web watcher: add support for Brave (`com.brave.browser` missing from KNOWN_BROWSER_PACKAGES)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
ActivityWatch/aw-android#306 · 1 条评论 · 2 个 reaction ·
维护者通常 2 天内回复
查看 ActivityWatch/aw-android 的全部 Issue
相似的 Issue
-
Area: Java bug report needs triage OS: Windows
难度 2/5 1-3 小时 新手友好度 67/100
actions/runner-images#15458 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
nwverse/persona#22164 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
-
bug 🐞
难度 2/5 1-3 小时 新手友好度 79/100
valkey-io/valkey-glide#8000 ·
维护者通常 2 天内回复
-
Declare two limitations the 2026-12-02/03 plausibility runs confirmed: Huxleys ticket link, Gretchen flyer可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭afk-ok area:data-quality importer size:S
难度 2/5 1-3 小时 新手友好度 74/100
enorm-labs/event-junkie#5887 ·
维护者通常 1 天内回复