Skip to content

LOU-W5: SQLite store for sessions, checkpoints and approvals - #65

Merged
LinuxDevil merged 3 commits into
mainfrom
lou-w5-sqlite-store
Oct 1, 2026
Merged

LinuxDevil merged 3 commits into
mainfrom
lou-w5-sqlite-store

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

What

SqliteStore from the new subpath @loushy/build-ai-agent/sqlite: one node:sqlite file with .sessions, .checkpoints, .approvals implementing SessionStore, CheckpointStore, ApprovalStore, plus prune({ olderThanMs }) and close().

Why

Durable state only had memory/file/KV implementations (audit: "no DB adapters"). A single SQLite file is durable, transactional and zero-ops for a Node server.

How verified

Merged origin/main (10f2d24) before final verification.

  • npx tsc --noEmit: ok
  • npm run lint: 0 errors (433 warnings, none from new files)
  • build + create-loushy-agent build: ok
  • npm run test:coverage: 120/121 files, 1768 tests passed; the one failure (NodeWorkspace.test.ts > caps captured output, LOU-X6) passes in isolation (25 passed) - load flake, not touched here
  • npm run fallow: no dead-code/dupes findings
  • npm run test:types: 10 passed; docs:verify-snippets: 58 snippets type-check; docs:llms:check: ok
  • Node 26.2.0 locally; node:sqlite docs: Release Candidate (1.2), no flag needed since 22.13/23.4, no ExperimentalWarning.

Notes for reviewer

  • Export path is dist/storage/sqlite/index so the docs-snippet paths mapping (dist -> src) resolves.
  • @types/node here is 20.x (no node:sqlite typings), so driver.ts declares a minimal structural interface and loads the module lazily via process.getBuiltinModule; importing the subpath never loads node:sqlite. importGraph.test.ts deny list now includes node:sqlite for all entries (and the new entry).
  • Vite 5 in vitest cannot resolve bare node:sqlite, so tests load it through the same loader.
  • resolve() on approvals stamps resolved_at (atomic claim in a transaction) instead of deleting; prune() removes resolved rows. Unresolved approvals are never pruned.
  • Shared contract suites live in src/storage/sqlite/__fixtures__/storeContracts.ts (not shipped in the npm package) and run against in-memory, file and SQLite stores; existing tests untouched.
  • No docs/durable-execution.md on main yet, so the Stores section is in docs/sessions.md.

🤖 Generated with Claude Code

LinuxDevil and others added 3 commits October 1, 2026 10:32
Adds SqliteStore (new subpath @loushy/build-ai-agent/sqlite, not in the root
barrel): one node:sqlite file implementing SessionStore, CheckpointStore and
ApprovalStore. Versioned schema via PRAGMA user_version with forward
migrations in a transaction, WAL + busy timeout for multi-process sharing,
prepared parameterized statements, opaque JSON payloads so snapshot fields
added by other tickets round-trip, prune({ olderThanMs }), clear errors for
corrupt files / use after close / missing node:sqlite. Shared contract suites
run against the in-memory, file and SQLite implementations. Docs: Stores
section in docs/sessions.md and a README bullet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@LinuxDevil
LinuxDevil merged commit 98388b7 into main Oct 1, 2026
2 checks passed
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