flood, filter_period_intersect and query2 string parsing return wrong results on valid input
I maintainer di solito rispondono entro 6 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 22/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 65
- Fork
- 74
- Merge medio
- 6g 14h
- PR unite (30g)
- 13
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ActivityWatch/aw-core
-
SqliteStorage: every aw-server request returns 500 (connection is bound to the startup thread)Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
ActivityWatch/aw-core#211 · 1 commento ·
I maintainer di solito rispondono entro 6 giorni
-
Peewee explicit event IDs can move events between bucketsForse già presa @TimeToBuildBob l’ha presa 28 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
ActivityWatch/aw-core#195 ·
I maintainer di solito rispondono entro 6 giorni
-
Peewee range queries omit accepted events longer than 24 hoursForse già presa @TimeToBuildBob l’ha presa 28 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
ActivityWatch/aw-core#194 · 1 commento ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
ActivityWatch/aw-core#174 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
ActivityWatch/aw-core#78 · 4 commenti ·
I maintainer di solito rispondono entro 6 giorni
Tutte le issue di ActivityWatch/aw-core
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
mloda-ai/mloda-plugin-template#206 ·
I maintainer di solito rispondono entro 1 giorno
-
integration: websocket_api
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
home-assistant/core#194618 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Shorten and organize the README around reader tasksForse già presa @msaad00 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
5hyuns/maya-workflow-kit-for-blender#568 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
letsrevel/revel-backend#1558 ·
I maintainer di solito rispondono entro 1 giorno