aw-sync: stale-row deletion uses timestamp identity, not tuple identity
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
sync_oneから始めて、rowid fast path の古い行を検出するループを調べます。特に、ts_set.containsと、issueで説明されているデータ不一致のチェックを確認してください。古い行かどうかの判定に完全な(timestamp, duration, data)の同一性を使うよう更新し、関連するsyncテストを実行します。古い置換行は引き続き削除される一方、異なるデータを持つ同一タイムスタンプのソースイベントは保持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
In the rowid fast path (sync_one), the stale-row detection loop deletes a dest event when:
- a chunk event exists at the same timestamp AND
- the dest event's data differs from the chunk event's data
This is correct for heartbeat watchers (fragments never share an exact ns-precision timestamp), but is wrong if two distinct source events happen to share a timestamp. The later source event arriving in the chunk would cause deletion of the earlier dest copy, and the original cannot be restored once the rowid cursor advances past it.
In practice this case does not occur in any current AW watcher (window, afk, web, app — all emit one event per state change). The risk is low, but the fix is straightforward: compare by (timestamp, duration, data) tuple rather than timestamp alone, and only mark a dest row stale if NO source event in the chunk matches its tuple identity.
Discovered via Greptile review of ActivityWatch/aw-server-rust#789 (r4205696158). The P1 "Backfills erase overlapping activity" was fixed in that PR (commit a7ac796); this is the remaining narrow case.
Fix: In sync_one, replace the ts_set.contains + data mismatch check with a full tuple check:
if !chunk.iter().any(|e| e.timestamp == d.timestamp && e.duration == d.duration && e.data == d.data) {
stale.push(id);
}
This preserves intended behavior (delete stale replacements) while not deleting events that still exist in the source with different data at the same timestamp.
- 主要言語
- Rust
- スター
- 320
- フォーク
- 101
- 平均マージ
- 3日 17時間
- マージ済み PR(30日)
- 47
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ActivityWatch/aw-server-rust のほかの issue
-
Correctness bugs: heartbeat cache, query cache invalidation, commit rollback state対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンenhancement
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
ActivityWatch/aw-server-rust#825 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
aw-sync: rowid upgrade bootstrap does not recover backfills lost under the old timestamp cursorオープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
ActivityWatch/aw-server-rust#793 ·
メンテナーはふだん 3 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
ActivityWatch/aw-server-rust#790 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
ActivityWatch/aw-server-rust#717 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
-
aw-sync: no stored cursor — resume-from-destination silently never syncs late-arriving events対応中かも @TimeToBuildBob が 24 日前に担当しました。 オープンbug
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
ActivityWatch/aw-server-rust#696 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
ActivityWatch/aw-server-rust の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
dekobon/big-code-analysis#1729 ·
メンテナーはふだん 1 日以内に返信
-
bug help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
akitaonrails/ai-memory#1888 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
peteonrails/voxtype#941 ·
メンテナーはふだん 4 日以内に返信
-
bug priority:medium triage:maintainable
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ccusage/ccusage#2000 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信