Summary
Calling close() while inside transact() can surface raw Node EBADF from the filesystem instead of a structured libredb: error.
Audit ID: Section 4 Low — Wave 3
Location: src/core.ts:517-521
Fix
- Detect
inTransaction on close() → throw libredb: cannot close during an open transaction before touching the log.
- Or defer close until transaction completes — prefer explicit throw for sync API clarity.
Tests
transact(() => { db.close(); }) → libredb error, not EBADF.
Acceptance criteria
Summary
Calling
close()while insidetransact()can surface raw NodeEBADFfrom the filesystem instead of a structuredlibredb:error.Audit ID: Section 4 Low — Wave 3
Location:
src/core.ts:517-521Fix
inTransactiononclose()→ throwlibredb: cannot close during an open transactionbefore touching the log.Tests
transact(() => { db.close(); })→ libredb error, not EBADF.Acceptance criteria
bun run gategreen.