Skip to content

core: in-memory ledger mode for testing #4

@Dexploarer

Description

@Dexploarer

What I want

const ledger = openLedger({ project: "test", inMemory: true });

Useful for:

  • Unit tests that don't want to touch the filesystem.
  • Sharing one in-memory ledger between an agent under test and Studio in the same process.
  • CI environments where the default ~/.actantdb path doesn't exist or isn't writable.

Current state

openLedger requires a path. Tests work around this by writing to tempfile directories, which is fine until you want Studio to read the same in-memory store.

Implementation

node:sqlite supports :memory:. The Ledger constructor would need to:

  • Accept inMemory: true and skip the mkdirSync + path-derivation.
  • Pass :memory: to new DatabaseSync(":memory:").
  • The same in-process Ledger instance is safe to share; cross-process in-memory sharing isn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions