Skip to content

fix(cosmos): RxDocumentServiceRequest clone field copying - #50069

Open
Arnab Nandy (arnabnandy7) wants to merge 1 commit into
Azure:mainfrom
arnabnandy7:fix/clone-missing-request-fields
Open

fix(cosmos): RxDocumentServiceRequest clone field copying#50069
Arnab Nandy (arnabnandy7) wants to merge 1 commit into
Azure:mainfrom
arnabnandy7:fix/clone-missing-request-fields

Conversation

@arnabnandy7

Copy link
Copy Markdown
Contributor

Description

Fixes #48496.

Audits RxDocumentServiceRequest.clone() and copies request-scoped fields that were previously omitted. This prevents cloned requests used by hedging and availability strategies from losing routing, timeout, throughput-control, authorization, and request metadata.

The change:

  • Copies the missing request fields, including effectivePartitionKey, properties, throughputControlGroupName, responseTimeout, and entityId.
  • Preserves address-refresh, batch, barrier-request, authorization, collection RID, and HTTP serializer state.
  • Defensively copies the mutable properties map.
  • Removes a redundant requestContext assignment.
  • Adds regression coverage for the copied request state.
  • Adds a reflection-based completeness test that requires clone() to be audited whenever a new instance field is introduced.

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.

Copilot AI lite review requested due to automatic review settings August 8, 2026 14:39
@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 Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

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

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
33 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

Fixes a Cosmos SDK correctness issue where RxDocumentServiceRequest.clone() failed to copy several request-scoped fields, causing hedged/availability-strategy clones to lose routing, timeout, authorization, and request metadata.

Changes:

  • Updated RxDocumentServiceRequest.clone() to copy additional request-scoped fields (including effectivePartitionKey, properties (defensive map copy), throughput-control, barrier/collection routing flags, responseTimeout, and HTTP transport serializer state).
  • Removed a redundant requestContext assignment while retaining a defensive requestContext.clone().
  • Added regression tests for request-scoped clone behavior plus a reflection-based “audit required on new fields” completeness test.

Reviewed changes

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

File Description
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentServiceRequest.java Expands clone() to preserve previously omitted request-scoped state needed by hedging/availability behaviors.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/RxDocumentServiceRequestTest.java Adds regression coverage for copied state and a reflection-based guard to force future clone() audits when fields are added.

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

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>

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 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

Development

Successfully merging this pull request may close these issues.

[Cosmos] Audit RxDocumentServiceRequest.clone() for missing field copies

2 participants