Conversation
Add a reusable HttpClientFactory (Polly retry/circuit breaker) with AssemblyInfo, an AOT-safe GetExecutingAssembly substitute, and HttpClientOptions. Route Download through the factory. Gate library AOT verification behind PublishAot and prove it via the Sandbox Native AOT smoke test. Also resolve CA1002/CA2007 and test-code analyzer findings.
Add deterministic, network-free tests that exercise the HttpClientFactory Polly pipeline via a stub inner transport: retry on transient status, no retry on non-transient, retry on timeout, and no retry on caller cancellation. Re-adds the documented test-scoped CA2007 suppression (xUnit1030 conflict). Test-only; no library change.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #394 +/- ##
==========================================
+ Coverage 40.62% 46.37% +5.75%
==========================================
Files 10 13 +3
Lines 1024 1160 +136
Branches 99 108 +9
==========================================
+ Hits 416 538 +122
- Misses 580 592 +12
- Partials 28 30 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Promotes the v4.0 release to main by introducing a reusable resilient HttpClientFactory (Polly-based retry + circuit breaker + pooling), adding an AOT-safe AssemblyInfo identity helper, and routing Download through the new client factory while updating public collection surfaces away from List<T>.
Changes:
- Add
HttpClientFactory+HttpClientOptionsand wireDownloadto use the factory-created client. - Add
AssemblyInfofor AOT-safe assembly/app identity and default User-Agent; update Sandbox to exercise identity + resilience paths. - Apply the breaking public API shift from
List<T>toCollection<T>/ReadOnlyCollection<T>, and add/adjust tests + analyzer config to match.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| version.json | Bumps the stable release version to 4.0. |
| UtilitiesTests/StringCompressionTests.cs | Uses deterministic RNG API suitable for analyzers in test data generation. |
| UtilitiesTests/StringCompressionAsyncTests.cs | Same RNG change for async compression tests. |
| UtilitiesTests/HttpClientOptionsTests.cs | Adds default-value coverage for the new HttpClient configuration options. |
| UtilitiesTests/HttpClientFactoryTests.cs | Adds basic behavioral tests for shared vs caller-owned clients and handler creation. |
| UtilitiesTests/HttpClientFactoryResilienceTests.cs | Adds offline deterministic tests for retry/circuit behavior via a stub transport. |
| UtilitiesTests/FileExAsyncTests.cs | Adjusts cancellation to use CancelAsync() in async test flow. |
| UtilitiesTests/ExtensionsTests.cs | Adjusts cancellation to use CancelAsync() in async test flow. |
| UtilitiesTests/ConsoleTests.cs | Ensures Console.Out is restored via try/finally to avoid cross-test pollution. |
| UtilitiesTests/AssemblyInfoTests.cs | Adds coverage for AOT-safe assembly identity and default User-Agent generation. |
| UtilitiesTests/.editorconfig | Updates test-scoped analyzer settings (xUnit-specific constraints). |
| Utilities/Utilities.csproj | Gates AOT verification behind PublishAot and adds resilience package reference. |
| Utilities/StringHistory.cs | Changes public StringList exposure to ReadOnlyCollection<string> and internalizes mutation. |
| Utilities/StringCompression.cs | Updates await using disposal to satisfy analyzer requirements around ConfigureAwait. |
| Utilities/HttpClientOptions.cs | Introduces a best-practice defaults options type for resilient HTTP clients. |
| Utilities/HttpClientFactory.cs | Introduces the resilient HTTP client factory (retry/circuit breaker/pooling + UA). |
| Utilities/GlobalUsings.cs | Adds global using for collection types used in the breaking API update. |
| Utilities/FileEx.cs | Updates directory enumeration API to safe collection types and updates await using patterns. |
| Utilities/Extensions.cs | Adds source-generated logging helpers for HTTP retry/circuit breaker events. |
| Utilities/Download.cs | Routes download HTTP usage through the new factory while keeping signatures stable. |
| Utilities/AssemblyInfo.cs | Introduces AOT/trim-safe identity helpers and a default User-Agent builder. |
| Utilities/.editorconfig | Removes prior library-wide analyzer relaxations now addressed by code changes. |
| Sandbox/Program.cs | Refactors sandbox entrypoint into async flow exercising new samples and async logger flush. |
| Sandbox/HttpClientSample.cs | Adds a sample that drives resilience behavior deterministically without external dependencies. |
| Sandbox/AssemblyIdentitySample.cs | Adds a sample validating AOT-safe identity resolution under AOT and non-AOT runs. |
| README.md | Updates release notes for v4.0, highlighting breaking changes and the main new features. |
| HISTORY.md | Adds detailed v4.0 release history entry documenting new features and breaking changes. |
| Directory.Packages.props | Centralizes the new Microsoft.Extensions.Http.Resilience package version. |
| cspell.json | Adds “Polly” to the spelling dictionary. |
| .vscode/tasks.json | Adds a convenience task for publishing the Sandbox as Native AOT. |
| .vscode/launch.json | Adds a launch configuration for running Sandbox in a non-AOT debug scenario. |
Narrow IsTransientFailure to retry only transient HTTP status, request timeouts, and network/IO errors; do not retry caller cancellation, an open circuit, or other exceptions (including programming errors). Adds two mocked tests. Addresses the Copilot finding on the develop->main release PR.
Remove CreateClient(ProductInfoHeaderValue) to eliminate the CreateClient(null) ambiguity; callers set the user agent via HttpClientOptions. Addresses a Copilot finding on the develop->main release PR before the stable 4.0 API ships.
Update doc comments that still said 'list' for the Collection<T>/ReadOnlyCollection<T> return types on FileEx.EnumerateDirectories/EnumerateDirectory and StringHistory.StringList. Docs only. Addresses a Copilot finding on the develop->main release PR.
Refine IsTransientFailure so a status-bearing HttpRequestException is transient only for a transient status (408/429/>=500); network HttpRequestException (no status) and IOException stay transient. Centralize the transient-status predicate. Add positive and negative mocked tests. Addresses Copilot findings on the develop->main release PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Promotes v4.0 to main for a stable release.
Included
HttpClientOptionsfor tuning and both a shared client and a resilience-handler surface.For<T>()substitutes forAssembly.GetExecutingAssembly()(Native AOT), plus app name/version and a default User-Agent.List<T>public members changed toCollection<T>/ReadOnlyCollection<T>(breaking API change).PublishAot; Sandbox is a Native AOT smoke test proving the pipeline and identity resolution under AOT.See HISTORY.md for the full v4.0 entry.
🤖 Generated with Claude Code