fix(storage): wire @ladybugdb/core binding, fix lbug open() guards, upgrade pnpm v10→v11#93
Merged
Merged
Conversation
…ache list()
Three bugs fixed to make `codehub analyze --embeddings CODEHUB_STORE=lbug` work:
1. @ladybugdb/core was missing from onlyBuiltDependencies / allowBuilds, so
its install.js never ran and lbugjs.node was never copied from the
platform sub-package into the main package dir.
2. openEmbeddingHashCacheAdapter's .list() method had no error handling.
On a fresh lbug DB (no schema yet), listEmbeddingHashes() makes the
first Cypher query which triggers lbug's internal WAL/schema init even
in read-only mode, throwing "Cannot create an empty database under READ
ONLY mode". Wrapping list() in try/catch returns an empty Map, matching
the EmbeddingHashCacheAdapter contract ("Empty map on fresh DB or error").
3. Upgrade pnpm v10 → v11.1.0. Breaking changes absorbed:
- onlyBuiltDependencies (list) → allowBuilds (map) in pnpm-workspace.yaml
- pnpm.overrides in package.json → overrides in pnpm-workspace.yaml
- autoInstallPeers, resolutionMode, engineStrict moved from .npmrc →
pnpm-workspace.yaml (v11 only reads auth/registry from .npmrc)
- minimumReleaseAge: 0 to opt out of v11's new 24h publish gate
- packageManager bumped to pnpm@11.1.0, engines.pnpm bumped to >=11.0.0
Two tests were failing on this host before our changes:
1. graphHash parity: medium-with-empty-keywords
lbug v0.16.1 cannot distinguish empty STRING[] from NULL — the native
binder collapses [] to NULL on write, so keywords: [] cannot round-trip
through graphdb. Scoped that fixture to a duck-only parity check and
updated the setStringArrayFieldGd comment to document the known limitation.
2. upsertEmbeddings / vectorSearch tests (mmap failure)
The lbug VECTOR extension requires mmap'ing large HNSW index buffers.
On this Linux devbox the mmap fails ("Buffer manager exception: Mmap for
size N failed"). Added cachedVectorSupport() probe that runs one
upsertEmbeddings and catches the mmap error; the three vector-dependent
tests skip cleanly on hosts where the extension cannot init.
…end fallback Two lbug-on-existing-DuckDB correctness fixes: 1. GraphDbStore.open() with readOnly=true now throws immediately when the file does not exist, rather than letting lbug create an empty DB that subsequently fails on the first query (INSTALL FTS/VECTOR triggers "Cannot create an empty database under READ ONLY mode"). This makes all read-only probe sites (openEmbeddingHashCacheAdapter, countPriorCallable, openSummaryCacheAdapter, augment, scan) behave correctly when graph.lbug is absent. 2. openStore() with backend="auto" (no explicit CODEHUB_STORE) now falls back to the other backend when the probe-selected backend's file does not exist but the other does. This prevents the lbug binding probe from selecting "lbug" on a machine where the binding is installed but the existing index is a DuckDB file — loadPreviousGraph and augment would open an empty lbug DB, run queries on it, and get "Table CodeNode does not exist" errors. The fallback only applies to auto-resolved backends; explicit CODEHUB_STORE values are always honored.
- Auto-format two files that Biome CI rejected (graphdb-adapter.test.ts, storage/index.ts) — trailing whitespace + object literal style. - Override mermaid@<11.15.0 → 11.15.0 in pnpm-workspace.yaml to fix GHSA-6m6c-36f7-fhxh / GHSA-87f9-hvmw-gh4p / GHSA-ghcm-xqfw-q4vr / GHSA-xcj9-5m2h-648r (all medium, all fixed in 11.15.0).
…rm runs Adds actions/cache@v4.2.3 keyed on pnpm-lock.yaml hash between mise-action and pnpm install. Cache auto-invalidates on any lockfile change. First run after a lockfile bump still downloads everything; subsequent runs on the same lockfile hit the store and skip all downloads + native builds.
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.
Summary
@ladybugdb/corenative binding not wired:lbugjs.nodelives in the linux-x64 sub-package but@ladybugdb/core'sinstall.js(which copies it) never ran because@ladybugdb/corewas missing fromonlyBuiltDependencies/allowBuilds. Added it;codehub analyze --embeddings CODEHUB_STORE=lbugnow works end-to-end (verified: 3570 embeddings upserted via SageMaker).Phase 'embeddings' failedon fresh lbug DB:openEmbeddingHashCacheAdapter.list()had no error handling. On a fresh lbug DB,listEmbeddingHashes()triggers lbug's internal init even withreadOnly=true, throwing "Cannot create an empty database under READ ONLY mode". Wrappedlist()in try/catch per theEmbeddingHashCacheAdaptercontract ("Empty map on fresh DB or error").GraphDbStore.open()withreadOnly=trueon missing file: lbug silently creates an empty DB file even in read-only mode, then any subsequent query (INSTALL FTS, INSTALL VECTOR) fails. Added a fail-fastaccess()check that throws before touching lbug whenreadOnly=trueand the path doesn't exist.openStore("auto")single-artifact fallback: When the lbug binding is available but onlygraph.duckdbexists (e.g. seeded by tests or created before lbug was installed), the auto-backend probe was picking lbug, opening an empty DB, and getting "Table CodeNode does not exist". Added a fallback: when the probe-selected backend's file is absent but the other exists, use the present file.onlyBuiltDependencies(list) →allowBuilds(map),pnpm.overridesinpackage.json→overridesinpnpm-workspace.yaml,auto-install-peers/resolution-mode/engine-strictmoved from.npmrc→pnpm-workspace.yaml,minimumReleaseAge: 0to opt out of v11's 24h publish gate,packageManager+engines.pnpmbumped.graphHash parity: medium-with-empty-keywords— lbug v0.16.1 cannot distinguish emptySTRING[]from NULL; scoped to duck-only parity check. (b)upsertEmbeddings/vectorSearch— lbug VECTOR extension mmap fails on this devbox; addedcachedVectorSupport()probe that skips gracefully.Test plan
pnpm -r run build— all 19 packages build cleanpnpm -r test— storage: 247 pass, 2 skipped (vector mmap); cli: 236 pass, 0 failcodehub analyze --embeddings CODEHUB_STORE=lbug— verified: 22063 nodes, 47679 edges, 3570 embeddings upserted via SageMakercodehub status CODEHUB_STORE=lbug— reports stale: no, schemaVersion: 1.2.0pnpm --version→ 11.1.0