Skip to content

fix(queries): match Dia/Arc chrome forks and surface empty Browser view - #949

Open
TimeToBuildBob wants to merge 6 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/chrome-fork-allowlist
Open

fix(queries): match Dia/Arc chrome forks and surface empty Browser view#949
TimeToBuildBob wants to merge 6 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/chrome-fork-allowlist

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Fixes #927. Complements #928 (same regex, plus the Dia bundle id and a visible empty-state).

Problem

The Browser view (Top Domains / URLs / Titles) is permanently empty in Chromium forks such as Dia. The extension works and events land in aw-watcher-web-chrome_<host>, but browserEvents() intersects those against window events whose app must match the chrome entry in src/queries.ts. Forks report themselves as "Dia" / "Arc" (and on macOS Dia, bundle id company.thebrowser.dia), so filter_period_intersect returns nothing and all three columns render "No data" with no error.

This is the same failure mode as ActivityWatch/activitywatch#1094 (Arc). A standalone arc/dia key cannot bind: browsersWithBuckets() matches on bucket id substring, and the chrome build of the extension never produces a bucket containing "arc" or "dia" unless the user overrides the browser name in the extension settings.

What this PR does

  1. Match forks through the chrome bucket (the one they actually write to):
    • Add arc and dia process-name alternatives to browser_appname_regex.chrome, each $-anchored so names like archive / Dialog do not match.
    • Add company.thebrowser.dia to browser_appnames.chrome (macOS bundle id; reverse-domain names are not matched by the process-name regex).
    • Leave the standalone arc key in place for the settings-override case.
  2. Stop the silent empty. When a browser watcher bucket exists but the window-event intersection is empty, the Browser visualizations now show an info hint pointing at Browser view empty in Dia (Chromium fork, reports app name "Dia") #927 instead of a bare "No data". This also covers the honest "didn't browse this period" case.

The regex half follows the diagnosis and patch from @TiberiusNemesis in #927 / #928. This PR adds the bundle-id path they also confirmed, plus the empty-state so the next fork reports itself instead of looking like a broken install.

Tests

  • Chrome regex covers Dia / Arc and rejects Dialog / archive.
  • Exact list contains company.thebrowser.dia.
  • Generated chrome-bucket query includes both the bundle id and the process-name regex.
  • isBrowserAllowlistMiss covers the empty / loading / no-bucket / matched cases.

npx jest --selectProjects node --testPathPattern='(queries.test.node.ts|browserAllowlist.test.node.ts)$' — 28 passed.

Out of scope

Helium is already a standalone key on master (net.imput.helium). If Helium also writes to the chrome bucket by default, that is the same bug and belongs with #898 rather than this PR.

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.55%. Comparing base (a2ca625) to head (06d1d87).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #949      +/-   ##
==========================================
+ Coverage   51.99%   52.55%   +0.55%     
==========================================
  Files          48       49       +1     
  Lines        2927     2940      +13     
  Branches      652      688      +36     
==========================================
+ Hits         1522     1545      +23     
+ Misses       1385     1315      -70     
- Partials       20       80      +60     

☔ 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 Aug 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR expands Chrome-bucket window matching to recognize Dia and Arc and adds a localized explanation when Browser analytics resolve without matching activity.

  • Adds Dia and Arc process-name matching plus Dia’s macOS bundle identifier.
  • Deduplicates the Chrome/standalone-Arc pair while continuing to concatenate unrelated browser streams.
  • Adds the Browser empty-state predicate, localized messages, and query-generation regression tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/queries.ts Extends Chrome-bucket matching for Dia and Arc and limits overlap-union behavior to the potentially duplicate Chrome/Arc pair.
src/components/SelectableVisualization.vue Displays the localized allowlist explanation for resolved empty Browser visualizations.
src/util/browserAllowlist.ts Defines the predicate distinguishing a resolved empty Browser query from loading or unavailable states.
test/unit/queries.test.node.ts Covers fork matching and generated-query combination behavior for Chrome, Arc, and unrelated browsers.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Buckets[Browser watcher buckets] --> Detect[Detect browser bucket types]
  Detect --> Query[Intersect browser events with matching active windows]
  Query --> Pair{Chrome and standalone Arc both present?}
  Pair -->|Yes| Union[Deduplicate Chrome and Arc streams]
  Pair -->|No| Concat[Concatenate browser stream]
  Union --> Others[Concatenate unrelated browser streams]
  Concat --> Results[Domain, URL, title, and duration summaries]
  Others --> Results
  Results --> Empty{Browser bucket available but result empty?}
  Empty -->|Yes| Hint[Show localized allowlist hint]
  Empty -->|No| Visualizations[Render Browser visualizations]
Loading

Reviews (5): Last reviewed commit: "fix(queries): union only chrome+Arc dupl..." | Re-trigger Greptile

Comment thread src/queries.ts
Comment thread src/components/SelectableVisualization.vue Outdated
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

CI-green and mergeable — 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.

Comment thread src/i18n/locales/de.ts Fixed
Comment thread src/i18n/locales/en.ts Fixed
Comment thread src/i18n/locales/ru.ts Fixed
Comment thread src/i18n/locales/uk.ts Fixed
Comment thread src/i18n/locales/zh-CN.ts Fixed
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread src/queries.ts Outdated
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Current head 17feed1 is fully converged: all nine CI/CodeQL/Greptile checks pass, Greptile reviewed this exact head at 5/5 with no blocking findings, and GitHub reports it cleanly mergeable. Bob still has pull-only access here, so the remaining action is maintainer review/merge.

@ErikBjare

Copy link
Copy Markdown
Member

@TimeToBuildBob Merged #928, address conflicts

@TimeToBuildBob
TimeToBuildBob force-pushed the fix/chrome-fork-allowlist branch from 17feed1 to 50c1501 Compare August 31, 2026 15:16
@TimeToBuildBob

TimeToBuildBob commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto master, then scoped union_no_overlap to the chrome+Arc duplicate pair (head 514a1fc). Conflicts were the overlapping chrome regex/tests from #928 — kept that regex as landed.

What's in this PR:

  • company.thebrowser.dia on the exact chrome list (macOS bundle id; reverse-domain names still don't match the process-name regex)
  • empty-state hint when a watcher bucket exists but the window intersection is empty
  • union_no_overlap only for chrome + standalone Arc (other browsers still concat)
  • Swedish browserAllowlistMiss (sv.ts landed on master after this PR opened)

CI green, Greptile 5/5. Bob has pull-only access here — remaining action is maintainer review/merge.

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread src/queries.ts Outdated
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

@TimeToBuildBob
TimeToBuildBob force-pushed the fix/chrome-fork-allowlist branch from 514a1fc to 8cf736b Compare September 3, 2026 09:42
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Rebased onto current master and force-pushed head 8cf736b. The only conflict was the shared import block in test/unit/queries.test.node.ts; I kept both master’s newer appQuery/categoryQuery regression coverage and this PR’s browser_appnames/fullDesktopQuery coverage.

Verified locally: 29 targeted tests pass across queries.test.node.ts and browserAllowlist.test.node.ts. GitHub now reports the PR mergeable; fresh CI is running.

Chromium forks run the chrome extension, so web events land in the
chrome bucket while aw-watcher-window reports app names like "Dia".
Nothing in the chrome patterns matched, so filter_period_intersect
returned empty and Top Domains/URLs/Titles silently showed "No data".

Add Dia/Arc process-name alternatives to the chrome regex, the Dia
macOS bundle id to the exact list, and an info hint when a browser
bucket exists but the window intersection is empty.

Fixes ActivityWatch#927.

Git-Session-Id: 47fd40d1-68e2-5710-b21c-e61a21b8e5cd
Git-Session-Id: 47fd40d1-68e2-5710-b21c-e61a21b8e5cd
Git-Session-Id: 47fd40d1-68e2-5710-b21c-e61a21b8e5cd
Git-Session-Id: 47fd40d1-68e2-5710-b21c-e61a21b8e5cd
Master gained sv.ts via ActivityWatch#947 after this PR opened. Keep the empty-state
key in every locale so Swedish does not silently fall back to English.

Git-Session-Id: 47fd40d1-68e2-5710-b21c-e61a21b8e5cd
union_no_overlap across every browser bucket dropped legitimate
concurrent activity from later streams (Chrome+Firefox, etc.).
Keep concat for distinct browsers; union only the chrome/Arc pair
that can actually duplicate the same events.

Git-Session-Id: 47fd40d1-68e2-5710-b21c-e61a21b8e5cd
@TimeToBuildBob
TimeToBuildBob force-pushed the fix/chrome-fork-allowlist branch from 8cf736b to 06d1d87 Compare September 3, 2026 15:40
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Rebased onto current master (post-PR #952 feat(categories): field-scoped regex). The only conflict was the import block in test/unit/queries.test.node.ts — HEAD added canonicalEvents, this PR needed browser_appnames + fullDesktopQuery; kept both. New head 06d1d87, GitHub reports MERGEABLE/CLEAN.

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.

Browser view empty in Dia (Chromium fork, reports app name "Dia")

3 participants