[FEAT] Adds the database configuration and schema management.#25
Draft
maralbahari wants to merge 7 commits into
Draft
[FEAT] Adds the database configuration and schema management.#25maralbahari wants to merge 7 commits into
maralbahari wants to merge 7 commits into
Conversation
Replaces the Python gateway stub with a full Rust implementation using axum, reqwest, and tokio. Supports both streaming (SSE) and non-streaming proxy modes, hop-by-hop header filtering, API key injection, and comprehensive error mapping (502/504). Includes 11 tests covering passthrough, auth, streaming, error propagation, mid-stream failure, connection errors, and timeouts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Sébastien Han <seb@redhat.com>
- Add RuntimeConfig with clap + validator derives (single-struct CLI/config) - Add DbPool using sqlx Any driver (SQLite + PostgreSQL support) - Add three-table schema: conversations, items, responses - Add CRUD operations for all three tables - Add SchemaManager with sqlx migrations Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: maral <maralbahari.98@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: maral <maralbahari.98@gmail.com>
…and conversation item count query Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: maral <maralbahari.98@gmail.com>
Replace global OnceLock with Arc<DbPool>, consolidate get_or_create_conversation with UPSERT to eliminate redundant queries. Remove unused CRUD helpers. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: maral <maralbahari.98@gmail.com>
| @@ -0,0 +1,31 @@ | |||
| CREATE TABLE IF NOT EXISTS conversations ( | |||
Collaborator
There was a problem hiding this comment.
Collaborator
Author
There was a problem hiding this comment.
@franciscojavierarceo yes I agree we can focus on responses first. less complexity
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 database configuration, schema management, and CRUD layer for the three-table persistence schema used by the Responses and Conversation APIs.
What's in this PR
RuntimeConfig: single struct deriving bothclap::Parserandvalidator::Validate; CLI args and field validation in one place with noGatewayOptsduplicationDbPoolviasqlx::Any: single pool type that works with both SQLite and PostgreSQL at runtime; no per-dialect code duplicationconversations,items,responsestables matching the Python schema exactly; managed viasqlxmigrations inmigrations/0001_initial.sqlSchemaManager: runs migrations on startup; respectsAA_DB_SCHEMA_READYenv var so worker processes skip DDL; uses sqlx's built-in migration lock replacing Python's PostgreSQL advisory lockdatabase/conversation.rs,database/item.rs,database/response.rs.Test Plan
Test Results
Both SQLite paths verified — default and explicit