fix: validate Ollama embedding response count (MEDIUM #21)#121
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
OllamaEmbedding.embed() now checks len(embeddings) == len(texts) and raises ValueError on mismatch. This prevents silent data loss when zip(strict=False) in backfill_embeddings would quietly drop entries if Ollama returned a partial response (MEDIUM #21). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fdb4cfa to
56c0c16
Compare
cmeans
reviewed
Mar 31, 2026
Owner
cmeans
left a comment
There was a problem hiding this comment.
QA Review — PR #121: Validate Ollama embedding response count (MEDIUM #21)
Reviewer: QA Agent | Date: 2026-03-30
Code Review: PASS
Validates len(result) == len(texts) after Ollama response, logs warning, raises ValueError on mismatch. Prevents silent data loss from zip(strict=False) in backfill_embeddings. Tests mock urlopen to simulate partial response — clean isolation.
Tests: 533/533 PASS
CI: All green
Findings: Zero
Owner
QA Audit — PR #121CI: All green | Tests: 533/533 pass
|
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
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
OllamaEmbedding.embed()now validates thatlen(embeddings) == len(texts)and raisesValueErroron mismatch, preventing silent data loss when Ollama returns a partial responsezip(strict=False)inbackfill_embeddingswould quietly drop entries if the response was truncatedTest plan
python -m pytest tests/test_embeddings.py -v— all 30 tests pass including newtest_partial_response_raisesandtest_correct_response_count_succeedsruff check src/ tests/— no lint issuesmypy src/mcp_awareness/— no type errorsQA
Prerequisites
pip install -e ".[dev]"AWARENESS_PORT=8421)Manual tests (via MCP tools)
backfill_embeddings(limit=5)on an instance with Ollama running. Verify it completes without error and reports embeddings created.Expected: Returns JSON with
newcount and no errorssemantic_search(query="test query")on an instance with embeddings.Expected: Returns search results normally (no regression)
🤖 Generated with Claude Code