Skip to content

feat: SqliteStore — persistent verbatim storage via better-sqlite3#24

Merged
SimplyLiz merged 1 commit intodevelopfrom
feature/sqlite-store
Mar 23, 2026
Merged

feat: SqliteStore — persistent verbatim storage via better-sqlite3#24
SimplyLiz merged 1 commit intodevelopfrom
feature/sqlite-store

Conversation

@SimplyLiz
Copy link
Owner

Summary

  • Adds SqliteStore class for persisting CompressResult data (messages + verbatim) in SQLite
  • better-sqlite3 declared as optional peer dependency — library stays zero-dep for users who don't need persistence
  • Atomic save via SQLite transactions satisfying the verbatim atomicity requirement
  • Lazy lookup() returns a StoreLookup function for uncompress() — single-row SELECTs, no full verbatim load
  • Verbatim entries accumulate across save() calls so recursive uncompress() works across compression rounds
  • 13 tests covering roundtrip, isolation, multi-round accumulation, recursive expansion, extra fields, and cleanup

API

const store = await SqliteStore.open('data.db'); // or ':memory:'
store.save('conv-1', compressResult);
const data = store.load('conv-1');
const restored = uncompress(data.messages, store.lookup('conv-1'));
store.delete('conv-1');
store.list(); // ['conv-2', ...]
store.close();

Test plan

  • npm test — 684 tests pass (13 new)
  • npm run build — clean
  • npm run lint && npm run format:check — clean

Adds SqliteStore backed by better-sqlite3 (optional peer dependency).
Provides atomic save/load of CompressResult data and a lazy StoreLookup
function for uncompress(). Verbatim entries accumulate across compression
rounds so recursive uncompress works through the chain.

API: open, save, load, lookup, delete, list, close.
@SimplyLiz SimplyLiz merged commit a2272f8 into develop Mar 23, 2026
10 of 11 checks passed
@SimplyLiz SimplyLiz deleted the feature/sqlite-store branch March 23, 2026 11:04
SimplyLiz added a commit that referenced this pull request Mar 23, 2026
This reverts commit a2272f8, reversing
changes made to cd9165f.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant