Skip to content

fix(transform): use scheme as domain for file:// URLs#570

Merged
ErikBjare merged 2 commits intoActivityWatch:masterfrom
TimeToBuildBob:fix/split-url-file-domain
Feb 27, 2026
Merged

fix(transform): use scheme as domain for file:// URLs#570
ErikBjare merged 2 commits intoActivityWatch:masterfrom
TimeToBuildBob:fix/split-url-file-domain

Conversation

@TimeToBuildBob
Copy link
Contributor

@TimeToBuildBob TimeToBuildBob commented Feb 27, 2026

Summary

  • When split_url_event processes file://, about:, or other URLs without a host, it now uses the URL scheme as $domain instead of an empty string
  • Mirrors the same fix in the Python implementation (fix(transform): use scheme as domain for file:// URLs aw-core#129)
  • Prevents all non-web URLs from clustering together as a blank entry in "Top Browser Domains"

Test plan

  • Added test for file:///home/user/document.pdf$domain == "file"
  • Added test for about:blank$domain == "about"
  • All 37 aw-transform tests pass

Fixes ActivityWatch/aw-core#67


Important

Fix split_url_event to use URL scheme as domain for URLs without a host, preventing clustering under an empty domain.

  • Behavior:
    • In split_url_event, use URL scheme as $domain for URLs without a host (e.g., file://, about:).
    • Prevents non-web URLs from clustering under an empty domain in "Top Browser Domains".
  • Tests:
    • Added test for file:///home/user/document.pdf ensuring $domain == "file".
    • Added test for about:blank ensuring $domain == "about".
    • All 37 aw-transform tests pass.

This description was created by Ellipsis for f342ec8. You can customize this summary. It will automatically update as commits are pushed.

When splitting URLs, file://, about:, and other URLs without a host
produced an empty string for $domain. This caused all such events to
cluster together as a single empty entry in "Top Browser Domains".

Now falls back to using the URL scheme (e.g. "file", "about") as the
domain when host is None. Matches the corresponding fix in aw-core
(ActivityWatch/aw-core#129).

Fixes ActivityWatch/aw-core#67
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to f342ec8 in 8 seconds. Click for details.
  • Reviewed 52 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_FCtBlEM9V014vhZY

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@greptile-apps
Copy link

greptile-apps bot commented Feb 27, 2026

Greptile Summary

Changed split_url_event to use URL scheme as $domain for URLs without a host (e.g., file://, about:), preventing non-web URLs from clustering under an empty domain.

  • Fixed domain fallback logic on line 48: None => uri.scheme().to_string() instead of empty string
  • Added test coverage for file:/// and about: schemes
  • All 37 aw-transform tests pass
  • Mirrors the Python implementation fix for consistency

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • Simple, well-tested bug fix with clear logic change. Only 3 lines of production code modified. Two new test cases cover the fix, existing tests ensure no regression. Mirrors Python implementation for consistency.
  • No files require special attention

Important Files Changed

Filename Overview
aw-transform/src/split_url.rs Changed domain fallback from empty string to URL scheme for URLs without hosts, with comprehensive test coverage

Last reviewed commit: f342ec8

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.02%. Comparing base (656f3c9) to head (be99690).
⚠️ Report is 37 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #570      +/-   ##
==========================================
- Coverage   70.81%   68.02%   -2.80%     
==========================================
  Files          51       54       +3     
  Lines        2916     3143     +227     
==========================================
+ Hits         2065     2138      +73     
- Misses        851     1005     +154     

☔ View full report in Codecov by Sentry.
📢 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.

@ErikBjare
Copy link
Member

@TimeToBuildBob Fix lint

Also consider adding a pre-commit config that prevents committing code that doesn't pass/auto-fixes lints (catching it early), worth adding in a separate PR (along with any other pre-commit config improvements to make).

@TimeToBuildBob
Copy link
Contributor Author

Fixed — rustfmt wanted the assert_eq! on one line. Pushed be99690.

@ErikBjare ErikBjare merged commit f9faa5e into ActivityWatch:master Feb 27, 2026
7 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.

Top Browser Domain is empty if url is a file

2 participants