flood(): a zero-duration event silently blocks gap flooding between its neighbours
メンテナーはふだん 10 日以内に返信
評価
調査の方向性
Start with aw_transform/flood.py and trace how events are normalized before the adjacent-pair flooding loop. Add a regression test alongside the flood tests for the provided zero-duration marker example, and check the behavior with the default pulsetime. Done means the gap is handled consistently and the result is idempotent; the issue leaves whether zero-duration events should be preserved as an open semantic question.
索引モデルが issue の本文から書いたものです。
説明
Found this while fuzzing flood() with zero-duration events (after the #165 changes, but I rebuilt the pre-#165 code and it's the same there, so not a regression).
tl;dr: a zero-duration event between two events blocks the gap between those events from being flooded, even though the zero-duration event itself never appears in the output.
Repro on master, default pulsetime=5:
from datetime import datetime, timedelta, timezone
from aw_core.models import Event
from aw_transform.flood import flood
now = datetime(2026, 1, 1, tzinfo=timezone.utc)
def ev(off, dur, tag):
return Event(timestamp=now + timedelta(seconds=off),
duration=timedelta(seconds=dur), data={"t": tag})
# Two events with a 2s gap (16 -> 18), flooded normally:
flood([ev(9, 1, "b"), ev(9, 7, "c"), ev(18, 1, "a")])
# -> 9s+8s ("c"), 17s+2s ("a") gap filled at midpoint, 10s total
# Same events, plus a zero-duration event in between:
flood([ev(9, 1, "b"), ev(9, 7, "c"), ev(12, 0, "marker"), ev(18, 1, "a")])
# -> 9s+7s ("c"), 18s+1s ("a") gap NOT filled, 8s total
The marker never shows up in the output (the normalization pass filters out zero-duration events), but it still ate both pairwise slots: the zip(events[:-1], events[1:]) loop only looks at adjacent pairs, so the (c, a) pair is never considered for flooding.
Side effect: flood() isn't idempotent at default pulsetime — a second pass fills the gap, because by then the zero-duration event is gone:
p1 = flood([ev(9, 1, "b"), ev(9, 7, "c"), ev(12, 0, "marker"), ev(18, 1, "a")])
p2 = flood(p1)
# p1: 9s+7s ("c"), 18s+1s ("a")
# p2: 9s+8s ("c"), 17s+2s ("a") <- different
test_flood_idempotent doesn't catch this since it runs with pulsetime=0.
Possible fix direction: drop/skip duration<=0 events before the pairwise pass. But that's really a semantic question (should zero-duration events be preserved in the output at all? aw-server-rust's flood filters them out entirely), so filing this as an issue first rather than jumping to a PR.
Duplicate check: looked through the flood-related issues/PRs (#73, #105, #135, #139, #142-#146, #165) and none seem to cover this.
- 主要言語
- Python
- スター
- 65
- フォーク
- 74
- 平均マージ
- 6日 10時間
- マージ済み PR(30日)
- 9
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ActivityWatch/aw-core のほかの issue
-
Peewee explicit event IDs can move events between buckets対応中かも @TimeToBuildBob が 10 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
ActivityWatch/aw-core#195 ·
メンテナーはふだん 10 日以内に返信
-
Peewee range queries omit accepted events longer than 24 hours対応中かも @TimeToBuildBob が 10 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
ActivityWatch/aw-core#194 ·
メンテナーはふだん 10 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
ActivityWatch/aw-core#174 ·
メンテナーはふだん 10 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
ActivityWatch/aw-core#78 · コメント 4 件 ·
メンテナーはふだん 10 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
ActivityWatch/aw-core#52 · コメント 4 件 · リアクション 3 件 ·
メンテナーはふだん 10 日以内に返信
ActivityWatch/aw-core の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
igormcsouza/tether#278 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
aws-samples/sample-per-model-bedrock#803 ·
メンテナーはふだん 1 日以内に返信
-
documentation p1
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
huggingface/accelerate#4511 ·
メンテナーはふだん 1 日以内に返信
-
follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信