Skip to content

Add isError parameter to CompleteStepAsync method in PublishingActivityProgressReporter #9979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 21, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 21, 2025

The PublishingActivityProgressReporter.CompleteStepAsync method now supports completing steps with error state through a new optional isError parameter. This brings the step completion API in line with the existing task completion functionality.

Changes Made

Interface Updates

// Before
Task CompleteStepAsync(PublishingStep step, string completionText, CancellationToken cancellationToken);

// After  
Task CompleteStepAsync(PublishingStep step, string completionText, bool isError = false, CancellationToken cancellationToken = default);

Key Features

  • Backward Compatible: The isError parameter defaults to false, ensuring all existing code continues to work without modification
  • Consistent API: Follows the same pattern as the existing CompleteTaskAsync method which already supports error states
  • Proper Error Propagation: The error state is correctly passed to PublishingActivityData.IsError and submitted over RPC
  • Comprehensive Testing: Added parameterized tests covering both success and error completion scenarios

Files Modified

  • src/Aspire.Hosting/Publishing/PublishingActivityProgressReporter.cs - Added isError parameter to interface and implementation
  • src/Aspire.Hosting/Publishing/NullPublishingActivityProgressReporter.cs - Updated null implementation to match interface
  • src/Aspire.Hosting/Publishing/ResourceContainerImageBuilder.cs - Updated method call to use named parameter syntax
  • tests/Aspire.Hosting.Tests/Publishing/PublishingActivityProgressReporterTests.cs - Enhanced test coverage with Theory tests

Example Usage

// Complete step successfully (default behavior)
await reporter.CompleteStepAsync(step, "Step completed successfully");

// Complete step with error
await reporter.CompleteStepAsync(step, "Step failed with errors", isError: true);

The implementation maintains full backward compatibility while enabling publishers to properly report step completion status, allowing the publishing activity system to accurately track both successful and failed step completions.

Fixes #9978.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] PublishingActivityProgressReporter should support completing steps with error Add isError parameter to CompleteStepAsync method in PublishingActivityProgressReporter Jun 21, 2025
@Copilot Copilot AI requested a review from captainsafia June 21, 2025 01:36
Copilot finished work on behalf of captainsafia June 21, 2025 01:36
@captainsafia
Copy link
Member

@copilot Update the CompatabilitySuppression.xml file in Aspire.Hosting to account for the new parameter on the CompleteStepAsyc method.

…h new isError parameter

Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jun 21, 2025

@copilot Update the CompatabilitySuppression.xml file in Aspire.Hosting to account for the new parameter on the CompleteStepAsyc method.

Updated the CompatibilitySuppressions.xml file to include the new bool isError parameter in the CompleteStepAsync method signature. Commit 33c75aa

Copilot finished work on behalf of captainsafia June 21, 2025 02:46
@captainsafia captainsafia marked this pull request as ready for review June 21, 2025 04:13
@Copilot Copilot AI review requested due to automatic review settings June 21, 2025 04:13
@captainsafia captainsafia requested a review from mitchdenny as a code owner June 21, 2025 04:13
Copy link
Contributor

@Copilot 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

Adds an optional isError flag to CompleteStepAsync to report error states, updates call sites and tests for the new parameter, and keeps existing behavior backward compatible.

  • Interface and implementations updated with isError = false default
  • Call sites modified to use named cancellationToken argument
  • Tests refactored to a parameterized [Theory] covering both error and non-error flows

Reviewed Changes

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

Show a summary per file
File Description
src/Aspire.Hosting/Publishing/PublishingActivityProgressReporter.cs Added isError parameter and passed it through to activity data
src/Aspire.Hosting/Publishing/NullPublishingActivityProgressReporter.cs Updated null reporter signature to include isError
src/Aspire.Hosting/Publishing/ResourceContainerImageBuilder.cs Changed call to CompleteStepAsync to named cancellationToken
src/Aspire.Hosting/CompatibilitySuppressions.xml Updated suppression target to match new method signature
tests/Aspire.Hosting.Tests/Publishing/PublishingActivityProgressReporterTests.cs Converted test to [Theory] with InlineData for both error cases
Comments suppressed due to low confidence (2)

src/Aspire.Hosting/Publishing/PublishingActivityProgressReporter.cs:143

  • The <returns> tag in the XML documentation is empty; consider adding a descriptive summary for the returned Task, e.g., "A Task that completes when the step has been reported as complete."
    /// <returns></returns>

tests/Aspire.Hosting.Tests/Publishing/PublishingActivityProgressReporterTests.cs:113

  • Add a test case that calls CompleteStepAsync without specifying isError to confirm the default behavior (isError=false) and ensure backward compatibility.
    [InlineData(false, "Step completed successfully", false)]

@captainsafia captainsafia requested a review from davidfowl June 21, 2025 04:14
@captainsafia captainsafia merged commit 53f2056 into main Jun 21, 2025
252 checks passed
@captainsafia captainsafia deleted the copilot/fix-9978 branch June 21, 2025 05:07
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.

PublishingActivityProgressReporter should support completing steps with error
3 participants