Skip to content

[Cosmos] Populate sourceCollectionRid for GSI container creation#48047

Draft
mbhaskar wants to merge 4 commits into
Azure:mainfrom
mbhaskar:cosmos-gsi-populate-source-rid
Draft

[Cosmos] Populate sourceCollectionRid for GSI container creation#48047
mbhaskar wants to merge 4 commits into
Azure:mainfrom
mbhaskar:cosmos-gsi-populate-source-rid

Conversation

@mbhaskar

Copy link
Copy Markdown
Member

The service resolves the GSI/materialized-view source container by its resource id (sourceCollectionRid). The SDK previously sent only sourceCollectionId, causing the create/replace container request to fail with BadRequest ("Unable to fetch source collection provided in the Materialized View definition").

Read the source container to obtain its _rid and populate sourceCollectionRid on the wire payload, mirroring the Java SDK behavior. Applied to sync and async create_container / create_container_if_not_exists (via delegation) and replace_container.

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

The service resolves the GSI/materialized-view source container by its
resource id (sourceCollectionRid). The SDK previously sent only
sourceCollectionId, causing the create/replace container request to fail
with BadRequest ("Unable to fetch source collection provided in the
Materialized View definition").

Read the source container to obtain its _rid and populate
sourceCollectionRid on the wire payload, mirroring the Java SDK behavior.
Applied to sync and async create_container / create_container_if_not_exists
(via delegation) and replace_container.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
8 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

mbhaskar and others added 3 commits July 14, 2026 13:49
Some service versions return the GSI definition under the legacy
materializedViewDefinition key. Normalize container read properties so the
public globalSecondaryIndexDefinition field is always populated when a GSI
definition is present, regardless of the backend contract version.

Applied to sync and async ContainerProxy.read().

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The GSI build status is a read-only, server-populated field that may be
absent from a container read response before the index build is tracked.
Match the Java SDK contract (getStatus() returns null when absent) by
asserting on status only when the service returns it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Normalize container properties returned by create_container and
replace_container (sync and async) the same way as read(): promote the GSI
definition to globalSecondaryIndexDefinition and drop the legacy
materializedViewDefinition key entirely. The public surface now consistently
exposes only globalSecondaryIndexDefinition, regardless of the backend
contract version.

Extend the live test to assert the create response surfaces
globalSecondaryIndexDefinition and never contains materializedViewDefinition.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant