Skip to content

[Internal] [FaultInjection] ThinClient: Fixes payload of injected errors for requests going to ThinClient Proxy#5269

Merged
FabianMeiswinkel merged 33 commits intomasterfrom
users/nalutripician/FIThinclientPayloadFix
Aug 13, 2025
Merged

[Internal] [FaultInjection] ThinClient: Fixes payload of injected errors for requests going to ThinClient Proxy#5269
FabianMeiswinkel merged 33 commits intomasterfrom
users/nalutripician/FIThinclientPayloadFix

Conversation

@NaluTripician
Copy link
Copy Markdown
Contributor

@NaluTripician NaluTripician commented Jul 3, 2025

Pull Request Template

Description

This fixes the payload of injected errors for requests going to the thin client to ensure that diagnostics contain the correct information.

This PR, move the injection point of the error from the CosmosHttpClientCore to the ThinClientStoreClient. This allows for a direct return of the response without the need to use the thin client serialization/deserialization on the faulty response generation/return.

To enable fault injection for thin client mode, create a fault injection rule the same way you would for any other gateway mode fault injection rule. Then, enable thin client mode for the client via the enable thin client environment variable.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Closing issues

To automatically close an issue: closes #5342

@NaluTripician NaluTripician self-assigned this Jul 3, 2025
@NaluTripician NaluTripician added auto-merge Enables automation to merge PRs FaultInjection For all FaultInjection related PRs/issues labels Jul 3, 2025
@microsoft-github-policy-service microsoft-github-policy-service Bot enabled auto-merge (squash) July 3, 2025 18:35
@kundadebdatta
Copy link
Copy Markdown
Member

kundadebdatta commented Jul 3, 2025

Please add more detailed description on the usage.

Comment thread Microsoft.Azure.Cosmos/src/GatewayStoreModel.cs
Comment thread Microsoft.Azure.Cosmos/src/ThinClientStoreClient.cs Outdated
@kundadebdatta kundadebdatta removed the auto-merge Enables automation to merge PRs label Jul 24, 2025
@kundadebdatta kundadebdatta requested a review from Copilot August 13, 2025 16:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 fixes the payload of injected errors for requests going to ThinClient Proxy to ensure diagnostics contain correct information. The error injection point is moved from CosmosHttpClientCore to ThinClientStoreClient to allow direct response return without using thin client serialization/deserialization on faulty responses.

  • Moves fault injection from HTTP client layer to ThinClient store client layer
  • Updates error response formatting to match proxy call expectations with proper JSON payloads
  • Removes unnecessary header setting logic from HTTP client core

Reviewed Changes

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

Show a summary per file
File Description
ThinClientStoreClient.cs Adds chaos interceptor integration and fault injection handling at the store client level
CosmosHttpClientCore.cs Removes fault injection header setting logic that is no longer needed
GatewayStoreModel.cs Passes chaos interceptor to ThinClientStoreClient constructor
DocumentClient.cs Passes chaos interceptor parameter to GatewayStoreModel
FaultInjectionServerErrorResultInternal.cs Updates error response formatting for proxy calls with proper JSON payloads and HTTP versions
FaultInjectionRuleProcessor.cs Passes global endpoint manager to fault injection server error result

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread Microsoft.Azure.Cosmos/src/ThinClientStoreClient.cs
NaluTripician and others added 2 commits August 13, 2025 12:52
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread Microsoft.Azure.Cosmos/src/GatewayStoreModel.cs
Copy link
Copy Markdown
Member

@kundadebdatta kundadebdatta left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@xinlian12 xinlian12 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks 👍

Copy link
Copy Markdown
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks

@FabianMeiswinkel FabianMeiswinkel merged commit 963b607 into master Aug 13, 2025
27 checks passed
@FabianMeiswinkel FabianMeiswinkel deleted the users/nalutripician/FIThinclientPayloadFix branch August 13, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FaultInjection For all FaultInjection related PRs/issues thin-client-integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Thin Client Integration] Fix Fault Injection Support in Thin Client Mode

6 participants