Repository navigation
Conversation
RegexRule::new("") compiled to a match-all regex in fancy_regex, so a
blank category rule matched every event. aw-core's Python
aw_transform.classify.Rule deliberately never matches an empty regex
("would erroneously match everything") — aw-server-rust silently
diverged from it. ActivityWatch/aw-webui#1026 hides this for the web UI
by sending blank rules as {type: 'none'}, but other clients (aw-client
categorize queries, scripts, the CLI) still see the divergence.
Add a never_matches flag set when the pattern is empty, checked before
any regex evaluation, so an empty-regex rule behaves like Rule::None
instead of a wildcard. Covered by a new regression test that fails on
master.
Also carries the aw-query clippy::block_scrutinee allow from ActivityWatch#771/ActivityWatch#772
(unrelated Rust 1.99+ toolchain drift) so this branch's own CI/clippy
passes independently of that PR's merge.
Git-Session-Id: 1d99
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #774 +/- ##
===========================================
+ Coverage 70.81% 82.59% +11.77%
===========================================
Files 51 81 +30
Lines 2916 10428 +7512
===========================================
+ Hits 2065 8613 +6548
- Misses 851 1815 +964 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Greptile P1: Rule::from(Regex::new("").unwrap()) hard-coded
never_matches: false, so the public conversion path still let an empty
regex match every event — the exact bug this PR fixes, reachable past
the new guard. Derive the flag from the source pattern and cover the
From path in the regression test.
Git-Session-Id: 2b7710f0-a6ec-5fa0-b895-bf715c0f8ab4
|
@greptileai review |
|
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. |
🤖 AI code reviewThis PR adds a Safe to merge — no P0/P1 findingsConfidence 5/5 ✅ No thread-worthy findings. Advisory notes follow; they are retained without opening review threads. 1 advisory finding (summary-only, not scored)These P2 guard, heuristic, trade-off, or documentation claims are retained for judgment without opening review threads.
This is a How this was verified: static preflight: fix-commit + touched-files scan (rule 7) Files changed (2) — the diff as I read it
Reviewed Maintainer commands
|
Summary
fancy_regex, soRegexRule::new("")silently categorized/tagged every event.aw_transform.classify.Ruledeliberately never matches on an empty regex ("would erroneously match everything"). aw-server-rust diverged from that behavior.{type: 'none'}, but other clients (aw-clientcategorizequeries, scripts, the CLI) still see the divergence.never_matchesflag onRegexRule, set when the source pattern is empty, checked before any regex evaluation on both theselect_keysand shared-values match paths.test_empty_regex_never_matches(fails on master, passes after the fix).Unrelated CI note
This branch also carries the
clippy::block_scrutineeallow from #771/#772 (Rust 1.99+ clippy toolchain drift in the generatedaw-queryparser, unrelated to this change) so this PR's own CI passes independently of whether #771 has merged yet. Once #771 merges first, that one-line diff here will disappear on rebase.Test plan
cargo test -p aw-transform— 79 passed, 0 failedcargo clippy --workspace -- -D warningscleancargo fmt --checkclean