Skip to content

Add IPipelineStep interface and PipelineContext - #280

Merged
JusterZhu merged 1 commit into
masterfrom
feature/pipeline-abstractions-issue-279
May 23, 2026
Merged

Add IPipelineStep interface and PipelineContext#280
JusterZhu merged 1 commit into
masterfrom
feature/pipeline-abstractions-issue-279

Conversation

@JusterZhu

Copy link
Copy Markdown
Collaborator

Summary

Add the core Pipeline abstractions for the Drivelution refactoring.

Changes

  • IPipelineStep: defines a single pipeline step contract with \ShouldExecute\ and \ExecuteAsync\
  • PipelineContext: mutable context carrying \DriverInfo, \Strategy, \Result, and a shared \Bag\ for inter-step data exchange
  • PipelineResult: step execution outcome with \Ok()\ / \Fail()\ factory methods

Why

These abstractions form the foundation for the \BaseDriverUpdater\ pipeline base class (coming in sub-task 2), which will eliminate ~60% code duplication between the Windows and Linux implementations.

Closes #279

…sult

- IPipelineStep: defines contract for pipeline steps with ShouldExecute and ExecuteAsync
- PipelineContext: mutable context carrying DriverInfo, Strategy, Result, and a Bag for inter-step data
- PipelineResult: step execution outcome with Ok/Fail factory methods

Closes #279
Copilot AI review requested due to automatic review settings May 23, 2026 10:12
@JusterZhu
JusterZhu merged commit 50a235a into master May 23, 2026
1 check passed
@JusterZhu
JusterZhu deleted the feature/pipeline-abstractions-issue-279 branch May 23, 2026 10:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds foundational pipeline abstractions in GeneralUpdate.Drivelution to support the upcoming Drivelution refactor (BaseDriverUpdater pipeline), aiming to reduce duplicated update logic across OS-specific implementations.

Changes:

  • Introduces IPipelineStep as the contract for pipeline steps (ShouldExecute + ExecuteAsync).
  • Adds PipelineContext to carry DriverInfo, UpdateStrategy, UpdateResult, plus a shared mutable Bag.
  • Adds PipelineResult to represent per-step outcomes with Ok() / Fail(...) factory methods.

Reviewed changes

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

File Description
src/c#/GeneralUpdate.Drivelution/Core/Pipeline/PipelineResult.cs Adds a step-level result type with success/failure factories.
src/c#/GeneralUpdate.Drivelution/Core/Pipeline/PipelineContext.cs Adds the mutable context object passed through pipeline steps, including a shared bag.
src/c#/GeneralUpdate.Drivelution/Core/Pipeline/IPipelineStep.cs Adds the pipeline step interface (name, conditional execution, async execution).

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

Comment on lines +11 to +38
public bool Success { get; init; }

/// <summary>
/// Error message if the step failed (null when successful).
/// </summary>
public string? ErrorMessage { get; init; }

/// <summary>
/// Optional exception captured during step execution.
/// </summary>
public Exception? Exception { get; init; }

/// <summary>
/// Creates a successful result.
/// </summary>
public static PipelineResult Ok() => new() { Success = true };

/// <summary>
/// Creates a failed result with an error message.
/// </summary>
/// <param name="errorMessage">Description of the failure.</param>
/// <param name="exception">Optional exception that caused the failure.</param>
public static PipelineResult Fail(string errorMessage, Exception? exception = null) => new()
{
Success = false,
ErrorMessage = errorMessage,
Exception = exception
};
Comment on lines +1 to +3
using GeneralUpdate.Drivelution.Abstractions.Models;

namespace GeneralUpdate.Drivelution.Core.Pipeline;
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.

Add IPipelineStep interface and PipelineContext

2 participants