fix(backfill): cap the Vectorize id batch at the getByIds limit [index, tests] - #214
Merged
liplus-lin-lay merged 1 commit intoAug 3, 2026
Conversation
VECTOR_BATCH_SIZE を 50 から 20 に下げ、根拠コメントを実測の上限に 書き直した。1000 は upsert 側の上限であり、getByIds は 20 で `VECTOR_GET_ERROR (code = 40007)` を返す。get / upsert 共通の 1 定数 なので、狭いほうの get に合わせれば両方を満たす。 stale が 20 を超える repo は最初の getByIds batch で throw し、D1 に 触れる前に呼び出し全体が失敗していた(本番の liplus-language / github-rag-mcp で発生)。 テスト側は getByIds stub を実物と同じく 21 件以上で 40007 を投げる ようにし、batch 分割の期待値を 20 刻みに合わせた上で、上限超過を 名指しで見張る回帰テストを 1 本追加した。 Closes #213 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
github-rag-mcp | 381939c | Aug 03 2026, 03:14 AM |
liplus-lin-lay
commented
Aug 3, 2026
liplus-lin-lay
left a comment
Member
Author
There was a problem hiding this comment.
AI self-review (auto mode)
受入基準の充足
issue #213 の対象 2 点を満たしている。
| 方針 | 結果 |
|---|---|
VECTOR_BATCH_SIZE を getByIds の実上限に合わせる |
充足。50 → 20。根拠コメントを書き直し、1000 は upsert 側の上限で getByIds は 20(error 40007)、共通定数なので狭いほうで決まる、と明示 |
| 既存 batch テストを合わせる | 充足。期待値を [50,50,20] → [20]×6 に更新 |
CI green。docs は batch size の数値を持たないため変更なし——0-requirements / installation 両言語を確認して裏取り済み。
diff 実読で確認した点
- 他の call site:
getByIdsを batch で呼ぶのはこのファイルのみ。src/pipeline/embed-issue.ts:140は単一 id の配列なので同種の欠陥は無い(grep で全 call site を確認)。 - stub の実物化:
getByIdsの stub が 21 件以上で 40007 相当を throw するようになった。指定範囲を超えた対応だが、これは有効。定数を戻せばテストが落ちる状態になり、同じ欠陥が二度目を通らない。指定どおり期待値だけ直すと、ガードの無い数値合わせに終わっていた。 - 追加テストの実効性: 定数を 50 に戻すと該当テストが落ちることを subagent が実走で確認済み。テストがガードとして機能することの検証まで含まれている。
scope の逸脱
無し。テスト stub の強化は範囲を超えるが、issue の目的(同じ欠陥を通さない)に直結するため妥当と判断した。
次のステップ
auto mode のため human gate 無し。self-review pass → merge。
残件(PR 範囲外、parent が deploy 後に実行): backfill の再実行。#212 deploy 後の本番実行で liplus-language / github-rag-mcp の 2 repo が本 issue の欠陥で失敗しており、dense を先に書く設計により部分修復は残っていない(search_docs 未変更)。この 2 repo に対して /admin/backfill-issue-state を再実行する。
liplus-lin-lay
deleted the
213-backfill-issue-state-batches-50-ids-into-getbyids-but-vectorize-caps-it-at-20
branch
August 3, 2026 03:16
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 #213
何を直したか
src/backfill-issue-state.tsのVECTOR_BATCH_SIZEを 50 から 20 に下げた。旧コメントは「documented 1000-vector batch cap の十分内側」を根拠にしていたが、1000 は
upsert側の上限であってgetByIdsの上限ではない。getByIdsは 21 件目からVECTOR_GET_ERROR (code = 40007): too many ids in payload; max id count is 20を返す。get / upsert 共通の 1 定数なので、狭いほうの get に合わせれば両方を満たす(issue の制約どおり upsert 側は 20 でも問題ない)。コメントは「両方の上限のうち小さいほうで決まる」という根拠に書き直し、どちらの API がどちらの上限を持つかを明示した。
影響
stale が 20 を超える repo では、最初の
getByIdsbatch で throw して D1 に触れる前に呼び出し全体が失敗していた。dense を sparse より先に書く設計のため部分修復は発生しておらず、失敗した repo のsearch_docsは未変更のまま。この修正で 20 件超の repo も完走する。テスト
getByIdsの stub を実物と同じ挙動にした。21 件以上を渡されたら 40007 相当のエラーを投げる。これでこのファイルの全テストが上限違反の見張りになる。[20]*6)に更新。npx tsc --noEmit/npm test(165 + 58 = 223 tests)すべて green。残件
修正後、失敗していた 2 repo(liplus-language / github-rag-mcp)への backfill 再実行が必要(issue の制約に記載)。deploy 後の運用作業なので、この PR の範囲外。
🤖 Generated with Claude Code