refactor: migrate from KuzuDB to LadybugDB v0.15#275
Conversation
KuzuDB was archived (Apple acquisition, Oct 2025). LadybugDB is the community fork with full API compatibility. - Package swap: kuzu → @ladybugdb/core, kuzu-wasm → @ladybugdb/wasm-core - Rename all internal paths: kuzu → lbug (adapters, schema, storage) - Storage path: .gitnexus/kuzu → .gitnexus/lbug (with auto-cleanup) - Add explicit VECTOR extension loading (required in v0.15) - Update CI workflow, documentation, and all tests - 1151 unit + 27 integration tests passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@candidosales is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
CI Report✅ All checks passed Pipeline Status
Test Results
✅ All 1952 tests passed 11 test(s) skipped — expand for detailsIntegration:
Code CoverageCombined (Unit + Integration)
Coverage breakdown by test suiteUnit Tests
Integration Tests
📋 View full run · Generated by CI |
P1: Fix WASM adapter to use getAll() API, wire cleanupOldKuzuFiles into analyze command, add symlink path traversal protection. P2: Cache VECTOR extension load state, batch augmentation engine queries (20→4), fix web getCopyQuery for multi-language tables, fix stale KuzuDB references, correct brainstorm package names. P3: Complete lbug-wasm.d.ts type declarations, batch semantic search per-label, update stale BM25 comment.
The read-only pool adapter never loaded the FTS extension, so all QUERY_FTS_INDEX calls failed silently. This broke search-pool and augmentation integration tests, and caused empty results in the web UI server mode.
xkonjin
left a comment
There was a problem hiding this comment.
Code Review
Substantial migration PR replacing KuzuDB with LadybugDB v0.15. The mechanical rename is thorough and the CHANGELOG is clear. A few things stand out for review.
Migration correctness
Storage path migration: The CHANGELOG notes the index path changes from .gitnexus/kuzu → .gitnexus/lbug with automatic cleanup of stale KuzuDB files. This cleanup logic isn't visible in the diff — where does it live? If it's handled elsewhere, a note in the CHANGELOG entry pointing to the cleanup location would help future debugging. More importantly: is there a migration guard that prevents gitnexus analyze from silently treating a repo as unindexed if it finds only a .gitnexus/kuzu directory? A user upgrading mid-project will lose their index unless there's an explicit migration step or detection.
VECTOR extension loading: The CHANGELOG mentions LadybugDB v0.15 requires explicit VECTOR extension loading for semantic search. This is a behavioral change that can silently break semantic search if the extension isn't loaded at startup. Where is this loading happening? It should be verified that it runs before any vector query, not lazily on first use — lazy loading could produce confusing empty results without errors.
CI changes
The rename from kuzu-db to lbug-db test group is clean. One concern: the test files referenced in the run step (test/integration/lbug-core-adapter.test.ts, lbug-pool.test.ts) — do these exist in this PR, or are they being added separately? If they don't exist, the CI job will silently succeed on a missing file in some configurations (no glob expansion = no tests run = green).
package-lock.json
The kuzu-wasm package is marked as deprecated in npm — good that it's being replaced. Worth verifying the @ladybugdb/wasm-core@0.15.1 package integrity hash is what you'd get from a fresh npm install (it's unusually long in the diff, which sometimes indicates a hand-edited lockfile).
Minor
- README table alignment after the LadybugDB name change is slightly off (extra spaces in the native storage row). Not blocking but worth a tidy.
- The acknowledgements link to
ladybugdb.com— worth confirming that domain is live and resolves correctly.
Overall: the migration looks mechanically complete. The main concerns are the index migration path for existing users, and confirming the VECTOR extension loading.
|
Can you please add an automatic migration and cleanup from the KuzuDB? 🙏 |
|
Can you please also look into the forking issue while you're at it? We ran into a nasty problem with KuzuDB where vitest fork workers would hang on Linux (our CI). Here's what was happening: When a vitest fork worker finishes and calls We tried a few things:
What ended up working: we changed That mostly solved it, but we still split tests into individual vitest runs as a safety measure, multiple fork workers each holding native KuzuDB objects meant non-deterministic teardown ordering, and one slow destructor could cascade into timeouts for the others. Would be great to know if LadybugDB has the same behavior in their C++ destructors or if they've addressed this. If you can test with the forked workers setup and see if the hang is still there, that would save us from carrying the workaround. |
|
@magyargergo I added an automatic migration in this commit: 9bf1fdb |
|
@magyargergo, about the second question, LadybugDB has the same class of problem, but it's actually worse — and the fix that worked for KuzuDB actively makes it worse on LadybugDB. We've already landed the adapted workarounds for this. The KuzuDB hang (blocked destructor during N-API cleanup) and the KuzuDB fix (
The critical difference: calling |
|
I submitted my findings here |
|
@magyargergo Regardless of this N-API issue, I think we can merge this improvement since Ladybug continues to receive new contributions. What do you think? |
…→lbug migration The kuzu→lbug migration (abhigyanpatwari#275) didn't carry forward three pieces from the markdown indexing PR (abhigyanpatwari#399): 1. 'Section' missing from NODE_TABLES constant — LadybugDB type system doesn't recognize Section as a valid node type 2. SECTION_SCHEMA missing from NODE_SCHEMA_QUERIES — Section table never created in the database (already fixed in abhigyanpatwari#399 merge, confirming) 3. getCopyQuery falls through to 7-column multi-lang default for Section, but Section CSV has 8 columns (includes 'level'). Causes: "Binder exception: Number of columns mismatch. Expected 7 but got 8" Reproduces on any repo with .md files. Tested fix against a 2K+ markdown file repo (40K nodes, 37K edges) — indexes in 38s with no crashes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: migrate from KuzuDB to LadybugDB v0.15 KuzuDB was archived (Apple acquisition, Oct 2025). LadybugDB is the community fork with full API compatibility. - Package swap: kuzu → @ladybugdb/core, kuzu-wasm → @ladybugdb/wasm-core - Rename all internal paths: kuzu → lbug (adapters, schema, storage) - Storage path: .gitnexus/kuzu → .gitnexus/lbug (with auto-cleanup) - Add explicit VECTOR extension loading (required in v0.15) - Update CI workflow, documentation, and all tests - 1151 unit + 27 integration tests passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address code review findings (P1-P3) P1: Fix WASM adapter to use getAll() API, wire cleanupOldKuzuFiles into analyze command, add symlink path traversal protection. P2: Cache VECTOR extension load state, batch augmentation engine queries (20→4), fix web getCopyQuery for multi-language tables, fix stale KuzuDB references, correct brainstorm package names. P3: Complete lbug-wasm.d.ts type declarations, batch semantic search per-label, update stale BM25 comment. * chore: remove outdated KuzuDB migration brainstorming document * fix: load FTS extension in MCP pool adapter on init The read-only pool adapter never loaded the FTS extension, so all QUERY_FTS_INDEX calls failed silently. This broke search-pool and augmentation integration tests, and caused empty results in the web UI server mode. * feat: implement shared Database caching and connection reference counting * feat: enhance KuzuDB migration handling and status reporting * fix: mock cleanupOldKuzuFiles in local backend callTool tests * fix: update mock for cleanupOldKuzuFiles and adjust imports in callTool tests --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
kuzu→@ladybugdb/core,kuzu-wasm→@ladybugdb/wasm-corekuzutolbug(adapters, schema, storage directory).gitnexus/kuzu→.gitnexus/lbugwith automatic cleanup of stale KuzuDB filesINSTALL VECTOR; LOAD EXTENSION VECTOR;(required in LadybugDB v0.15, was implicit in KuzuDB v0.11)kuzu-db→lbug-dbtest group), all documentation, and all testsTest plan
tscbuild succeeds with no errorsnpm installsucceeds in bothgitnexus/andgitnexus-web/kuzureferences in source code (only intentional:cleanupOldKuzuFiles, historical changelog)npx gitnexus analyzeon a repo, verify.gitnexus/lbugcreatedHow to test it?