Skip to content

[FaultInjection] ThinClient Compatibility: Adds compatibility with Thin Client Proxy. #5264

Merged
microsoft-github-policy-service[bot] merged 14 commits into
masterfrom
users/nalutripician/FaultInjectionThinClientCompatibility
Jul 1, 2025
Merged

[FaultInjection] ThinClient Compatibility: Adds compatibility with Thin Client Proxy. #5264
microsoft-github-policy-service[bot] merged 14 commits into
masterfrom
users/nalutripician/FaultInjectionThinClientCompatibility

Conversation

@NaluTripician

@NaluTripician NaluTripician commented Jun 30, 2025

Copy link
Copy Markdown
Contributor

Pull Request Template

Description

This PR allows FaultInjection rules that target gateway requests to also work with the ThinClient Proxy.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Closing issues

To automatically close an issue: closes #5256

@NaluTripician NaluTripician self-assigned this Jun 30, 2025
@NaluTripician NaluTripician added auto-merge Enables automation to merge PRs thin-client-integration labels Jun 30, 2025
@NaluTripician NaluTripician added the FaultInjection For all FaultInjection related PRs/issues label Jun 30, 2025
@microsoft-github-policy-service microsoft-github-policy-service Bot enabled auto-merge (squash) June 30, 2025 19:01
Comment thread Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjectionCondition.cs Outdated
Comment thread Microsoft.Azure.Cosmos/FaultInjection/tests/Utils/TestCommon.cs
@kundadebdatta kundadebdatta requested a review from Copilot July 1, 2025 00:02

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 adds compatibility for Thin Client Proxy in the FaultInjection framework, ensuring that rules targeting gateway requests work correctly with the Thin Client. Key changes include updating method calls to pass the ThinClient request object, adding header assignments in the HTTP client for fault injection, and extending test coverage for the new Thin Client scenarios.

  • Updated ThinClientStoreClient to pass the additional request parameter.
  • Modified CosmosHttpClientCore to assign a fault injection header in two separate blocks.
  • Extended tests and updated condition handling (including host-based comparisons) in the FaultInjection logic.

Reviewed Changes

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

Show a summary per file
File Description
Microsoft.Azure.Cosmos/src/ThinClientStoreClient.cs Updated InvokeClientAsync to pass the additional request parameter for ThinClient compatibility.
Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs Added header assignment for fault injection in gateway requests; note the duplicated logic in two code blocks.
Microsoft.Azure.Cosmos/FaultInjection/tests/Utils/TestCommon.cs Introduced a helper method for obtaining ThinClient connection strings.
Microsoft.Azure.Cosmos/FaultInjection/tests/FaultInjectionProxyTests.cs Added extensive new test cases for fault injection rules with ThinClient.
Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionRuleProcessor.cs Updated effective rule construction to pass the global endpoint manager.
Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionConditionInternal.cs Updated the constructor to require a GlobalEndpointManager and changed URI comparisons to use Host instead of AbsoluteUri.
Comments suppressed due to low confidence (1)

Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionConditionInternal.cs:209

  • [nitpick] Please consider adding a comment explaining the decision to use the Host property for comparison instead of the full AbsoluteUri to clarify the intent for future maintainers.
                    .StartsWith(uri.Host));

Comment thread Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs Outdated
Comment thread Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs Outdated
@kirankumarkolli

Copy link
Copy Markdown
Member

FI is a public library and this change ideal to go into the release notes

@kirankumarkolli

Copy link
Copy Markdown
Member

FI is a public library and this change ideal to go into the release notes

Also not all kinds of faulults are not applicable for ThinProxy. At-least worth calling out which ones are applicable vs not.
Even ideal if we can error out.

@NaluTripician NaluTripician changed the title [Internal] [FaultInjection] ThinClient Compatibility: Adds compatibility with Thin Client Proxy. [FaultInjection] ThinClient Compatibility: Adds compatibility with Thin Client Proxy. Jul 1, 2025
@NaluTripician

Copy link
Copy Markdown
Contributor Author

FI is a public library and this change ideal to go into the release notes

Also not all kinds of faulults are not applicable for ThinProxy. At-least worth calling out which ones are applicable vs not. Even ideal if we can error out.

I will remove the internal tag and update the Fault Injection changelog for the next release. I will also add info in the readme about the Thin Proxy mode to this PR

@kundadebdatta kundadebdatta left a comment

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.

LGTM! Thanks.

@microsoft-github-policy-service microsoft-github-policy-service Bot merged commit 32f8b00 into master Jul 1, 2025
27 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot deleted the users/nalutripician/FaultInjectionThinClientCompatibility branch July 1, 2025 21:59
NaluTripician added a commit that referenced this pull request Apr 30, 2026
## FaultInjection 1.0.0-beta.1 release

This PR releases the Microsoft.Azure.Cosmos.FaultInjection package at
version **1.0.0-beta.1**. The previous release was 1.0.0-beta.0 on
2024-11-15.

### Version
- `FaultInjectionVersion` = 1.0.0
- `FaultInjectionSuffixVersion` = beta.1 (was beta.0)

### Scope
- Only the FaultInjection package is being released. No version bumps
for Microsoft.Azure.Cosmos, Microsoft.Azure.Cosmos.Encryption, or
Microsoft.Azure.Cosmos.Encryption.Custom.

### Included PRs (since 1.0.0-beta.0)

#### Added
- #4867 FaultInjection: Adds method to add FaultInjection using
CosmosClientBuilder
- #4989 Metadata Requests: Adds Metadata request support for
FaultInjection
- #5264 ThinClient Compatibility: Adds compatibility with Thin Client
Proxy
- #5510 Unauthorized Errors: Adds Unauthorized status codes
- #5677 FaultInjection: Adds XML documentation, stylecop.json, and
updates test packages
- #5679 FaultInjection: Adds comprehensive unit test coverage

#### Fixed
- #5676 FaultInjection: Fixes naming typos and XML documentation
- #5675 FaultInjection: Fixes critical bugs for release 2
- #5678 FaultInjection: Refactors code quality improvements

### Checklist
- [x] Changelog updated
(`Microsoft.Azure.Cosmos/FaultInjection/changelog.md`)
- [x] Version bumped in `Directory.Build.props`
- [ ] Release pipeline (`azure-pipelines-faultinjection.yml`) run after
merge

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

Co-authored-by: Copilot <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

auto-merge Enables automation to merge PRs 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] Add Fault Injection support for Thin Client in .NET SDK

4 participants