Skip to content

Reference file-backed and SQLite StateStore adapters #10

Description

@kevindechang

The only shipped StateStore is in-memory, for examples and tests. Everyone embedding this library writes the same durable store, and docs/threat-model.md notes that a store returning a no-op transaction silently converts the atomicity guarantee into nothing.

Two reference implementations would fix that:

  • File-backed: one JSON document per conversation, atomic replace via write-to-temp + rename.
  • SQLite: single file, a real transaction around the state and transcript commit.

Requirements:

  • Zero runtime dependencies (stdlib sqlite3 and json are fine in Python; the TypeScript side may need to stay file-backed only).
  • The transaction must actually be a transaction — a pre-commit failure has to leave state and transcript unchanged. Test that with an injected failure, not by inspection.
  • Round-trip an AffectState holding a non-empty occ_carry, a carried_thought with astral-plane characters, and an expectation — see python/tests/test_properties.py for the character set that has caught bugs before.

A well-scoped first contribution with a clear correctness bar.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions