Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

aw-sync: stale-row deletion uses timestamp identity, not tuple identity

オープン 初心者向け
#798 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
backend

調査の方向性

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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ActivityWatch/aw-server-rust のほかの issue

ActivityWatch/aw-server-rust の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。