fix: scan watermark を導入して targeted fetch によるギャップ取りこぼしを解消#279
Merged
Conversation
crawl の stopBefore に githubRawData.updatedAt の MAX を使っていたため、 webhook 由来の targeted fetch が max を先に進めてしまい、ギャップ中に マージされた古い PR が次の full crawl の stopBefore の向こうに置き去り になるバグを修正。 repositories テーブルに scanWatermark カラムを追加し、full-sweep crawl が完走したときだけ前進させる。targeted fetch (prNumbers 指定) と 部分失敗時は watermark を動かさない。 Closes #278
getScanWatermark() 呼び出しは getOrganization が既に repositories に含めて ロードしているため冗長。repo.scanWatermark を直接参照することで per-repo の DB 往復と step.run オーバーヘッドを削減。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
サイズ比較だと savedPrNumbers に無関係な番号が混ざったケースで 誤って前進してしまう可能性があった。pure function としての 防御性を上げるため、prsToFetch の各番号が savedPrNumbers に 含まれることを明示的に確認する。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (9)
📝 Walkthroughウォークスルーリポジトリの「スキャン済みの範囲」を表すウォーターマークを導入する変更。webhook由来の限定的な取得(targeted fetch)とは別に、full-sweep crawlのみが境界値を進める仕組みに替え、ギャップ期間の取りこぼしバグを防止します。データベース、ストア層、crawlジョブロジックにおいて関連する複数の変更を含みます。 変更内容
推定レビュー工数🎯 3 (Moderate) | ⏱️ ~25 分 関連する可能性のあるPR
詩
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #278
Summary
crawlのstopBeforeにgithubRawData.updatedAtの MAX を使っていたため、webhook 由来の targeted fetch (prNumbers指定) が MAX を先に進め、ギャップ中にマージされた古い PR が次の full crawl のstopBeforeの向こうに置き去りになるバグがあったrepositoriesにscanWatermarkカラムを追加し、full-sweep crawl が完走したときだけ前進させる。targeted fetch と部分失敗時は一切触らないcomputeAdvancedScanWatermarkとして純粋関数に抽出し、不変条件を JSDoc に明記 + 単体テストで縛る変更点
repositories.scan_watermark TEXT NULL追加、マイグレーションで既存 raw data のMAX(updated_at)からバックフィルbatch/github/store.ts:getLatestUpdatedAt→getScanWatermark/setScanWatermarkapp/services/jobs/crawl.server.ts:stopBeforeのソースを watermark に切り替え、完走時に前進app/services/jobs/scan-watermark.ts: 純粋ロジック + 単体テスト(crawl watermark と PR updatedAt MAX の兼用による取りこぼしバグ #278 シナリオの end-to-end 再現を含む)不変条件 (
computeAdvancedScanWatermark)対象外
Test plan
pnpm validate(lint, format, typecheck, build, test 317件) greenscan-watermark.test.tsで crawl watermark と PR updatedAt MAX の兼用による取りこぼしバグ #278 シナリオを再現して fix を検証store.test.tsで targetedsavePrDataが watermark を動かさないことを確認🤖 Generated with Claude Code
Summary by CodeRabbit
リリースノート
新機能
テスト