Skip to content

Tighten WithOrigin generic constraint for Front Door#16409

Open
eerhardt wants to merge 1 commit intomicrosoft:mainfrom
eerhardt:FixAFDConstraints
Open

Tighten WithOrigin generic constraint for Front Door#16409
eerhardt wants to merge 1 commit intomicrosoft:mainfrom
eerhardt:FixAFDConstraints

Conversation

@eerhardt
Copy link
Copy Markdown
Member

Update WithOrigin to require T : IComputeResource, IResourceWithEndpoints, making the constraint more restrictive. WithOrigin needs to accept an IComputeResource that has endpoints.

Update WithOrigin to require T : IComputeResource, IResourceWithEndpoints, making the constraint more restrictive. WithOrigin needs to accept an IComputeResource that has endpoints.
@github-actions
Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16409

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16409"

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 tightens the generic constraint on AzureFrontDoorExtensions.WithOrigin<T> to ensure origins are compute resources that also expose endpoints, aligning the API contract with Front Door’s requirement to resolve an origin host address from a compute environment.

Changes:

  • Updated WithOrigin<T> to require T : IComputeResource, IResourceWithEndpoints.
  • Adjusted the null-argument unit test to use a type (ProjectResource) that satisfies the new constraint.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/Aspire.Hosting.Azure.Tests/AzureFrontDoorTests.cs Updates the null-argument test to compile with the tightened WithOrigin<T> constraint.
src/Aspire.Hosting.Azure.FrontDoor/AzureFrontDoorExtensions.cs Tightens WithOrigin<T>’s generic constraint to require compute resources with endpoints.

Comment on lines 193 to +195
public static IResourceBuilder<AzureFrontDoorResource> WithOrigin<T>(
this IResourceBuilder<AzureFrontDoorResource> builder,
IResourceBuilder<T> resource) where T : IResourceWithEndpoints
IResourceBuilder<T> resource) where T : IComputeResource, IResourceWithEndpoints
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The new generic constraint requires T to be an IComputeResource as well as IResourceWithEndpoints, but the XML docs above still describe T only as a resource with endpoints. Please update the <typeparam name="T"> documentation to reflect that T must be a compute resource with endpoints (to avoid confusing API consumers).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

@github-actions
Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants