Skip to content

fix: close blob seq sqlite migration connection - #1804

Merged
igorls merged 1 commit into
developfrom
codex/close-blob-seq-sqlite
Jun 14, 2026
Merged

fix: close blob seq sqlite migration connection#1804
igorls merged 1 commit into
developfrom
codex/close-blob-seq-sqlite

Conversation

@igorls

@igorls igorls commented Jun 14, 2026

Copy link
Copy Markdown
Member

Summary

  • close the sqlite connection used by the blob seq_id pre-open migration after probing/migrating
  • add a regression test that tracks the migration connection close path

Why

Python sqlite3 connection context managers commit or roll back, but they do not close the connection. Under Python 3.13 warning probes, the release candidate stack surfaced ResourceWarning noise from this pre-open migration path.

Validation

  • uv run --python 3.13 pytest tests/test_backends.py::test_fix_blob_seq_ids_closes_sqlite_connection tests/test_backends.py::test_fix_blob_seq_ids_converts_blobs_to_integers tests/test_backends.py::test_fix_blob_seq_ids_writes_marker_when_already_integer -q
  • PYTHONTRACEMALLOC=10 uv run --python 3.13 pytest tests/test_sync.py -q -W default::ResourceWarning -W error::pytest.PytestUnraisableExceptionWarning
  • uv run --python 3.13 ruff check mempalace/backends/chroma.py tests/test_backends.py
  • uv run --python 3.13 ruff format --check mempalace/backends/chroma.py tests/test_backends.py
  • git diff --check

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request ensures that the SQLite database connection in _fix_blob_seq_ids is properly closed by wrapping sqlite3.connect with contextlib.closing. Additionally, a unit test has been added to verify that the connection is indeed closed after the migration. There are no review comments, and I have no further feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@igorls
igorls marked this pull request as ready for review June 14, 2026 17:45
@igorls
igorls requested a review from milla-jovovich as a code owner June 14, 2026 17:45
Copilot AI review requested due to automatic review settings June 14, 2026 17:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses ResourceWarning noise under Python 3.13 by ensuring the temporary sqlite3 connection used by Chroma’s _fix_blob_seq_ids pre-open migration is explicitly closed after probing/migrating.

Changes:

  • Wrap the migration’s sqlite connection with contextlib.closing(...) to guarantee conn.close() is called.
  • Add a regression test that monkeypatches the sqlite connection factory to confirm the connection close path is exercised.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
mempalace/backends/chroma.py Ensures the _fix_blob_seq_ids sqlite3 connection is explicitly closed after the migration probe/work.
tests/test_backends.py Adds a regression test verifying the migration code path closes the sqlite connection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@igorls
igorls merged commit 58c45a9 into develop Jun 14, 2026
9 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.

2 participants