Skip to content

[P3][kernel] Throw libredb error when close() is called during transact() #31

Description

@cevheri

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

  • Stable libredb error.
  • bun run gate green.
  • Changeset required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/kernelPre-announcement auditbugSomething isn't workingpriority/lowPre-announcement audit

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions