Skip to content

Fix some bugs and increase test coverage#93

Merged
alex-feel merged 4 commits intomainfrom
alex-feel-dev
Mar 26, 2026
Merged

Fix some bugs and increase test coverage#93
alex-feel merged 4 commits intomainfrom
alex-feel-dev

Conversation

@alex-feel
Copy link
Copy Markdown
Owner

No description provided.

The write queue processor in _execute_write_with_retry could use the writer connection concurrently with begin_transaction, both accessing the same SQLite connection without mutual exclusion.
This caused intermittent "cannot start a transaction within a transaction" errors under concurrent write load.

Wrap _ensure_writer_connection and execute calls inside _writer_lock to ensure all write paths are serialized through a single lock.

Refactor test_concurrent_mixed_operations into separate phases to avoid mixing begin_transaction and execute_write paths in the same asyncio.gather call.
Replace asyncio.sleep fixture cleanup with event-based wait_for_shutdown_complete for reliable teardown.
…nvention

The .dev suffix was misleading since these files build the same image as
GHCR for local testing, not development-specific configurations.
The .local suffix clearly indicates local-build alternatives to GHCR pull.

Changes:
- Rename 3 docker-compose.*.ollama.dev.yml to *.ollama.local.yml
- Add Docker Compose File Naming Convention section to CLAUDE.md
- Add Local Build Alternatives and Building from Source to docker.md
- Update env example headers to reference both GHCR and local variants
- Add Ollama sidecar clarifying comments to GHCR compose files
- Update gpu-acceleration.md file references
- Expand docker.md reference table with Image Source column
…try, and batch content_type drift

Fix three bugs discovered during comprehensive codebase audit:

B3 - Quoted phrases like "error handling" were split into individual words by _prepare_hybrid_fts_query, losing phrase semantics in boolean mode.
Switch tokenization from str.split() to re.findall() with a pattern that preserves quoted phrases as single tokens.

B1 - update_context appended an embedding generation task without checking whether an embedding provider was configured, unlike store_context which already had this guard.
Add the missing get_embedding_provider() is not None check.

B5 - update_context required both "data" and "mime_type" fields for image attachments, while store_context only required "data" and defaulted mime_type to "image/png".
Align update_context to match by defaulting mime_type when absent.

B6 - update_context_batch did not auto-correct content_type when images were not explicitly changed but text or metadata was updated.
Add content_type auto-correction in both atomic and non-atomic paths.
…tegration

Add 76 new tests across 17 test files covering the bug fixes from the previous commit and broadening overall test coverage.

New test file: tests/tools/test_descriptions.py validates discovery tool edge cases for backend-specific dynamic tool descriptions.

Repository coverage: extend tests for context, tag, image, statistics, and FTS repositories with edge case and boundary condition tests.
Tool coverage: add tests for hybrid search quoted phrase preservation, update_context embedding guard and image validation, bulk operation content_type correction, reranking fallback paths, batch summary async mocking, generation-first transactional integrity, and tool error handling adjustments.
Integration coverage: add 15 new integration test methods to test_real_server.py covering list_threads, embedding regeneration on update, batch dedup, hybrid search degradation, multimodal auto-detection, FTS stemming, FTS NOT exclusion, RRF ordering, explain_query, and health endpoint.
Mock-based PostgreSQL coverage: add tests for query builder array_contains operator branches, LangSmith tracing wrapper behavior, and FTS query transformation edge cases.
@github-actions
Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  app/backends
  sqlite_backend.py
  app/tools
  batch.py 942-943, 953-956, 1054-1055, 1065-1068
  context.py
  search.py 1034
Project Total  

This report was generated by python-coverage-comment-action

@alex-feel alex-feel merged commit 7687f35 into main Mar 26, 2026
6 checks passed
@alex-feel alex-feel deleted the alex-feel-dev branch March 26, 2026 07:32
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.

1 participant