Skip to content

fix: recover category builder loading on Android - #992

Draft
0xbrayo wants to merge 1 commit into
ActivityWatch:masterfrom
0xbrayo:fix/category-builder-loading
Draft

0xbrayo wants to merge 1 commit into
ActivityWatch:masterfrom
0xbrayo:fix/category-builder-loading

Conversation

@0xbrayo

@0xbrayo 0xbrayo commented Sep 20, 2026

Copy link
Copy Markdown
Member

The category builder can remain on “Loading…” when bucket discovery, category loading, or the event query fails. Android installations whose only hostname is unknown also require an unnecessary manual hostname selection.

Handle initialization and queries through the same error/retry path, select a sole unknown host, and ignore superseded responses. Query existing bucket IDs, show an empty state for unsupported hosts, and preserve the selected hostname and dates when reopening options. Desktop AFK filtering remains enabled by default, and ScreenTime retains its title handling.

Validation:

  • 363 unit tests pass, including 13 new category-builder regression cases.
  • ESLint passes for both changed files.
  • Android-targeted webpack build (make build ON_ANDROID=1) and Vite build pass.
  • Regression tests reproduce failures on the base revision before the fix.

Addresses ActivityWatch/aw-android#123. The Android app will need to consume the merged web UI through its aw-server-rust dependency; this PR does not update those submodule pointers. Android device testing has not been performed for this change.

@codecov

codecov Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.49%. Comparing base (22cb53b) to head (e0f5281).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #992      +/-   ##
==========================================
+ Coverage   57.62%   59.49%   +1.86%     
==========================================
  Files          51       51              
  Lines        3219     3219              
  Branches      751      791      +40     
==========================================
+ Hits         1855     1915      +60     
+ Misses       1348     1288      -60     
  Partials       16       16              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@greptile-apps

greptile-apps Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with the new initialization, retry, bucket-selection, and stale-response behavior covered by focused tests.

Summary

This PR makes Category Builder initialization and querying recoverable while improving support for Android, ScreenTime, and synchronized bucket IDs.

  • Routes bucket discovery, category loading, and event-query failures through a retryable error state.
  • Automatically selects a sole host, including the legacy Android unknown hostname.
  • Uses discovered bucket IDs and displays an unsupported-host empty state when no activity bucket is available.
  • Prevents superseded requests from replacing current results or clearing the current loading state.
  • Preserves query options across panel remounts and adds focused regression coverage.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Mount or query options change] --> B[Start request and snapshot options]
  B --> C[Load bucket metadata]
  C -->|Failure| E[Show retryable error]
  C -->|No hostname| D{Exactly one host?}
  D -->|Yes| F[Select hostname]
  F --> A
  D -->|No| G[Show hostname empty state]
  C -->|Hostname selected| H{Available bucket type}
  H -->|Window and AFK| I[Use discovered desktop bucket IDs]
  H -->|Android or ScreenTime| J[Use mobile bucket ID]
  H -->|Neither| K[Show unsupported-host state]
  I --> L[Load categories and query events]
  J --> L
  L -->|Failure| E
  L -->|Superseded| M[Ignore response]
  L -->|Current success| N[Render common phrases]
Loading

Reviews (1) · Last reviewed commit: "fix: recover category builder loading on..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant