diff --git a/gitnexus/src/core/lbug/lbug-adapter.ts b/gitnexus/src/core/lbug/lbug-adapter.ts index 7d17ab028..6973a4cbe 100644 --- a/gitnexus/src/core/lbug/lbug-adapter.ts +++ b/gitnexus/src/core/lbug/lbug-adapter.ts @@ -188,12 +188,6 @@ const DB_LOCK_RETRY_ATTEMPTS = 3; /** Base back-off in ms between BUSY retries (multiplied by attempt number). */ const DB_LOCK_RETRY_DELAY_MS = 500; -/** - * Re-exported from `lbug-config.ts` (single source of truth) so existing - * importers continue to resolve `isDbBusyError` from this module. - */ -export { isDbBusyError }; - /** * Return true when the error message indicates a write was attempted against * a read-only LadybugDB connection. The MCP query pool opens DBs read-only, diff --git a/gitnexus/src/core/lbug/lbug-config.ts b/gitnexus/src/core/lbug/lbug-config.ts index 8d6987c89..35c59851c 100644 --- a/gitnexus/src/core/lbug/lbug-config.ts +++ b/gitnexus/src/core/lbug/lbug-config.ts @@ -62,11 +62,10 @@ export interface LbugConnectionHandle { * (`new lbug.Database(...)` raises from `local_file_system.cpp`) or during * a query (another writer holds the exclusive lock). * - * Source of truth lives here so both the construction-time retry - * (`openWithLockRetry`) and the query-time retry (`withLbugDb` in - * `lbug-adapter.ts`) agree on the matcher. Other matchers (e.g. - * `isReadOnlyDbError`) should follow this pattern: define here, re-export - * from the adapter — see `references/findings-schema.json` adv-1 / maint-4. + * Lives here (not in `lbug-adapter.ts`) so both the construction-time + * retry (`openWithLockRetry` in this file) and the query-time retry + * (`withLbugDb` in `lbug-adapter.ts`) consult the same matcher. Callers + * import directly from this module — no re-export to keep in sync. */ export const isDbBusyError = (err: unknown): boolean => { const msg = (err instanceof Error ? err.message : String(err)).toLowerCase(); diff --git a/gitnexus/test/integration/lbug-lock-retry.test.ts b/gitnexus/test/integration/lbug-lock-retry.test.ts index 1279c77fb..7724e5512 100644 --- a/gitnexus/test/integration/lbug-lock-retry.test.ts +++ b/gitnexus/test/integration/lbug-lock-retry.test.ts @@ -14,7 +14,7 @@ import { withTestLbugDB } from '../helpers/test-indexed-db.js'; // Pure-function tests — no DB needed, but grouped here for cohesion // with the retry logic they guard. -import { isDbBusyError } from '../../src/core/lbug/lbug-adapter.js'; +import { isDbBusyError } from '../../src/core/lbug/lbug-config.js'; describe('isDbBusyError', () => { it('returns true for "busy" errors (case-insensitive)', () => { diff --git a/gitnexus/test/integration/lbug-open-retry.test.ts b/gitnexus/test/integration/lbug-open-retry.test.ts index a65ac0497..80e68617d 100644 --- a/gitnexus/test/integration/lbug-open-retry.test.ts +++ b/gitnexus/test/integration/lbug-open-retry.test.ts @@ -20,7 +20,6 @@ import { openLbugConnection, waitForWindowsHandleRelease, } from '../../src/core/lbug/lbug-config.js'; -import * as adapterReexport from '../../src/core/lbug/lbug-adapter.js'; // ─── Minimal stub of the `lbug` module surface used by openLbugConnection ── @@ -51,10 +50,7 @@ const makeStubLbug = (control: StubModuleControl) => { return { Database: FakeDatabase, Connection: FakeConnection } as any; }; -describe('isDbBusyError (re-exported source of truth)', () => { - it('matcher in lbug-adapter is the same function as in lbug-config', () => { - expect(adapterReexport.isDbBusyError).toBe(isDbBusyError); - }); +describe('isDbBusyError', () => { it('matches the documented Windows lock-error wording', () => { expect(isDbBusyError(new Error('Could not set lock on file foo.lbug'))).toBe(true); expect(isDbBusyError(new Error('database is locked'))).toBe(true);