Skip to content

fix: match Helium with chrome web watcher bucket#898

Draft
vp275 wants to merge 2 commits into
ActivityWatch:masterfrom
vp275:codex/helium-chrome-web-bucket
Draft

fix: match Helium with chrome web watcher bucket#898
vp275 wants to merge 2 commits into
ActivityWatch:masterfrom
vp275:codex/helium-chrome-web-bucket

Conversation

@vp275

@vp275 vp275 commented Jul 4, 2026

Copy link
Copy Markdown

Summary

  • Match Helium for Chrome web watcher buckets when no dedicated Helium bucket exists.
  • Avoid matching Helium through the Chrome bucket when an aw-watcher-web-helium_* bucket is also present.
  • Add regression tests for both bucket configurations.

Why

Helium can install and run the Chrome Web Store ActivityWatch extension, which reports URL events into an aw-watcher-web-chrome_* bucket. In that setup, the active window app name is Helium, so the Chrome bucket filter would otherwise drop those browser events even though the data exists.

The PR now also guards the edge case where both a Chrome-extension bucket and a dedicated Helium bucket are present, so the same Helium browsing activity is not claimed by both browser paths.

Test

npm test -- --selectProjects node --runTestsByPath test/unit/queries.test.node.ts
npx prettier --check src/queries.ts test/unit/queries.test.node.ts

@greptile-apps

greptile-apps Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds Helium to the Chrome browser app-name regex so that URL events reaching an aw-watcher-web-chrome_* bucket — produced by the Chrome Web Store ActivityWatch extension running inside Helium — are no longer silently dropped when the active window is "Helium".

  • src/queries.ts: Appends helium as an alternation to the anchored Chrome regex (^(google[-_ ]?chrome|chrome|chromium|helium)), with an explanatory comment distinguishing this from the existing standalone helium browser entry.
  • test/unit/queries.test.node.ts: Adds 'Helium' to the Chrome positive-match test list and updates the leading historical comment to reflect the new entry.

Confidence Score: 4/5

Safe to merge for the common case; a narrow edge case exists where users with both a Chrome-extension bucket and a Helium-native bucket could see URL visits counted twice.

The regex change is minimal and correctly scoped to the chrome bucket filter. The test additions are appropriate. The only concern is that helium now appears in both the chrome pattern and the standalone helium entry, which could double-count events for the small subset of users running both the Chrome Web Store extension and a Helium-native watcher simultaneously.

The helium entry at the bottom of browser_appname_regex in src/queries.ts interacts with the newly modified chrome entry — worth a second look for anyone who later adds deduplication logic.

Important Files Changed

Filename Overview
src/queries.ts Adds helium to the Chrome app-name regex so Helium browser events reaching an aw-watcher-web-chrome bucket are matched; creates a minor overlap with the existing standalone helium entry that uses a separate, unanchored pattern.
test/unit/queries.test.node.ts Adds Helium to the positive-match list for the Chrome regex test; updates the leading comment to reflect the new entry. No negative/false-positive test for Helium is added, which is acceptable given the specificity of the name.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Active window app: Helium] --> B{Which web-watcher bucket exists?}

    B -->|aw-watcher-web-chrome_* only| C[chrome regex matches Helium\nvia new helium alternation]
    B -->|aw-watcher-web-helium_* only| D[helium regex matches Helium\nvia existing unanchored pattern]
    B -->|Both buckets present| E[Both regexes match Helium]

    C --> F[URL events counted under Chrome browser entry]
    D --> G[URL events counted under Helium browser entry]
    E --> H[URL events counted TWICE\nonce under Chrome, once under Helium]

    style H fill:#ffcccc,stroke:#cc0000
    style F fill:#ccffcc,stroke:#006600
    style G fill:#ccffcc,stroke:#006600
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Active window app: Helium] --> B{Which web-watcher bucket exists?}

    B -->|aw-watcher-web-chrome_* only| C[chrome regex matches Helium\nvia new helium alternation]
    B -->|aw-watcher-web-helium_* only| D[helium regex matches Helium\nvia existing unanchored pattern]
    B -->|Both buckets present| E[Both regexes match Helium]

    C --> F[URL events counted under Chrome browser entry]
    D --> G[URL events counted under Helium browser entry]
    E --> H[URL events counted TWICE\nonce under Chrome, once under Helium]

    style H fill:#ffcccc,stroke:#cc0000
    style F fill:#ccffcc,stroke:#006600
    style G fill:#ccffcc,stroke:#006600
Loading

Comments Outside Diff (1)

  1. src/queries.ts, line 266-279 (link)

    P2 Potential double-counting when both bucket types exist

    helium now appears in both the chrome regex (line 267, anchored ^) and the standalone helium entry (line 278, unanchored). These operate on different buckets — a aw-watcher-web-chrome_* bucket and a aw-watcher-web-helium_* bucket respectively. If a user simultaneously has both buckets while running Helium (i.e. the Chrome Web Store extension AND a Helium-native watcher are both installed), every URL visit whose active window is "Helium" will be counted twice: once under the chrome browser entry and once under the helium browser entry. This is an edge case but worth documenting or guarding against via deduplication if both buckets are detected for the same host.

Reviews (1): Last reviewed commit: "fix: match Helium with chrome web watche..." | Re-trigger Greptile

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