Skip to content

fix(queries): preserve Unicode categories in generated AQL - #161

Open
TimeToBuildBob wants to merge 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/unicode-category-aql
Open

TimeToBuildBob wants to merge 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/unicode-category-aql

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Problem

Canonical query generation uses JSON's default ASCII escaping, but AQL strings do not decode JSON \uXXXX escapes. A category such as Arbete ä becomes a literal Arbete \u00e4, and astral regexes such as 😀 become surrogate-pair escapes that fail to match. Selected-category filters have the same serialization boundary.

Change

  • Emit literal Unicode for rules and category filters with ensure_ascii=False.
  • Preserve the existing regex backslash processing and quote handling; no parser or settings-ownership change.
  • Exercise real generated AQL against MemoryStorage for desktop, Android and multidevice queries. The multidevice fixture retains both devices in nonoverlapping intervals.

Verification

  • Before repair: 9 failed, 9 passed parameterized cases; Unicode labels/astral regexes fail, ASCII/BMP-regex/quote/backslash controls pass.
  • After repair: 32 query tests passed, including matching/nonmatching filters for all 18 cases.
  • Repository's non-live/noninteractive test slice: 140 passed (same exclusions as make test: client integration, interactive failqueue, platform-dependent auth).
  • Black check: both changed files clean; Ruff: test file clean. Changed production module has one pre-existing UP031 at the unrelated always-active % formatter, reproduced from unchanged base; no formatting rewrite included.
  • No live ActivityWatch server, user data, release or deployed behavior claim.

This is independent of #160 (selected-instance rule ownership) and #143 (caller parameter immutability).

Git-Session-Id: 670dfce3-bf1a-4ded-b3f6-58085f927ef0
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Preserves Unicode in generated AQL by adding ensure_ascii=False when serializing category rules and selected-category filters.

  • Generated queries keep Unicode category names and filters intact.

No actionable issues found. Tests were inspected but not run during this review.

Reviews (1) · Last reviewed commit: "fix(queries): preserve Unicode categorie..." · Reviewed by Greptile

Git-Session-Id: 2eea427c-94cb-5b97-b459-0d6ce206143a
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Fixed the CI setup failure in edc3847: ubuntu-latest now resolves to Ubuntu 26.04, where setup-python cannot install Python 3.9. Pinned only the Linux Build leg to ubuntu-24.04, matching the verified repair on #154. Python 3.9 and the Windows/macOS legs are unchanged.

Verified locally with Python 3.9.25: 140 tests passed, mypy clean across 30 source files, and workflow YAML/matrix validation passed. The Unicode fix is unchanged. Hosted checks on the new head are still the acceptance gate; no CI-green claim yet.

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

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