Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Jan 7, 2026

Link issues

fixes #892

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Enhancements:

  • Stop registering HttpClient in AddBootstrapBlazorAzureTranslator, assuming it is configured by the host application.

Copilot AI review requested due to automatic review settings January 7, 2026 00:57
@bb-auto bb-auto bot added the enhancement New feature or request label Jan 7, 2026
@bb-auto bb-auto bot added this to the v9.2.0 milestone Jan 7, 2026
@sourcery-ai
Copy link

sourcery-ai bot commented Jan 7, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Removes the explicit registration of the default HttpClient factory from the Azure Translator DI setup, relying instead on the hosting application's own HttpClient configuration while keeping the AzureTranslator service and options registrations unchanged.

File-Level Changes

Change Details Files
Stop registering HttpClient in Azure Translator service extension and rely on the app's existing HttpClient configuration.
  • Removed the AddHttpClient() call from the AddBootstrapBlazorAzureTranslator extension method.
  • Kept the AzureTranslator service registration as a singleton.
  • Kept options monitoring for AzureTranslatorOption unchanged.
src/components/BootstrapBlazor.AzureTranslator/Extensions/ServiceCollectionExtensions.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#892 Remove the HttpClient service injection from the AzureTranslator component registration (i.e., stop calling services.AddHttpClient() in the AzureTranslator service setup).

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `src/components/BootstrapBlazor.AzureTranslator/Extensions/ServiceCollectionExtensions.cs:23` </location>
<code_context>
     public static IServiceCollection AddBootstrapBlazorAzureTranslator(this IServiceCollection services, Action<
         AzureTranslatorOption>? configOptions = null)
     {
-        services.AddHttpClient();
-
         services.AddSingleton<IAzureTranslatorService, AzureTranslatorService>();
</code_context>

<issue_to_address>
**issue (bug_risk):** Removing AddHttpClient may break existing consumers that relied on this extension to register HttpClient.

This now requires applications to register `AddHttpClient` themselves. If `AzureTranslatorService` (or its dependencies) use `HttpClient`/`IHttpClientFactory`, callers that only invoke `AddBootstrapBlazorAzureTranslator(...)` may see runtime failures. If this is intentional, please document the new requirement and verify all consumers already configure `HttpClient`, or add a clearer guard/failure mode around the dependency.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang ArgoZhang merged commit 8be4fc0 into master Jan 7, 2026
6 checks passed
@ArgoZhang ArgoZhang deleted the dev-transtor branch January 7, 2026 01:02
Copy link

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 removes an unnecessary AddHttpClient() service registration from the AzureTranslator component and bumps the version to 10.0.1. The removal is appropriate since the AzureTranslatorService implementation uses the Azure SDK's TextTranslationClient, which manages its own HTTP communication internally, rather than requiring an injected HttpClient or IHttpClientFactory.

Key changes:

  • Removed unnecessary services.AddHttpClient() call from service registration
  • Bumped package version to 10.0.1

Reviewed changes

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

File Description
ServiceCollectionExtensions.cs Removed unnecessary HttpClient service registration that was not being used by AzureTranslatorService
BootstrapBlazor.AzureTranslator.csproj Added explicit version 10.0.1 to the project properties

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(AzureTranslator): remove HttpClient service inject

2 participants