-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Phase 5 — Storage Backend Abstraction Layer #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
- Add StorageBackendProtocol with 11 async methods - Define SearchResult, EmbeddingMetadata, StorageError types - All scores normalized to 0-1 range (higher=better) - Protocol is runtime_checkable for isinstance checks - Passes mypy strict type checking Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add StorageConfig to ProviderSettings with backend validation - Add AGENT_BRAIN_STORAGE_BACKEND env var override - Create get_storage_backend() factory with precedence: env > YAML > default - Add storage backend validation to validate_provider_config() - Log active storage backend in load_provider_settings() - NotImplementedError placeholders for ChromaBackend and PostgresBackend Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- test_protocol.py: 12 tests for SearchResult, EmbeddingMetadata, StorageError, protocol compliance - test_factory.py: 6 tests for backend factory resolution and cache management - test_storage_config.py: 15 tests for StorageConfig validation and integration - All 538 tests pass (33 new tests added) - Zero regressions in existing test suite Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unused Any import from factory.py - Remove unused ProviderMismatchError import from protocol.py - Fix pytest.raises(Exception) to pytest.raises(StorageError) - All linting and type checking passes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- StorageBackendProtocol with 11 async methods (100% coverage) - StorageConfig validates chroma/postgres backends - Factory resolves backend: env > YAML > default - 33 new tests added (538 total, 100% pass rate) - Zero regressions, 70% overall coverage maintained - Duration: 8 minutes (476 seconds) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Protocol - ChromaBackend wraps VectorStoreManager and BM25IndexManager - All protocol methods delegate to existing managers - BM25 scores normalized to 0-1 range (per-query max normalization) - Factory creates ChromaBackend for "chroma" config - 20 new tests covering all ChromaBackend operations - Protocol compliance verified via isinstance check - All 559 tests pass, no regressions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- QueryService and IndexingService accept storage_backend parameter - Backward-compatible: still accept vector_store + bm25_manager - Legacy params wrapped in ChromaBackend automatically - Services maintain .vector_store and .bm25_manager aliases - VectorManagerRetriever updated to use storage_backend.vector_search - Server startup initializes and logs storage backend type - Updated conftest to mock bm25_manager.search_with_filters - Updated test_bm25_api to mock search_with_filters - 555/559 tests pass (4 tests need search_with_filters mocks) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Updated test_graph_query.py multi-query test with search_with_filters - Updated test_rrf_fusion.py with search_with_filters for BM25 results - 557/559 tests pass (99.6% pass rate) - 2 tests need additional search_with_filters setup (documented in SUMMARY) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use getattr() instead of direct attribute access for type safety - Use storage_backend.get_count() instead of vector_store - All 60 source files pass mypy strict mode Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ChromaBackend adapter wraps VectorStoreManager + BM25IndexManager - Services refactored to use StorageBackendProtocol - Backward compatibility maintained for 505+ existing tests - 557/559 tests pass (99.6%), 70% coverage, mypy strict clean - 4 commits, 11 minutes execution time Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…earch path Tests for multi-mode RRF and graph query were missing search_with_filters mocks on bm25_manager, causing BM25 results to be empty when routed through ChromaBackend.keyword_search() instead of the old retriever path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 5 Storage Abstraction complete: - StorageBackendProtocol with 11 async methods - ChromaBackend adapter wrapping VectorStoreManager + BM25IndexManager - Backend factory with env var > YAML > default precedence - 559 tests passing (54 new), 70% coverage, 0 regressions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add 'from e' to all raise StorageError blocks (B904) - Fix line-too-long in docstrings and comments (E501) - Fix import ordering in test files (I001) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unused MagicMock import in test_bm25_api.py - Fix long import lines in main.py and storage/__init__.py - Collapse single-line mock assignment in test_rrf_fusion.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Create GitHub environment 'ci-testing' with OPENAI_API_KEY, ANTHROPIC_API_KEY, and COHERE_API_KEY secrets - Wire pr-qa-gate.yml to ci-testing environment with env vars - Wire provider-e2e.yml to ci-testing environment Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
OpenAIEmbeddingProvider has embed_text, not embed_batch. Call embed_text per item to test batch embedding behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
AGENT_BRAIN_STORAGE_BACKEND) > YAML (storage.backend) > default (chroma) precedenceWhat this enables
Phase 6 (PostgreSQL backend) can now implement
StorageBackendProtocoland plug in via the factory — zero changes to services required.Test plan
Requirements covered
STOR-01, STOR-02, STOR-03, STOR-04, CONF-01, CONF-02, CONF-03
🤖 Generated with Claude Code