Repository navigation
Conversation
Port of aw-core's `merge_subwatcher_fields(base, sub, keys, conflict)` so aw-webui can enrich the canonical window stream with subwatcher fields (browser `url`/`$domain`, editor `project`/`file`/`language`) against aw-server-rust, the default server. Semantics match aw-core: base events are split at clipped subwatcher boundaries, the latest-starting overlapping subwatcher event wins a slice, adjacent equal segments collapse, and total base duration is preserved. `conflict` is optional (`base_wins` default, or `sub_wins`); an invalid value is a query error rather than a panic. Tests are translated from aw-core's test_merge_subwatcher_fields_* cases, plus a query-level test covering the 3- and 4-argument forms. Refs ActivityWatch/activitywatch#352 Git-Session-Id: c6d2ab13-a306-480c-b98f-72af2bd8d991
[Medium impact] The PR appears safe to merge; all previous findings are addressed and no new actionable issues were found. SummaryAdds
No new actionable issues were found. Tests were inspected, not run. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Base events] --> C[Sort bases and retain original indices]
B[Subwatcher events] --> D[Sort subwatchers]
C --> E[Find overlapping events]
D --> E
E --> F[Split bases and copy selected fields]
F --> G[Collapse equal neighboring slices]
G --> H[Restore original base order]
Reviews (2) · Last reviewed commit: "fix(transform): sweep expired subwatcher..." · Reviewed by Greptile |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #824 +/- ##
===========================================
+ Coverage 70.81% 85.41% +14.60%
===========================================
Files 51 88 +37
Lines 2916 12613 +9697
===========================================
+ Hits 2065 10774 +8709
- Misses 851 1839 +988 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Git-Session-Id: 9baa7529-bc4a-5a45-834e-1154f7124655
|
@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 ports aw-core's merge_subwatcher_fields transform to Rust, adding a new module in aw-transform and registering it as a query function in aw-query. It also adds unit tests in aw-transform and an integration test in aw-query covering the 3- and 4-argument forms and invalid conflict handling. Safe to merge — no P0/P1 findingsConfidence 5/5 ℹ️ Consensus was degraded on this run: 1 of 3 passes answered, so findings were filtered at 1-of-1 agreement rather than 2-of-3 — less filtered than usual; 1 of 3 fan-out jobs answered, so the findings above were filtered against less evidence than the threshold assumes. ✅ No findings in this PR's changed files. What follows is outside them — not about this change, and not scored. 1 out-of-scope finding (outside this PR's changed files)Each item here is an observation about the PR as a whole — informational only, not scored. The sweep-line active-set logic can drop a subwatcher event that starts exactly at a base event's start time when that subwatcher event also ends exactly at the base start. In the loop at lines 62-66, subwatcher events with timestamp <= base_start are added to Files changed (4) — the diff as I read it
Previous review passes
Reviewed Maintainer commands
|
Ports aw-core's
merge_subwatcher_fields(base, sub, keys, conflict)to aw-transform and registers it as a query2 function. This is the backend half of ActivityWatch/activitywatch#352 (categorize by URL): aw-webui'scanonicalEvents()can only call it once the default server has it. Supersedes the 2020 approach in #179, per the discussion there.Semantics (same as aw-core):
conflictis optional:"base_wins"(default, purely additive) or"sub_wins".Differences from the Python implementation:
conflictreturns a query error, not a panic.Tests: all nine
test_merge_subwatcher_fields_*cases from aw-core'stests/test_transforms.py, translated, plus a query-level test of the 3- and 4-argument forms and the invalid-conflicterror.cargo clippy -D warningsfails on two things this PR doesn't touch, and both also fail on master:aw-query/src/interpret.rs:439(field_reassign_with_default) and the aw-transform bench's deprecatedchunk_events_by_keycall. Clippy reports nothing in the changed files.The aw-webui wiring (browser
url/$domainintocanonicalEvents()) is a follow-up PR.