Skip to content

Support read consistency in Gateway V2 emulator - #5178

Closed
Simon Moreno (simorenoh) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-gateway-v2-live-tests
Closed

Support read consistency in Gateway V2 emulator#5178
Simon Moreno (simorenoh) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-gateway-v2-live-tests

Conversation

Copilot AI commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

PATCH's internal read uses LatestCommitted, which is serialized for Gateway V2 as an RNTBD ReadConsistencyStrategy token. The hosted emulator now validates and preserves that intent when translating the request instead of rejecting or dropping it.

  • RNTBD handling

    • Decode supported ReadConsistencyStrategy values 0x01-0x04.
    • Forward the corresponding x-ms-cosmos-read-consistency-strategy header on the translated request.
    • Reject unknown values.
    • Reject requests containing both ConsistencyLevel and ReadConsistencyStrategy.
  • Coverage

    • Assert every supported strategy is forwarded with the correct value.
    • Add cases for invalid strategy values and conflicting consistency tokens.
    • Let the existing PATCH tests provide end-to-end coverage.

Fixes #5177

@azure-pipelines

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

Copilot AI linked an issue Aug 28, 2026 that may be closed by this pull request
Co-authored-by: simorenoh <30335873+simorenoh@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Gateway V2 live tests for PATCH method Support read consistency in Gateway V2 emulator Aug 28, 2026
@simorenoh
Simon Moreno (simorenoh) marked this pull request as ready for review August 28, 2026 14:40
@simorenoh
Simon Moreno (simorenoh) requested a review from a team as a code owner August 28, 2026 14:40
Copilot AI balanced review requested due to automatic review settings August 28, 2026 14:40
@azure-pipelines

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

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

Adds Gateway V2 emulator support for read consistency strategies, resolving PATCH failures caused by LatestCommitted.

Changes:

  • Accepts supported RNTBD strategy values 0x01–0x04.
  • Rejects unknown values and conflicting consistency tokens.
  • Adds validation tests for these cases.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@simorenoh

Copy link
Copy Markdown
Member

/azp run rust - cosmos - weekly

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One blocking issue

Decode validated RNTBD strategy bytes back to the driver enum and preserve the strategy on the translated emulator request.

Expand Gateway V2 coverage to assert every supported strategy is forwarded while retaining invalid-value and conflicting-token validation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 93397907-0419-4fd2-9cb8-6334252e6085
@simorenoh

Copy link
Copy Markdown
Member

/azp run rust - cosmos - weekly

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member

Closed by #5196

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.

Cosmos: fix Gateway V2 live tests

7 participants