test: Workers-pool D1/FTS5 integration tests (test-leg slice 2)#169
Merged
Conversation
Second slice of the CI test leg (#165), on the Workers-realistic harness: @cloudflare/vitest-pool-workers runs tests inside workerd against a real local D1 (miniflare). Migrations from ./migrations are applied via applyD1Migrations. Covers the fts.ts D1 surface, including the #135 regression class (diff-row FTS5 upsert re-sync): - upsertFtsRow + queryFts across both tokenizers (porter / trigram) - ON CONFLICT re-upsert re-syncs the FTS5 mirror (no stale hits, no duplicate rows) - deleteFtsRow removes the row and its FTS mirror - repo / type filters, empty-query short-circuit, topK Plus pure escapeFtsQuery / tokenizerKindForType added to the node suite. Config notes: - two vitest configs: node (vitest.config.ts, slice-1 unit tests) + workers pool (vitest.workers.config.ts); `npm test` runs both. - isolatedStorage off + globally-unique vector_ids per test: the FTS5 external-content vtab corrupts under per-test snapshots and under cross-test ON CONFLICT updates. - @cloudflare/workers-types pinned via overrides to the version the worker is written against; the toolchain otherwise bumps it and breaks src/rerank.ts typing. Workers バインディング非依存の次として、実機寄り harness で D1/FTS5(#135 の面)を 統合テストした。Vectorize/AI はローカル emulation が無いため対象外で #165 に残す。 Refs #165
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
github-rag-mcp | 1034293 | Jun 21 2026, 01:07 AM |
liplus-lin-lay
commented
Jun 21, 2026
liplus-lin-lay
left a comment
Member
Author
There was a problem hiding this comment.
AI セルフレビュー (auto mode)
- ✅ CI 全 green:
testジョブで node スイート 42 + workers pool スイート 9(workerd/miniflare の実 D1)+ schema-drift +tsc --noEmit+ wrangler dry-run / Workers Builds。ローカルでも同一シーケンス + 3 回反復で D1 スイートの安定性を確認済み。 - ✅
src/Worker 本体コードは無変更。差分はテスト(fts.workers.test.ts/test-env.d.ts/fts.test.ts追記)+ vitest 設定2本 + package(pool-workers 追加・workers-types 固定)。 - ✅ #135 の回帰クラス(diff 行 FTS5 upsert 再同期)を実 D1 で pin。known-answer / 構造不変条件ベースで tautological ではない。
⚠️ @cloudflare/workers-typesを overrides で固定: pool-workers ツールチェーンが4.20260404.1→4.20260620.1に bump し、新 AI 型がsrc/rerank.tsの入力を厳格 reject するため。worker の型環境を main と同一に保つ最小 blast-radius の措置(型のみ・実行時影響なし・rerank.tsは無変更)。- リリース種別: 本体無変更で patch 相当。テスト基盤のため本 PR では release しない。
self-review pass。auto mode のため squash merge。#165 は残スコープ(DO / oauth フロー全体 / Vectorize・AI)のため open 継続。
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.
概要
#165(テスト脚の復元)のスライス2。Master 選択の「Workers 実機寄り」harness で、
@cloudflare/vitest-pool-workersが workerd 内でテストを実行し、実際のローカル D1(miniflare) に対してfts.tsの D1/FTS5 サーフェスを統合テストする。./migrationsのマイグレーションはapplyD1Migrationsで適用。カバレッジ(D1 統合 9 件)
upsertFtsRow+queryFts(porter / trigram 両トークナイザ)、ON CONFLICT 再 upsert で FTS5 ミラーが再同期(stale ヒット無し・重複行無し)deleteFtsRowが行と FTS ミラーを除去(orphan ヒット無し)escapeFtsQuery/tokenizerKindForTypeは node スイートに追加構成メモ
vitest.config.ts、スライス1の unit)+ workers pool(vitest.workers.config.ts)。npm testが両方を実行。isolatedStorageoff + テストごとに グローバルにユニークなvector_id: FTS5 external-content の vtab は per-test スナップショットでも cross-test の ON CONFLICT update でも壊れる(SQLITE_CORRUPT_VTAB)ため、共有 D1 + 衝突回避で安定化。@cloudflare/workers-typesをoverridesで worker コードが前提とするバージョンに固定。pool-workers ツールチェーンが新しい版を引き込むと AI バインディング型が厳格化しsrc/rerank.tsを壊すため(型のみ・実行時影響なし)。影響範囲
src/の Worker 本体コードは無変更(テスト + 設定 + 依存のみ)。npm 公開パッケージ(mcp-server/)は不変。残(#165 に残置)
store.tsIssueStore、DO 内蔵 SQLite)はrunInDurableObjectharness で別途。Refs #165