Repository navigation
Python: Fix Cosmos hybrid search field validation - #14650
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits intoOct 23, 2026
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Eduard van Valkenburg (eavanvalkenburg)
requested a review
from a team
as a code owner
October 23, 2026 12:55
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 23, 2026 12:55 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 23, 2026 12:55 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 12:55 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 12:55 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 12:55 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 12:55 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
had a problem deploying
to
github-app-auth
October 23, 2026 12:55 — with
GitHub Actions
Failure
Copilot started reviewing on behalf of
Eduard van Valkenburg (eavanvalkenburg)
October 23, 2026 12:55
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation matches the stated requirements, includes regression coverage, and has no identified blocking issues.
No open issues 🎉
What changed in this PR
This PR hardens Cosmos DB NoSQL hybrid search by validating text-field names against the collection definition and safely rendering the resolved storage property.
Changes:
- Accept declared logical field names and storage aliases.
- Reject unknown fields before query execution and use JSON-encoded bracket notation.
- Add regression tests for field resolution and injection-shaped unknown names.
| File | Description |
|---|---|
python/tests/unit/connectors/memory/azure_cosmos_db/test_azure_cosmos_db_no_sql_collection.py |
Tests logical names, storage aliases, and rejection of unknown fields. |
python/semantic_kernel/connectors/azure_cosmos_db.py |
Validates hybrid text fields and safely renders storage-property references. |
Review effort: Balanced
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Eduard van Valkenburg (eavanvalkenburg)
had a problem deploying
to
github-app-auth
October 23, 2026 13:44 — with
GitHub Actions
Failure
Jose Alvarez (jpalvarezl)
approved these changes
Oct 23, 2026
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 23, 2026 18:01 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
enabled auto-merge
October 23, 2026 18:01
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 18:01 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 18:01 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 18:01 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 18:01 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
deleted the
cosmos-hybrid-validation
branch
October 23, 2026 18:12
This branch was previously deployed
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.
Motivation and Context
Cosmos DB NoSQL hybrid search previously inserted the requested text-field name directly into the generated query. This change limits hybrid text search to fields declared by the collection definition and safely renders the resolved storage property.
Description
additional_property_nameagainst declared data-field logical and storage names.Validation:
uv run --frozen pytest tests\unit\connectors\memory\azure_cosmos_db\test_azure_cosmos_db_no_sql_collection.py -q— passed (30 tests).uv run --frozen ruff check semantic_kernel\connectors\azure_cosmos_db.py tests\unit\connectors\memory\azure_cosmos_db\test_azure_cosmos_db_no_sql_collection.py— passed.uv run --frozen ruff format --check semantic_kernel\connectors\azure_cosmos_db.py tests\unit\connectors\memory\azure_cosmos_db\test_azure_cosmos_db_no_sql_collection.py— passed.uv run --frozen mypy semantic_kernel\connectors\azure_cosmos_db.py --config-file mypy.ini— passed.uv run --frozen python -m compileall -q semantic_kernel\connectors\azure_cosmos_db.py tests\unit\connectors\memory\azure_cosmos_db\test_azure_cosmos_db_no_sql_collection.py— passed.uv run --project python --frozen pre-commit run --config python\.pre-commit-config.yaml --files python\semantic_kernel\connectors\azure_cosmos_db.py python\tests\unit\connectors\memory\azure_cosmos_db\test_azure_cosmos_db_no_sql_collection.py— passed (all applicable hooks).git diff --check— passed.Contribution Checklist