Skip to content

refactor: share sqlite backend connection semantics - #357

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/storage-backend-semantics
Apr 22, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/storage-backend-semantics

Conversation

@Sinity

@Sinity Sinity commented Apr 22, 2026 •

Copy link
Copy Markdown
Owner

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

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 29 minutes and 51 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 53a099d1-db71-440e-baf5-1372302bd7be

📥 Commits

Reviewing files that changed from the base of the PR and between 852b456 and 1c1827c.

📒 Files selected for processing (11)
  • docs/internals.md
  • polylogue/pipeline/services/ingest_batch.py
  • polylogue/storage/backends/async_sqlite.py
  • polylogue/storage/backends/connection.py
  • polylogue/storage/backends/connection_profile.py
  • polylogue/storage/backends/schema.py
  • polylogue/storage/backends/schema_bootstrap.py
  • polylogue/storage/backends/sqlite_vec_extension.py
  • polylogue/storage/conversation_replacement.py
  • polylogue/storage/search_providers/sqlite_vec_runtime.py
  • tests/unit/storage/test_backend.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/storage-backend-semantics

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity
Sinity merged commit 8efbde0 into master Apr 22, 2026
12 checks passed
@Sinity
Sinity deleted the feature/refactor/storage-backend-semantics branch April 22, 2026 11:19
Sinity added a commit that referenced this pull request Apr 22, 2026
## 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`
@Sinity Sinity added area:pipeline Pipeline area:schema Schema area:storage Storage tool:claude Claude type:refactor Code restructuring labels Apr 22, 2026
Sinity added a commit that referenced this pull request Apr 22, 2026
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
Sinity added a commit that referenced this pull request Apr 22, 2026
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
Sinity added a commit that referenced this pull request Apr 22, 2026
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
@Sinity

Sinity commented May 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@Sinity
Sinity requested a review from Copilot May 1, 2026 01:53
@Sinity
Sinity removed the request for review from Copilot May 1, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: unify async/sync storage backend semantics

1 participant