feat(client): adopt MX.Api.Client 2.3.77 shared cache configuration pattern - #738
Merged
Merged
Conversation
…attern Adopt reflection-free SharedCacheConfiguration so consumers can register cache expressions targeting multiple typed sub-APIs (V1 IGeoLookupApi, V1.1 IGeoLookupApi, IApiInfoApi, IApiHealthApi) in a single WithCaching delegate without ArgumentException at DI registration time. - Bump MX.Api.Client + MX.Api.Abstractions 2.3.67 -> 2.3.77 - Bump Microsoft.Extensions.* 10.0.9 -> 10.0.10 (required by MX.Api.Client 2.3.77) - Override GeoLocationApiOptionsBuilder.WithCaching(Action<CacheBuilder>) to capture the delegate instead of applying it against a single client scope - Rewrite AddGeoLocationApiClient to probe once, share via WithSharedCaching, then ValidateAllOperationsMatched as a typo guard - Add read-only library cache defaults (Caching/GeoLocationApiCacheDefaults) for GetGeoLocation (v1, 60m), GetCityGeoLocation (v1.1, 60m), GetInsightsGeoLocation (30m), GetProxyCheck (15m), GetIpIntelligence (15m); write/delete/batch/info/health left uncached - Add AddGeoLocationApiClientCompositionTests DI-composition regression test under the default (non-integration) filter Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Dependency ReviewThe following issues were found:
Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. License Issuessrc/MX.GeoLocation.Abstractions.V1/MX.GeoLocation.Abstractions.V1.csproj
src/MX.GeoLocation.Api.Client.Testing.Tests/MX.GeoLocation.Api.Client.Testing.Tests.csproj
src/MX.GeoLocation.Api.Client.Testing/MX.GeoLocation.Api.Client.Testing.csproj
src/MX.GeoLocation.Api.Client.Tests.V1/MX.GeoLocation.Api.Client.Tests.V1.csproj
src/MX.GeoLocation.Api.Client.V1/MX.GeoLocation.Api.Client.V1.csproj
src/MX.GeoLocation.Api.V1/MX.GeoLocation.Api.V1.csproj
src/MX.GeoLocation.Web.IntegrationTests/MX.GeoLocation.Web.IntegrationTests.csproj
src/MX.GeoLocation.Web/MX.GeoLocation.Web.csproj
OpenSSF ScorecardScorecard details
Scanned Files
|
frasermolyneux
temporarily deployed
to
Development
August 3, 2026 11:18 — with
GitHub Actions
Inactive
There was a problem hiding this comment.
Pull request overview
This PR updates MX.GeoLocation.Api.Client.V1 to use MX.Api.Client 2.3.77’s reflection-free shared caching registration approach, enabling a single .WithCaching(...) delegate to target multiple typed sub-APIs without scope-validation crashes. It also introduces opt-in library cache defaults for read-only lookup operations and adds a DI-composition regression test to lock in the behavior.
Changes:
- Adopt
SharedCacheConfiguration+WithSharedCaching(...)flow inAddGeoLocationApiClient, including a finalValidateAllOperationsMatched()typo guard. - Add opt-in library cache defaults (
UseLibraryDefaults()) for key read-only GeoLookup operations (v1 + v1.1). - Bump MX.Api.* and Microsoft.Extensions.* dependencies (plus regression tests for the new DI/caching composition).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/MX.GeoLocation.Web/MX.GeoLocation.Web.csproj | Bumps Microsoft.Extensions.* patch versions used by the web app. |
| src/MX.GeoLocation.Web.IntegrationTests/MX.GeoLocation.Web.IntegrationTests.csproj | Aligns integration test project Microsoft.Extensions.Configuration* patch versions. |
| src/MX.GeoLocation.Api.V1/MX.GeoLocation.Api.V1.csproj | Updates Microsoft.Extensions.* patches and bumps MX.Api.Abstractions. |
| src/MX.GeoLocation.Api.Client.V1/ServiceCollectionExtensions.cs | Implements shared-cache capture/apply pattern and validates shared cache expressions post-registration. |
| src/MX.GeoLocation.Api.Client.V1/MX.GeoLocation.Api.Client.V1.csproj | Bumps MX.Api.Client / MX.Api.Abstractions and Microsoft.Extensions.* patches. |
| src/MX.GeoLocation.Api.Client.V1/GeoLocationApiOptionsBuilder.cs | Adds method-hiding WithCaching(...) to capture cache configuration for shared-scope application. |
| src/MX.GeoLocation.Api.Client.V1/Caching/GeoLocationApiCacheDefaults.cs | Introduces opt-in library cache defaults (TTLs) for read-only GeoLookup calls. |
| src/MX.GeoLocation.Api.Client.Tests.V1/MX.GeoLocation.Api.Client.Tests.V1.csproj | Updates Microsoft.Extensions.Logging patch version for the test project. |
| src/MX.GeoLocation.Api.Client.Tests.V1/AddGeoLocationApiClientCompositionTests.cs | Adds DI-composition regression tests for multi-sub-API caching and unknown-interface validation. |
| src/MX.GeoLocation.Api.Client.Testing/MX.GeoLocation.Api.Client.Testing.csproj | Bumps MX.Api.Abstractions and Microsoft.Extensions.DependencyInjection.Abstractions patch versions. |
| src/MX.GeoLocation.Api.Client.Testing.Tests/MX.GeoLocation.Api.Client.Testing.Tests.csproj | Updates Microsoft.Extensions.DependencyInjection patch version (and normalizes file header). |
| src/MX.GeoLocation.Abstractions.V1/MX.GeoLocation.Abstractions.V1.csproj | Bumps MX.Api.Abstractions to match the updated MX.Api dependency baseline. |
Contributor
⛔ Superseded — A newer run has replaced this result.🏗️ Terraform Plan
✅ Validate — Passed ✅ Plan
📋 Resource Details
|
Align MX.Api.Web.Extensions with the rest of the MX.Api.* stack (Client/Abstractions already at 2.3.77) per PR review feedback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
frasermolyneux
temporarily deployed
to
Development
August 3, 2026 11:50 — with
GitHub Actions
Inactive
Contributor
🏗️ Terraform Plan
✅ Validate — Passed ✅ Plan
📋 Resource Details
|
This was referenced Aug 16, 2026
This branch was previously deployed
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.



Summary
Adopt MX.Api.Client 2.3.77's reflection-free
SharedCacheConfigurationregistration pattern inMX.GeoLocation.Api.Client.V1, add read-only library cache defaults for the GeoLookup surface, and lock the fix in with a DI-composition regression test. Consumers can now register cache expressions targeting multiple typed sub-APIs in a single.WithCaching(...)delegate without the previousArgumentExceptionscope crash at DI registration time.Closes: agent task (no numbered issue)
Type of change
Required reading consulted
AGENTS.md(repo brief).github/copilot-instructions.md(repo orientation).github-copilot/.github/instructions/personal.working-preferences.instructions.md(always-on rules)AGENTS.md(standards.dotnet-project.instructions.md,standards.branching-and-prs.instructions.md)Validation evidence
Build
Tests
Total: 274 tests passed, 0 failed. The 3 new tests in
AddGeoLocationApiClientCompositionTestsare part of theMX.GeoLocation.Api.Client.Tests.V1count (previously 4, now 7).Format check
Risk and rollout
MX.GeoLocation.Api.Client.V1NuGet package — consumed by the in-repoMX.GeoLocation.Webproject and any external consumers of the client library. Also touchesMX.GeoLocation.Abstractions.V1,MX.GeoLocation.Api.V1, andMX.GeoLocation.Webvia transitive dependency version bumps (Microsoft.Extensions.* 10.0.9 → 10.0.10 patch, MX.Api.* 2.3.67 → 2.3.77).main. The API + Web apps auto-deploy per the standard deploy-dev/deploy-prd workflows onmain.Consumer impact
MX.GeoLocation.Api.Client.V1— new public methodGeoLocationApiOptionsBuilder.WithCaching(Action<CacheBuilder>)(method-hidingnewoverride) and new public typeMX.GeoLocation.Api.Client.V1.Caching.GeoLocationApiCacheDefaults. Registration semantics ofAddGeoLocationApiClientnow appliesWithSharedCachingper typed sub-API and callsSharedCacheConfiguration.ValidateAllOperationsMatched()at the end..WithCaching(...)are unaffected. Existing single-scope.WithCaching(...)targetingIGeoLookupApi(V1) continues to work — the delegate is captured and re-applied per sub-API, and scope-mismatched siblings are silently skipped byWithSharedCachinginstead of throwing. Any consumer that was previously relying on the crash to detect a typo will now get a clearerInvalidOperationExceptionfromValidateAllOperationsMatched()at registration time instead.MX.GeoLocation.Web(no.WithCachingusage). Any external consumers of the client NuGet package..WithCaching(c => c.UseLibraryDefaults())— defaults cover: v1GetGeoLocation(60 min in-memory), v1.1GetCityGeoLocation(60 min),GetInsightsGeoLocation(30 min),GetProxyCheck(15 min),GetIpIntelligence(15 min). Batch, delete, info, and health surfaces are intentionally uncached.Reviewer focus areas
src/MX.GeoLocation.Api.Client.V1/ServiceCollectionExtensions.cs— capture-and-share flow: probe →SharedCacheConfiguration→ per-clientWithSharedCaching→ValidateAllOperationsMatched.src/MX.GeoLocation.Api.Client.V1/GeoLocationApiOptionsBuilder.cs—new WithCachingoverload is intentional method-hiding; it stashes the delegate onCapturedCacheConfigurefor the orchestrator to re-apply.src/MX.GeoLocation.Api.Client.V1/Caching/GeoLocationApiCacheDefaults.cs— TTL choices for read-only lookups. ProxyCheck / IP intelligence are deliberately shorter than MaxMind city/insights to bound risk-signal staleness.src/MX.GeoLocation.Api.Client.Tests.V1/AddGeoLocationApiClientCompositionTests.cs— the "multi-sub-API cache" test is the pre-fix crash reproducer; a passing run locks the regression down.Agent attestation
code-reviewsub-agent; High/Medium findings resolved or justified above in Reviewer focus areas (review reported no significant issues)standards.oidc-and-secrets.instructions.md)