Skip to content

Fix thin-client routing fallback endpoint#49660

Open
arnabnandy7 wants to merge 5 commits into
Azure:mainfrom
arnabnandy7:fix/cosmos-rooturi-npe
Open

Fix thin-client routing fallback endpoint#49660
arnabnandy7 wants to merge 5 commits into
Azure:mainfrom
arnabnandy7:fix/cosmos-rooturi-npe

Conversation

@arnabnandy7

@arnabnandy7 arnabnandy7 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #49299.

This PR fixes a Cosmos thin-client routing fallback issue where ThinClientStoreModel could resolve to a RegionalRoutingContext with a gateway endpoint but no thin-client endpoint, causing rootUri to be null.

Changes include:

  • Populate the default regional routing context with the matching thin-client endpoint when available.
  • Remap gateway-only routing contexts to their thin-client-capable equivalent during thin-client request resolution.
  • Add a defensive error in ThinClientStoreModel when a thin-client endpoint is unexpectedly unavailable.
  • Add regression tests for default regional endpoint fallback and explicit gateway-only routing context resolution.

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.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@arnabnandy7 arnabnandy7 requested review from a team and kirankumarkolli as code owners June 27, 2026 17:32
Copilot AI review requested due to automatic review settings June 27, 2026 17:32
@github-actions github-actions Bot added Community Contribution Community members are working on the issue Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Jun 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution @arnabnandy7! We will review the pull request and get back to you soon.

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

This PR addresses a Cosmos thin-client routing fallback bug where ThinClientStoreModel could end up with a RegionalRoutingContext that has a gateway endpoint but no thin-client endpoint, leading to rootUri being null (reported in #49299). The changes focus on ensuring thin-client routing contexts are properly populated/remapped during endpoint resolution and adding regression coverage.

Changes:

  • Add a defensive failure in ThinClientStoreModel.getRootUri when the resolved routing context has no thin-client endpoint.
  • Enhance LocationCache.resolveServiceEndpoint to remap gateway-only routing contexts to thin-client-capable equivalents when thin-client mode is enabled, and attempt to populate the default routing context’s thin-client endpoint during account location processing.
  • Add unit tests covering default routing context thin-client endpoint population and explicit gateway-only routing context remapping.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ThinClientStoreModel.java Adds a defensive error when a thin-client endpoint is unexpectedly missing during thin-client request routing.
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/routing/LocationCache.java Adds thin-client-aware routing context resolution/remapping and attempts to populate thin-client endpoints on the default routing context.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/routing/LocationCacheTest.java Adds unit tests intended to prevent regressions in thin-client endpoint fallback/remapping behavior.

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

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

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

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

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

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

2 participants