flood, filter_period_intersect and query2 string parsing return wrong results on valid input
Maintainer thường phản hồi trong vòng 6 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 22/100
Hướng nghiên cứu
Start with aw_transform/flood.py (final normalize pass, around line 158) and aw_transform/filter_period_intersect.py (cursor logic at lines 53-56); the reproductions in the issue give exact inputs to run. Bug 3 is a smaller, self-contained fix in aw_query/query2.py, where the escape check must track whether the preceding backslash is itself escaped. Done means the three reproduction cases return the expected events and strings ending in an escaped backslash parse. The flood fix needs a sweep-line redesign, so this is not a first-timer task as a whole.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
These three wrong results came out of a bug hunt on master (4496e2e). Each was reproduced twice: once by the reviewer and once independently. None of them is covered by an open issue or PR. Fixes for two other findings are open separately: #208 (filter_keyvals_regex on non-string values) and #209 (unclosed list/dict literals).
1. flood drops the tail of an event that contains a nested event with different data
aw_transform/flood.py, final normalize pass, around line 158. The outer event is cut at the nested event's start, and the part after the nested event ends is never restored.
flood([ev(0, 600, url="a.com"), ev(100, 100, url="b.com")])
# observed: a.com [0,100) and b.com [100,200), total 200s
# expected: a.com [200,600) as well, total 600s
You hit this with flood(concat(...)) across buckets, or with one bucket written by two watcher instances. The time gets undercounted rather than deduplicated. A correct fix needs a sweep-line normalize pass. Putting the tail back inside the current loop breaks the sort invariant for later overlapping events.
2. filter_period_intersect loses time when input events overlap each other
aw_transform/filter_period_intersect.py:53-56. Once an event runs past the end of a filter event, the cursor moves on, so a later input event that starts inside that filter period is skipped.
filter_period_intersect([ev(0, 10, title="long"), ev(2, 2, title="short")],
[ev(0, 3, status="not-afk"), ev(5, 5, status="not-afk")])
# observed: long [0,3) and long [5,10); "short" is missing (expected short [2,3))
You hit this with custom queries that concat several browser or window buckets and then filter by not-afk.
3. query2 strings cannot end in an escaped backslash
aw_query/query2.py treats a quote as escaped whenever the previous character is \, even when that backslash is itself escaped (\\). The string never closes.
RETURN = "C:\\"; -> QueryParseException: Failed to parse string
A category rule whose regex ends in a literal backslash (for example a Windows path, serialized the way aw-webui does it) therefore breaks every Activity query on the Python aw-server.
Also observed, lower priority: on the Python server, user-supplied regexes in categorize and filter_keyvals_regex run on backtracking re. A pattern like (.*)*X$ against a 28-character title held the GIL for about 20s. aw-server-rust is not affected.
Lower priority (reproduced once by the reviewer only; not independently re-run)
categorizeaccepts a category name given as a string instead of a list and splits it into characters:"Programming"becomes['P','r',...], ranked by string length (classify.py:210,282). aw-server-rust rejects this input.simplify_window_titlesraises an uncaughtKeyErrorfor events without the key (simplify.py:19), which shows up as an HTTP 500 rather than a query error.- Deeply nested literals: parse cost is depth × size, about 31s for a 1MB payload at depth 900. 1000 nested
[raise a rawRecursionError, and a 5000-digit integer a rawValueError. - The
_compiled_rules_cacheand_plan_cacheinclassify.pylimit the number of entries but not their size. 16 largecategorizerule sets pinned about 560MB. Event.__eq__ignoresidbut__ne__is inherited fromdict, soa == banda != bcan both beTrue.AW_PROFILEis not sanitized:../..moves the data directory outside theactivitywatch-*dirs.
- Ngôn ngữ chính
- Python
- Star
- 65
- Fork
- 74
- Merge trung bình
- 6 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ActivityWatch/aw-core
-
SqliteStorage: every aw-server request returns 500 (connection is bound to the startup thread)Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
ActivityWatch/aw-core#211 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Peewee explicit event IDs can move events between bucketsCó thể đã có người làm @TimeToBuildBob đã nhận 28 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
ActivityWatch/aw-core#195 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Peewee range queries omit accepted events longer than 24 hoursCó thể đã có người làm @TimeToBuildBob đã nhận 28 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
ActivityWatch/aw-core#194 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
ActivityWatch/aw-core#174 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
ActivityWatch/aw-core#78 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 6 ngày
Tất cả issue của ActivityWatch/aw-core
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mloda-ai/mloda-plugin-template#206 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
integration: websocket_api
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
home-assistant/core#194618 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Shorten and organize the README around reader tasksCó thể đã có người làm @msaad00 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Hidden joints can't be re-shownĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
5hyuns/maya-workflow-kit-for-blender#568 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
letsrevel/revel-backend#1558 ·
Maintainer thường phản hồi trong vòng 1 ngày