Skip to content

Fix some references to LifecycleHooks that were actually Event Subscr…#15053

Open
afscrome wants to merge 1 commit intomicrosoft:mainfrom
afscrome:fix-event-handler-names
Open

Fix some references to LifecycleHooks that were actually Event Subscr…#15053
afscrome wants to merge 1 commit intomicrosoft:mainfrom
afscrome:fix-event-handler-names

Conversation

@afscrome
Copy link
Contributor

@afscrome afscrome commented Mar 8, 2026

Description

I noticed a few event subscribers still referred to LifecycleHook in their class / method names. Renamed those it was safe to do. (Tests / internal classes)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • No
  • Did you add public API?
    • No
  • Does the change make any security assumptions or guarantees?
    • No
  • Does the change require an update in our Aspire docs?
    • No

@afscrome afscrome requested a review from mitchdenny as a code owner March 8, 2026 17:27
Copilot AI review requested due to automatic review settings March 8, 2026 17:27
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

🚀 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 -- 15053

Or

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

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 8, 2026
Copy link
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

Aligns internal eventing subscriber naming in Aspire.Hosting (and associated tests) by replacing outdated *LifecycleHook* identifiers with *EventingSubscriber* / EventHandlers terminology, matching the current eventing model.

Changes:

  • Renamed internal required-command validation subscriber and updated DI registration + test assertions.
  • Renamed devcontainer port-forwarding subscriber and updated DI registration + test assertions.
  • Renamed dashboard test class to match DashboardEventHandlers.

Reviewed changes

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

Show a summary per file
File Description
tests/Aspire.Hosting.Tests/RequiredCommandAnnotationTests.cs Updates test names/assertions and doc comment to refer to RequiredCommandValidationEventingSubscriber.
tests/Aspire.Hosting.Tests/DistributedApplicationBuilderTests.cs Updates default-service assertions to the renamed subscriber types.
tests/Aspire.Hosting.Tests/Dashboard/DashboardEventHandlersTests.cs Renames the test class from DashboardLifecycleHookTests to DashboardEventHandlersTests.
src/Aspire.Hosting/Lifecycle/RequiredCommandValidationEventingSubscriber.cs Renames the internal subscriber type to RequiredCommandValidationEventingSubscriber.
src/Aspire.Hosting/DistributedApplicationBuilder.cs Updates eventing subscriber registrations to the renamed types.
src/Aspire.Hosting/Devcontainers/DevcontainerPortForwardingEventingSubscriber.cs Renames the devcontainer eventing subscriber type and constructor.
Comments suppressed due to low confidence (1)

tests/Aspire.Hosting.Tests/Dashboard/DashboardEventHandlersTests.cs:25

  • This test file now uses DashboardEventHandlersTests, but helper/variable names still use the older "hook" terminology (e.g., CreateHook, hook). Consider renaming those to match DashboardEventHandlers to keep naming consistent within the test suite.

Comment on lines 438 to 442
/// <summary>
/// Helper method to subscribe all eventing subscribers (including RequiredCommandValidationLifecycleHook)
/// Helper method to subscribe all eventing subscribers (including RequiredCommandValidationEventingSubscriber)
/// to the eventing system. This simulates what happens during app.StartAsync().
/// </summary>
private static async Task SubscribeHooksAsync(DistributedApplication app)
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

The XML doc comment now describes subscribing eventing subscribers, but the helper is still named SubscribeHooksAsync. Renaming the method (and its call sites) to something like SubscribeEventingSubscribersAsync would keep terminology consistent and avoid confusion with lifecycle hooks.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants