Repository navigation
refactor: share sqlite backend connection semantics - #357
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 29 minutes and 51 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (11)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
## Summary - Add a shared SQLite read/write connection profile consumed by sync, async, and batch-ingest paths. - Add shared sqlite-vec extension loading helpers for sqlite3 and aiosqlite callers. - Move schema bootstrap branch selection into `schema_bootstrap.py` and document the canonical storage paths. ## Problem The async runtime, sync connection helper, batch ingest writer, schema bootstrap path, and sqlite-vec callers could drift because connection tuning, extension loading mechanics, and schema branch decisions were split across backend-specific modules. That made #190 hard to verify and made future storage changes easier to land in only one path. Closes #190. ## Solution `polylogue/storage/backends/connection_profile.py` now owns the canonical read/write SQLite profiles and derives the PRAGMA statement tuples used by `connection.py`, `async_sqlite.py`, and `pipeline/services/ingest_batch.py`. `polylogue/storage/backends/sqlite_vec_extension.py` now owns the extension-loading primitive for both sqlite3 and aiosqlite. Callers keep their existing policy decisions for warnings, silent fallback, or hard errors. `polylogue/storage/backends/schema_bootstrap.py` now exposes `decide_schema_bootstrap()`, so sync and async schema runtimes share the version/bootstrap branch decision while `schema.py` remains the I/O adapter for actual sync/async application. ## Verification - `ruff check polylogue/storage/backends/connection_profile.py polylogue/storage/backends/sqlite_vec_extension.py polylogue/storage/backends/connection.py polylogue/storage/backends/async_sqlite.py polylogue/pipeline/services/ingest_batch.py polylogue/storage/search_providers/sqlite_vec_runtime.py polylogue/storage/conversation_replacement.py tests/unit/storage/test_backend.py` - `pytest -q tests/unit/storage/test_backend.py tests/unit/storage/test_vec.py tests/unit/test_protocol_conformance.py` - `mypy polylogue/ tests/unit/storage/test_backend.py` - `devtools render-all --check` - `devtools verify` - pre-push `devtools verify --quick`
The async runtime, sync connection helper, batch ingest writer, schema bootstrap path, and sqlite-vec callers could drift because connection tuning, extension loading mechanics, and schema branch decisions were split across backend-specific modules. Hard to verify #190, and future storage changes could land in only one path. Adds `storage/backends/connection_profile.py` as the owner of canonical read/write SQLite profiles; derives the PRAGMA statement tuples used by `connection.py`, `async_sqlite.py`, and `pipeline/services/ingest_batch.py`. Adds `storage/backends/sqlite_vec_extension.py` as the owner of the extension-loading primitive for both sqlite3 and aiosqlite; callers keep their existing policy decisions for warnings, silent fallback, or hard errors. Moves schema bootstrap branch selection into `schema_bootstrap.py` and documents the canonical storage paths — `decide_schema_bootstrap()` means sync and async schema runtimes share the version/bootstrap branch decision while `schema.py` remains the I/O adapter for actual sync/async application. Verification: ruff + mypy + pytest over backend / vec / protocol-conformance suites; devtools render-all --check, verify and --quick green. Closes #190
The async runtime, sync connection helper, batch ingest writer, schema bootstrap path, and sqlite-vec callers could drift because connection tuning, extension loading mechanics, and schema branch decisions were split across backend-specific modules. Hard to verify #190, and future storage changes could land in only one path. Adds `storage/backends/connection_profile.py` as the owner of canonical read/write SQLite profiles; derives the PRAGMA statement tuples used by `connection.py`, `async_sqlite.py`, and `pipeline/services/ingest_batch.py`. Adds `storage/backends/sqlite_vec_extension.py` as the owner of the extension-loading primitive for both sqlite3 and aiosqlite; callers keep their existing policy decisions for warnings, silent fallback, or hard errors. Moves schema bootstrap branch selection into `schema_bootstrap.py` and documents the canonical storage paths — `decide_schema_bootstrap()` means sync and async schema runtimes share the version/bootstrap branch decision while `schema.py` remains the I/O adapter for actual sync/async application. Verification: ruff + mypy + pytest over backend / vec / protocol-conformance suites; devtools render-all --check, verify and --quick green. Closes #190
The async runtime, sync connection helper, batch ingest writer, schema bootstrap path, and sqlite-vec callers could drift because connection tuning, extension loading mechanics, and schema branch decisions were split across backend-specific modules. Hard to verify #190, and future storage changes could land in only one path. Adds `storage/backends/connection_profile.py` as the owner of canonical read/write SQLite profiles; derives the PRAGMA statement tuples used by `connection.py`, `async_sqlite.py`, and `pipeline/services/ingest_batch.py`. Adds `storage/backends/sqlite_vec_extension.py` as the owner of the extension-loading primitive for both sqlite3 and aiosqlite; callers keep their existing policy decisions for warnings, silent fallback, or hard errors. Moves schema bootstrap branch selection into `schema_bootstrap.py` and documents the canonical storage paths — `decide_schema_bootstrap()` means sync and async schema runtimes share the version/bootstrap branch decision while `schema.py` remains the I/O adapter for actual sync/async application. Verification: ruff + mypy + pytest over backend / vec / protocol-conformance suites; devtools render-all --check, verify and --quick green. Closes #190
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
schema_bootstrap.pyand document the canonical storage paths.Problem
The async runtime, sync connection helper, batch ingest writer, schema bootstrap path, and sqlite-vec callers could drift because connection tuning, extension loading mechanics, and schema branch decisions were split across backend-specific modules. That made #190 hard to verify and made future storage changes easier to land in only one path.
Closes #190.
Solution
polylogue/storage/backends/connection_profile.pynow owns the canonical read/write SQLite profiles and derives the PRAGMA statement tuples used byconnection.py,async_sqlite.py, andpipeline/services/ingest_batch.py.polylogue/storage/backends/sqlite_vec_extension.pynow owns the extension-loading primitive for both sqlite3 and aiosqlite. Callers keep their existing policy decisions for warnings, silent fallback, or hard errors.polylogue/storage/backends/schema_bootstrap.pynow exposesdecide_schema_bootstrap(), so sync and async schema runtimes share the version/bootstrap branch decision whileschema.pyremains the I/O adapter for actual sync/async application.Verification
ruff check polylogue/storage/backends/connection_profile.py polylogue/storage/backends/sqlite_vec_extension.py polylogue/storage/backends/connection.py polylogue/storage/backends/async_sqlite.py polylogue/pipeline/services/ingest_batch.py polylogue/storage/search_providers/sqlite_vec_runtime.py polylogue/storage/conversation_replacement.py tests/unit/storage/test_backend.pypytest -q tests/unit/storage/test_backend.py tests/unit/storage/test_vec.py tests/unit/test_protocol_conformance.pymypy polylogue/ tests/unit/storage/test_backend.pydevtools render-all --checkdevtools verifydevtools verify --quick