Add SqliteBackend::from_connection — incremental-adoption seam (0.1.1)#1
Merged
Conversation
WHAT: SqliteBackend::from_connection(Connection) wraps a connection a consumer already owns; SqliteBackend::connection() lends it back for domain-table SQL. Bump 0.1.0 -> 0.1.1. WHY: newt-agent's ConversationStore and modulex-mcp's Store each own a live rusqlite::Connection. Without this seam, adopting agent-store would mean either a second connection to the same file or rewriting all domain SQL at once. This lets a consumer hand over its connection, keep its existing rusqlite code via connection(), and gain the agent-store primitives on the same database — so the first integration PRs stay small. Regression test: from_connection_wraps_and_shares_the_database asserts Backend trait writes and connection() escape-hatch writes hit the same database. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the seam both consumers need to adopt agent-store without opening a second connection to the same DB or rewriting all their domain SQL at once:
SqliteBackend::from_connection(Connection)— wrap a connection the consumer already owns.SqliteBackend::connection() -> &rusqlite::Connection— escape hatch so the consumer keeps its existing rusqlite domain SQL while the agent-store primitives (Generation,WriterLog) run on the same database via theBackendtrait.newt-agent's
ConversationStoreand modulex-mcp'sStoreeach hold a liverusqlite::Connection; this keeps the first integration PRs small. Bumps 0.1.0 → 0.1.1.Test plan
just checkgreen locally (fmt + clippy -D warnings + tests).from_connection_wraps_and_shares_the_database.risk:low — additive API, no CI/hook/build changes, regression test included.