Skip to content

fix(worker): shorten processed-event retention window 7d -> 3d#241

Merged
liplus-lin-lay merged 1 commit into
mainfrom
240-shorten-processed-event-retention-window-from-7-to-3-days
Jun 26, 2026
Merged

fix(worker): shorten processed-event retention window 7d -> 3d#241
liplus-lin-lay merged 1 commit into
mainfrom
240-shorten-processed-event-retention-window-from-7-to-3-days

Conversation

@liplus-lin-lay

Copy link
Copy Markdown
Member

概要

処理済み(mark_processed 済み)webhook イベントの保持期間を 7 日 → 3 日 に短縮する。PURGE_AFTER_DAYS の既定値と、連動する store 定数・docs・README・テストコメントを一括で揃えた。

Closes #240

背景・判断

  • 処理済みイベントは消費済み。list_pending 系は processed=0 のみ参照し、処理済み窓を読むのは get_event の事後 lookback だけ。
  • 再 delivery は INSERT OR REPLACE(同一 id 上書き)で捌いており、処理済み窓は dedup horizon ではない。→ 構造依存ゼロ。短縮の blast radius は「3〜7 日前の処理済みイベントを get_event で遡れない」のみで、get_event の floor として 3 日は十分。
  • 動機は整頓(feat(worker): time-based retention sweep for unprocessed events via DO alarm #237 で導入した retention 仕様の調整)。ストレージ主因は未処理 90 日側のため、そちらは変更しない(3/90 の非対称は意図的)。

変更内容

  • worker/wrangler.toml: PURGE_AFTER_DAYS "7""3"
  • worker/src/store.ts: DEFAULT_PURGE_DAYS 73、sweep doc comment / 非対称コメント同期
  • README.md / mcp-server/README.md: retention 表の 73 days、非対称注記同期
  • docs/0-requirements.md / .ja.md: F2.4 / F2.5 / N2.7 / N2.8 の「既定 7」「7 日」表記を 3 に同期
  • worker/test/workers/store.test.ts: stale な「7-day / default 7」コメントを 3 に同期

テスト

  • アサート値は within-window 行が −1d/−2d、swept 行が −30d のため、既定 3 でも数値不変(コメントのみ stale 化していた)。
  • npm test 全 green(tsx node 54 件 + worker pool 35 件)。npm run typecheck clean。

release type

patch(既存 retention 仕様の内部値調整、変更規模 小)

処理済み (mark_processed 済み) webhook イベントの保持期間を 7 日から 3 日へ短縮する。
処理済み窓に構造依存は無く (再 delivery は INSERT OR REPLACE で捌き、list_pending 系は
processed=0 のみ参照)、唯一の用途は get_event の事後 lookback。3 日でその floor は十分。
ストレージ主因の未処理 90 日側は変更しない (3/90 の非対称は意図的)。

- worker/wrangler.toml: PURGE_AFTER_DAYS 7 -> 3
- worker/src/store.ts: DEFAULT_PURGE_DAYS 7 -> 3, doc comment / asymmetry note 同期
- README.md / mcp-server/README.md: retention 表 7 -> 3 days
- docs/0-requirements(.ja).md: F2.4 / F2.5 / N2.7 / N2.8 表記同期
- worker/test/workers/store.test.ts: stale な 7-day コメント同期 (アサート値 30/1d は不変、全 green)

Closes #240
@liplus-lin-lay liplus-lin-lay linked an issue Jun 26, 2026 that may be closed by this pull request
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
github-webhook-mcp 16370fe Jun 26 2026, 10:17 AM

@liplus-lin-lay liplus-lin-lay left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI self-review (auto mode)

  • diff 範囲: 全 7 ファイルが「処理済み保持 7→3」一点に閉じている。挙動ロジックの変更は DEFAULT_PURGE_DAYS 定数と env 既定値のみ。sweep / mark_processed / dedup の制御フローは無改変。
  • 未処理側不変: UNPROCESSED_PURGE_AFTER_DAYS=90 は据置。3/90 の非対称注記を全箇所で同期済み。
  • docs-as-source-of-truth: README ×2 + docs ×2(F2.4/F2.5/N2.7/N2.8)を同 PR 内で同期。分割なし。
  • テスト: within-window 行が −1d/−2d、swept 行が −30d のため既定 3 でもアサート不変。npm test 全 green(node 54 + worker pool 35)、typecheck clean。stale コメントのみ追従修正。
  • release type: patch(既存 retention 仕様の内部値調整、user/system observable 影響は軽微)。
  • 残コメント / TODO: なし。grep で処理済み保持に紐づく 7 残存ゼロを確認済み。

判定: APPROVE 相当。マージ可。

@liplus-lin-lay liplus-lin-lay merged commit 9a01557 into main Jun 26, 2026
3 checks passed
@liplus-lin-lay liplus-lin-lay deleted the 240-shorten-processed-event-retention-window-from-7-to-3-days branch June 26, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shorten processed-event retention window from 7 to 3 days

1 participant