Repository navigation
fix(lancedb): dump manifest version判定を共通化 - #564
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughLanceDBダンプのバージョン値を公開定数に集約し、server側のバージョン判定をその定数参照に統一しました。関連テストのmanifest version期待値も4に更新されています。 ChangesLANCEDB_DUMP_VERSION定数化
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
このプルリクエストでは、ハードコードされていた LANCEDB_DUMP_VERSION を共通の定数としてエクスポートし、BackupService や MaintenanceService などの各サービスおよびテストコードで参照するように修正しています。レビューでは、テストコードにおける lancedb-dump-service のモック作成時に、バージョン番号をハードコードするのではなく、Vitest の importOriginal を使用して実際のモジュールからインポートを継承することで、将来的なメンテナンスコストを削減する改善案が提示されています。
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…rvice.test.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/server/src/tests/unit/application/services/maintenance-service.test.ts (1)
44-44: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
vi.importActualで実定数値を取り込むことを検討してください。
LANCEDB_DUMP_VERSION: 4をモックにハードコードしていますが、本PR自体が「定数のハードコード値の不一致」によるバグ修正であることを踏まえると、テスト側も実際のLANCEDB_DUMP_VERSIONをハードコードするのではなくvi.importActual経由で取得する方が、将来的な値変更時の乖離を防げます。♻️ 提案する修正例
-vi.mock("~/application/services/lancedb-dump-service", () => ({ - ... - LANCEDB_DUMP_VERSION: 4, - ... -})); +vi.mock("~/application/services/lancedb-dump-service", async () => { + const actual = await vi.importActual< + typeof import("~/application/services/lancedb-dump-service") + >("~/application/services/lancedb-dump-service"); + return { + ...actual, + // 他のモック値はそのまま維持 + }; +});🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/server/src/tests/unit/application/services/maintenance-service.test.ts` at line 44, The test mock is hardcoding LANCEDB_DUMP_VERSION to 4, which can drift from the वास्तविक constant and defeat the intent of the fix. Update the mock in maintenance-service.test.ts to obtain LANCEDB_DUMP_VERSION via vi.importActual from the same module used in production, and use that imported value in the mocked module setup so the test stays aligned with the real constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/src/application/services/backup-service.ts`:
- Line 13: The static import of LANCEDB_DUMP_VERSION in backup-service.ts still
eagerly initializes lancedb-dump-service, which defeats the intended lazy
loading. Update the backup-service code path to load LANCEDB_DUMP_VERSION via a
dynamic import like the existing createLanceDbDumpService flow in
lancedb-dump-service, and keep the import inside the relevant function or
runtime branch so module initialization is deferred. Use the symbols
backup-service, LANCEDB_DUMP_VERSION, and createLanceDbDumpService to locate and
align the change.
---
Nitpick comments:
In `@apps/server/src/tests/unit/application/services/maintenance-service.test.ts`:
- Line 44: The test mock is hardcoding LANCEDB_DUMP_VERSION to 4, which can
drift from the वास्तविक constant and defeat the intent of the fix. Update the
mock in maintenance-service.test.ts to obtain LANCEDB_DUMP_VERSION via
vi.importActual from the same module used in production, and use that imported
value in the mocked module setup so the test stays aligned with the real
constant.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 65b365b1-4210-4815-af17-7d9f108f1182
📒 Files selected for processing (5)
apps/server/src/application/services/backup-service.tsapps/server/src/application/services/lancedb-dump-service.tsapps/server/src/application/services/maintenance-service.tsapps/server/src/tests/unit/application/services/maintenance-service.test.tspackages/application/src/services/lancedb-dump-service.ts
| import type { Table } from "drizzle-orm"; | ||
| import { and, asc, eq, gt, inArray, lt, or, sql } from "drizzle-orm"; | ||
| import type { PgColumn } from "drizzle-orm/pg-core"; | ||
| import { LANCEDB_DUMP_VERSION } from "~/application/services/lancedb-dump-service"; |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# lancedb-dump-service.ts のトップレベルに重い副作用(LanceDB接続確立など)がないか確認
sed -n '1,20p' packages/application/src/services/lancedb-dump-service.ts
sed -n '1,10p' apps/server/src/application/services/lancedb-dump-service.ts
# backup-service.ts内での同モジュールへのimportパターンを確認
rg -n 'lancedb-dump-service' apps/server/src/application/services/backup-service.tsRepository: hmjn023/solid-imager
Length of output: 1514
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- backup-service.ts top imports and relevant dynamic imports ---'
sed -n '1,80p' apps/server/src/application/services/backup-service.ts
echo
sed -n '1030,1085p' apps/server/src/application/services/backup-service.ts
echo
sed -n '1260,1295p' apps/server/src/application/services/backup-service.ts
echo
sed -n '1328,1360p' apps/server/src/application/services/backup-service.ts
echo
sed -n '1588,1665p' apps/server/src/application/services/backup-service.ts
echo
echo '--- lancedb-dump-service.ts top of file and all runtime imports ---'
sed -n '1,120p' apps/server/src/application/services/lancedb-dump-service.ts
echo
rg -n 'from "@|from "~/' apps/server/src/application/services/lancedb-dump-service.tsRepository: hmjn023/solid-imager
Length of output: 8977
静的 import による早期評価を再確認 backup-service.ts で LANCEDB_DUMP_VERSION を静的 import すると、~/application/services/lancedb-dump-service のモジュール初期化自体は走ります。apps/server/src/application/services/lancedb-dump-service.ts では createLanceDbDumpService(...) をトップレベルで呼んでいるため、遅延ロードに寄せたい意図があるならここは動的 import に揃えるべきです。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/server/src/application/services/backup-service.ts` at line 13, The
static import of LANCEDB_DUMP_VERSION in backup-service.ts still eagerly
initializes lancedb-dump-service, which defeats the intended lazy loading.
Update the backup-service code path to load LANCEDB_DUMP_VERSION via a dynamic
import like the existing createLanceDbDumpService flow in lancedb-dump-service,
and keep the import inside the relevant function or runtime branch so module
initialization is deferred. Use the symbols backup-service,
LANCEDB_DUMP_VERSION, and createLanceDbDumpService to locate and align the
change.
概要
LanceDB dumpがversion 4で作成される一方、delta同期と起動時確認がversion 3を期待していた不整合を修正します。この不整合により、メディア追加時のdelta同期が全件full syncへフォールバックしていました。
変更内容
検証
補足
対象unit testはViteの既存エイリアス解決エラーによりserver設定ではsuite読込前に停止しました。root設定ではlancedb dump serviceの5テストが成功しています。
Summary by CodeRabbit