Skip to content

fix: browser query passes literal {default_limit} instead of 100#110

Merged
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
fanxing11:fix/browser-query-limit-interpolation
May 27, 2026
Merged

fix: browser query passes literal {default_limit} instead of 100#110
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
fanxing11:fix/browser-query-limit-interpolation

Conversation

@fanxing11
Copy link
Copy Markdown
Contributor

The browser query block in fullDesktopQuery uses a plain """ string, but {default_limit} only gets interpolated inside an f-string.

The base query block a few lines above already uses f""" correctly for the same variable — the browser block just missed the f prefix.

# before (plain string — {default_limit} is literal text)
query += """
    browser_urls = limit_events(browser_urls, {default_limit});
"""

# after (f-string — resolves to 100)
query += f"""
    browser_urls = limit_events(browser_urls, {default_limit});
"""

One-character fix: add f to the string prefix.

The browser-related query block in fullDesktopQuery used a plain
triple-quoted string instead of an f-string, so {default_limit} was
passed as a literal string to the query engine rather than being
replaced with 100.

The base query block above already used an f-string correctly for
the same variable.
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 26, 2026

Greptile Summary

This PR fixes a bug where the browser query block inside fullDesktopQuery used a plain string instead of an f-string, causing the literal text {default_limit} to be passed to limit_events rather than the integer value 100.

  • The one-character change ("""f""" on line 277) aligns the browser block with the base query block above it, which already correctly used an f-string for the same {default_limit} variable.
  • No other string blocks in the function use {default_limit}, so no further changes are needed.

Confidence Score: 5/5

Safe to merge — this is a single-character typo fix that corrects a silent data corruption in the browser query path.

The change correctly adds the f prefix to a multi-line string that interpolates {default_limit}. Without this fix, limit_events receives the literal string {default_limit} as its limit argument instead of 100, silently breaking browser URL/domain limiting for any user with browser watchers configured. The fix is minimal, targeted, and matches the pattern already used in the base query block directly above it.

No files require special attention — only aw_client/queries.py is changed, and the fix is straightforward.

Important Files Changed

Filename Overview
aw_client/queries.py Adds f prefix to the browser query string block so {default_limit} is interpolated to 100 instead of passed as the literal text {default_limit}.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[fullDesktopQuery called] --> B["Build base query (f-string)\napp_events = limit_events(app_events, 100)\ntitle_events = limit_events(title_events, 100)"]
    B --> C{params.bid_browsers?}
    C -- Yes --> D["Append browser block (f-string) ✅ fixed\nbrowser_urls = limit_events(browser_urls, 100)\nbrowser_domains = limit_events(browser_domains, 100)"]
    C -- No --> E["Append empty browser block (plain string)\nbrowser_events = []\nbrowser_urls = []"]
    D --> F["Append RETURN block (plain string)"]
    E --> F
    F --> G[Return query string]
Loading

Reviews (1): Last reviewed commit: "fix: use f-string for browser query so d..." | Re-trigger Greptile

@ErikBjare ErikBjare merged commit 14e7497 into ActivityWatch:master May 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.

3 participants