Skip to content

fix(work-report): name hosts by bucket hostname and query their real bucket ids - #1067

Merged
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/work-report-host-names
Oct 6, 2026
Merged

ErikBjare merged 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/work-report-host-names

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Covers the Work report host select item of #1058. It's the one item #1059 lists as still open, and no other PR covers it.

Bug: src/util/workReport.ts built host names by stripping aw-watcher-window_ / aw-watcher-afk_ from bucket IDs. As a result:

  • synced devices showed up as home-desktop-synced-from-home-desktop, and Android as aw-watcher-android-synced-from-pixel-8;
  • the Work Report and Billing queries rebuilt aw-watcher-window_<host> from that name, so a selected synced host queried a bucket that doesn't exist.

Fix: group buckets by bucket.hostname (falling back to data.hostname), the same key the header device menu uses. A host can be selected when it has a desktop window bucket and an AFK bucket. The new getWorkReportHostBuckets() returns each selected host's real window/AFK bucket IDs, and both buildWorkReportQuery and buildBillingQuery query those IDs. This is the same approach buildMultideviceHostParams already takes for the Activity view (#969). Android-only hosts stay listed as disabled, labelled with their hostname.

Tests: new regression with a synced desktop and a synced Android bucket. It checks the option labels, the bucket IDs chosen per host, and the generated query. The existing snapshot is unchanged. jest (7/7), eslint, tsc --noEmit and vue-cli-service build all pass.

Not verified: a live render against an aw-server with synced buckets. The generated query is covered by the unit test. The screenshots.py --only work-report criterion in #1058 still needs a run.

Part of #1058

…bucket ids

Host names were derived from bucket ids, so synced devices appeared as
'home-desktop-synced-from-home-desktop' and Android as
'aw-watcher-android-synced-from-pixel-8'. The query then rebuilt
'aw-watcher-window_<host>' ids, which don't exist for synced buckets.

Group buckets by hostname (as the device menu does) and pass each host's
actual window/afk bucket ids to the Work Report and Billing queries.

Part of ActivityWatch#1058

Git-Session-Id: c7e4
@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Changes how work report queries identify and fetch bucket data.

The PR appears safe to merge; no actionable issue was found.

What we checked:

  • Synced bucket IDs stay intact: Both query builders use the IDs returned by getWorkReportHostBuckets, rather than adding watcher prefixes to hostnames.
  • Android activity stays excluded: isDesktopWindowBucket rejects Android watcher IDs. The shared lookup requires a desktop window bucket and an AFK bucket before either report can query a host.

Summary

Work Report and Billing now name hosts from bucket metadata and query their actual window and AFK bucket IDs.

  • Shared helpers keep host choices and queried buckets aligned.
  • Android-only hosts remain disabled.
  • New regression tests cover synced host names, chosen bucket IDs, and the Work Report query.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Bucket metadata] --> B[Group by hostname]
  B --> C[Require desktop window and AFK buckets]
  C --> D[Selected hosts and real bucket IDs]
  D --> E[Work Report query]
  D --> F[Billing query]
Loading

Reviews (1) · Last reviewed commit: "fix(work-report): name hosts by bucket h..."

@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.45%. Comparing base (95cd6b4) to head (0526d42).
⚠️ Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1067      +/-   ##
==========================================
+ Coverage   63.30%   63.45%   +0.15%     
==========================================
  Files          52       52              
  Lines        3608     3623      +15     
  Branches      892      849      -43     
==========================================
+ Hits         2284     2299      +15     
  Misses       1309     1309              
  Partials       15       15              

☔ 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.

@ErikBjare
ErikBjare merged commit 9c441bd into ActivityWatch:master Oct 6, 2026
9 checks passed
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.

2 participants