Repository navigation
fix: isolate embedding maintenance reads and harden dev startup - #797
Conversation
🤖 Open Code ReviewTarget: PR #797 🔍 OpenCodeReview found 20 issue(s) in this PR.
1.
|
|
Production servers construct MemoryService with a pre-built StorageBackend (server/index.ts passes `backend`), so `options.db?.path` was always undefined and EmbeddingMaintenanceReader silently fell back to inline execution on the main event loop. The worker isolation added for embedding maintenance reads therefore never took effect in packaged runtimes. Expose the SQLite file on StorageBackend (`SqliteStorageBackend` returns its MemoryDb path; the remote backend owns no file) and prefer it over the raw `db` option. Verified against compiled output with 200k memory rows: reads now run in a worker lane and the main thread keeps ticking (218 timer ticks during the read, previously 0). The test fixtures build the service from `db`, which is why the original suite could not catch this. Add a wiring regression suite covering the backend construction path, the db path, and the in-memory fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three defects found while reviewing the read-isolation change: 1. readTargetProgress built target health without the outdated-vector set, so a stale vector whose current content was never embedded read as "ready". The one-time provenance upgrade then filtered every candidate out, persisted targets: [] with completedAt, and permanently skipped repairs while the panel still reported needsRepair. Compute the same outdatedVectors set the global statistics use and pass it to healthForEntry, so plan health and counters describe the same state. 2. sourceCurrent compared a queued job's sourceText against the single canonical maintenanceText, while the queue-side check already accepted every historically valid rendering. Reusing a pending retry whose text was an older memoryValue therefore reported updated: 0, failed: 1 even though the worker wrote a correct vector. Both paths now share sourceTextIsCurrent(). 3. ensure_npm_dependencies resolved packages from the caller's current directory, so starting dev-start.sh outside the repository marked every dependency missing and ran an unnecessary npm install. Resolve from $ROOT_DIR instead. Regression coverage: a plan-vs-statistics health invariant test that fails without fix 1, a reused-legacy-retry test for fix 2, and an outside-the-repository invocation test for fix 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
dev-start.shdependency detection using package manifest and lockfile fingerprints.electronandjszip.Testing