Skip to content

fix(queries): use real bucket ids for synced hosts in single-host views - #1068

Merged
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/real-bucket-ids-single-host-views
Oct 6, 2026
Merged

ErikBjare merged 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/real-bucket-ids-single-host-views

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Same bug class as #969 (Activity multi-device), #970 (Timeline) and #1067 (Work Report), in the six views that remained.

Bug: Search, Report, Graph, Alerts, Trends and Category Builder build the query bucket IDs by hand: 'aw-watcher-window_' + host and 'aw-watcher-afk_' + host. Buckets synced via aw-sync keep their hostname but have a -synced-from-<device> suffix in their ID. So when you pick a synced host in any of these views (their host pickers list synced hostnames), the query asks for a bucket that doesn't exist and fails with BucketNotFound.

Fix: a desktopBucketIds(host) getter on the buckets store returns { bid_window, bid_afk } from the host's actual buckets (bucketsWindow(host)[0], bucketsAFK(host)[0]). When no matching bucket is loaded it falls back to the conventional ID, so behaviour for local hosts and for an unloaded store is unchanged. All six call sites use it. Each one is a two-line swap. queries.ts keeps its conventional default because host_params from buildMultideviceHostParams override it.

Tests: new store tests cover a synced host, a local host and the unloaded fallback. Full jest suite passes (483/483), along with eslint, tsc --noEmit and vue-cli-service build.

Not verified: a live render with synced buckets on a running server.

Search, Report, Graph, Alerts, Trends and Category Builder built
'aw-watcher-window_<host>' / 'aw-watcher-afk_<host>' by hand. Buckets
synced via aw-sync carry a '-synced-from-<device>' suffix, so selecting a
synced host in these views queried a bucket that doesn't exist.

Add a desktopBucketIds(host) getter to the buckets store that returns the
host's actual window/afk bucket ids, falling back to the conventional ids
when none are loaded, and use it at all six call sites. Same fix the
Activity view got in ActivityWatch#969.

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 bucket IDs are resolved in data queries.

This PR appears safe to merge; no actionable issues were found.

What we checked:

  • Synced hosts use loaded buckets: QueryOptions gets its hostname choices from bucketsStore.hosts. Once a synced host is selectable, desktopBucketIds can read its stored IDs.

Summary

Adds desktopBucketIds to resolve desktop bucket IDs from the selected host’s stored buckets instead of guessing their names.

  • Updates Search, Report, Graph, Alerts, Trends, and Category Builder.
  • Keeps conventional IDs as the fallback when matching buckets are unavailable.
  • Adds tests for synced hosts, local hosts, and an unloaded store.
  • No actionable issues found. No live-server or runtime verification was performed.

Reviews (1) · Last reviewed commit: "fix(queries): use real bucket ids for sy..."

@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.34%. Comparing base (95cd6b4) to head (2b2afc3).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1068      +/-   ##
==========================================
+ Coverage   63.30%   63.34%   +0.04%     
==========================================
  Files          52       52              
  Lines        3608     3612       +4     
  Branches      892      894       +2     
==========================================
+ Hits         2284     2288       +4     
+ Misses       1309     1243      -66     
- Partials       15       81      +66     

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

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click.

This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted.

@ErikBjare
ErikBjare merged commit 6812979 into ActivityWatch:master Oct 6, 2026
9 checks passed
Q-Ze added a commit to Q-Ze/aw-webui that referenced this pull request Oct 10, 2026
Upstream highlights:
- feat: custom date range period (ActivityWatch#1005)
- feat: device selection (all / subset) in Activity view (ActivityWatch#1004)
- feat: category rule priority (ActivityWatch#968)
- feat: layered category sets (ActivityWatch#1027, ActivityWatch#1072)
- feat: always show Year period (ActivityWatch#1003)
- feat: AI summary privacy filter (ActivityWatch#948)
- feat: 'Add on top of mine' import option (ActivityWatch#1071)
- fix: multidevice queries use real bucket IDs (ActivityWatch#969, ActivityWatch#1068)
- fix: timeline hourly bar Y-axis >1h (ActivityWatch#1021)
- fix: CSV streaming export (ActivityWatch#993, ActivityWatch#997)
- fix: Android browser data display (ActivityWatch#1069)
- fix: various mobile/dark-mode/layout improvements

Conflict resolution: took upstream for activity.ts (major refactor),
multidevice.ts (Android support), Activity.vue, TimelineBarChart.vue,
summary.ts. Re-applied our fixes on top:
- query_active_history: bucket_sig cache clearing + per-event interval
  union (dead-watcher marathon immunity)
- query_active_history_multidevice: bucket_sig + period-length cap
- Removed useMultidevice references (upstream removed the setting in
  favour of device-selection UI); our code paths now always aggregate
  across all hosts
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