Skip to content

Fix cosmosdb vectorstore bug#14182

Open
westey-m wants to merge 2 commits into
microsoft:mainfrom
westey-m:python-cosmosdb-bug-fix
Open

Fix cosmosdb vectorstore bug#14182
westey-m wants to merge 2 commits into
microsoft:mainfrom
westey-m:python-cosmosdb-bug-fix

Conversation

@westey-m

Copy link
Copy Markdown
Contributor

Motivation and Context

Description

Contribution Checklist

Copilot AI review requested due to automatic review settings July 23, 2026 16:08
@westey-m
westey-m requested a review from a team as a code owner July 23, 2026 16:08

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

Updates the Azure Cosmos DB (NoSQL) vector store connector to build SQL filters using bound parameters for string constants, preventing SQL injection and fixing failures with apostrophes/backslash-escaped strings; adds regression coverage to validate the behavior.

Changes:

  • Parameterize Cosmos NoSQL filter string literals (emit c.field = @filter_pN plus parameters) and renumber parameter names across multiple filters in _inner_search.
  • Update and expand unit tests to assert parameter binding (including concurrency isolation and _inner_search query assertions).
  • Add an integration regression test covering equality filters with apostrophes and injection-shaped payloads.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
python/semantic_kernel/connectors/azure_cosmos_db.py Parameterizes filter string constants and renumbers filter parameters when composing multiple filters in Cosmos NoSQL queries.
python/tests/unit/connectors/memory/azure_cosmos_db/test_azure_cosmos_db_no_sql_collection.py Updates unit tests for parameterized filters; adds concurrency and _inner_search parameterization coverage.
python/tests/integration/memory/azure_cosmos_db/test_azure_cosmos_db_no_sql.py Adds an end-to-end regression test ensuring filtered searches behave correctly for apostrophes and injection payloads.

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

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
connectors
   azure_cosmos_db.py42312869%182, 199, 205–207, 317, 319, 394, 398, 414–417, 419–422, 424–425, 438–441, 444–446, 452–453, 455, 462–464, 468–470, 493–495, 501–503, 509–510, 512, 517, 534, 609, 626, 629–630, 638, 648–652, 709, 712–713, 750, 752, 765–766, 770–772, 786, 790, 826, 833, 835–839, 843, 855–856, 891–894, 902, 909, 916, 918, 921–930, 933–934, 936–943, 949, 963–966, 974, 978, 1002, 1030–1031, 1035–1040, 1132–1137
TOTAL28967563980% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
4074 23 💤 0 ❌ 0 🔥 2m 20s ⏱️

@github-actions github-actions 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.

Automated Code Review

Reviewers: 5 | Confidence: 92% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by westey-m's agents

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.

4 participants