Skip to content

fix: validate Ollama embedding response count (MEDIUM #21)#121

Merged
cmeans-claude-dev[bot] merged 2 commits into
mainfrom
fix/ollama-response-validation
Mar 31, 2026
Merged

fix: validate Ollama embedding response count (MEDIUM #21)#121
cmeans-claude-dev[bot] merged 2 commits into
mainfrom
fix/ollama-response-validation

Conversation

@cmeans-claude-dev
Copy link
Copy Markdown
Contributor

@cmeans-claude-dev cmeans-claude-dev Bot commented Mar 31, 2026

Summary

  • OllamaEmbedding.embed() now validates that len(embeddings) == len(texts) and raises ValueError on mismatch, preventing silent data loss when Ollama returns a partial response
  • Previously, zip(strict=False) in backfill_embeddings would quietly drop entries if the response was truncated
  • Added two unit tests: one for partial response detection, one confirming normal operation

Test plan

  • python -m pytest tests/test_embeddings.py -v — all 30 tests pass including new test_partial_response_raises and test_correct_response_count_succeeds
  • ruff check src/ tests/ — no lint issues
  • mypy src/mcp_awareness/ — no type errors

QA

Prerequisites

  • pip install -e ".[dev]"
  • Deploy to test instance on alternate port (AWARENESS_PORT=8421)

Manual tests (via MCP tools)

    • Backfill with Ollama available: Call backfill_embeddings(limit=5) on an instance with Ollama running. Verify it completes without error and reports embeddings created.
    backfill_embeddings(limit=5)
    

    Expected: Returns JSON with new count and no errors

    • Verify existing embedding workflows unaffected: Call semantic_search(query="test query") on an instance with embeddings.
    semantic_search(query="test query")
    

    Expected: Returns search results normally (no regression)

🤖 Generated with Claude Code

@cmeans-claude-dev cmeans-claude-dev Bot added the Dev Active Developer is actively working on this PR; QA should not start label Mar 31, 2026
@github-actions github-actions Bot added the Awaiting CI Dev complete, waiting for CI/Codecov to pass before QA label Mar 31, 2026
@cmeans cmeans changed the title docs: fix data dictionary gaps and document AWARENESS_PUBLIC_URL fix: validate Ollama embedding response count (MEDIUM #21) Mar 31, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

cmeans-claude-dev[bot] and others added 2 commits March 30, 2026 19:29
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>
@cmeans cmeans force-pushed the fix/ollama-response-validation branch from fdb4cfa to 56c0c16 Compare March 31, 2026 00:29
@cmeans-claude-dev cmeans-claude-dev Bot removed the Dev Active Developer is actively working on this PR; QA should not start label Mar 31, 2026
@github-actions github-actions Bot added Ready for QA Dev work complete — QA can begin review and removed Awaiting CI Dev complete, waiting for CI/Codecov to pass before QA labels Mar 31, 2026
@cmeans cmeans added QA Active QA is actively reviewing; Dev should not push changes and removed Ready for QA Dev work complete — QA can begin review labels Mar 31, 2026
@cmeans-claude-dev cmeans-claude-dev Bot added the Ready for QA Dev work complete — QA can begin review label Mar 31, 2026
Copy link
Copy Markdown
Owner

@cmeans cmeans left a comment

Choose a reason for hiding this comment

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

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

@cmeans
Copy link
Copy Markdown
Owner

cmeans commented Mar 31, 2026

QA Audit — PR #121

CI: All green | Tests: 533/533 pass

# Severity Finding
No findings
Adding Ready for QA Signoff.

@cmeans cmeans added Ready for QA Signoff QA passed — ready for maintainer final review and merge and removed QA Active QA is actively reviewing; Dev should not push changes labels Mar 31, 2026
Copy link
Copy Markdown
Owner

@cmeans cmeans left a comment

Choose a reason for hiding this comment

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

LGTM

@cmeans cmeans added QA Approved Manual QA testing completed and passed and removed Ready for QA Dev work complete — QA can begin review Ready for QA Signoff QA passed — ready for maintainer final review and merge labels Mar 31, 2026
@cmeans-claude-dev cmeans-claude-dev Bot merged commit f1385e3 into main Mar 31, 2026
47 checks passed
@cmeans-claude-dev cmeans-claude-dev Bot deleted the fix/ollama-response-validation branch March 31, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

QA Approved Manual QA testing completed and passed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant