< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.Workflows.Sequential.StageExecutionResult
Assembly: NexusLabs.Needlr.AgentFramework.Workflows
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Workflows/Sequential/StageExecutionResult.cs
Line coverage
90%
Covered lines: 10
Uncovered lines: 1
Coverable lines: 11
Total lines: 68
Line coverage: 90.9%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_StageName()100%11100%
get_Diagnostics()100%11100%
get_ResponseText()100%11100%
get_Succeeded()100%11100%
get_Exception()100%11100%
get_FailureDisposition()100%11100%
Success(...)100%11100%
Failed(...)100%11100%
Skipped(...)100%210%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Workflows/Sequential/StageExecutionResult.cs

#LineLine coverage
 1using NexusLabs.Needlr.AgentFramework.Diagnostics;
 2
 3namespace NexusLabs.Needlr.AgentFramework.Workflows.Sequential;
 4
 5/// <summary>
 6/// Describes the outcome of executing a single pipeline stage, including
 7/// diagnostics, response text, and success/failure state.
 8/// </summary>
 9/// <param name="StageName">The name of the stage that was executed.</param>
 10/// <param name="Diagnostics">Captured diagnostics for the stage, or <see langword="null"/> if not available.</param>
 11/// <param name="ResponseText">The text response produced by the stage, or <see langword="null"/> for non-agent stages.<
 12/// <param name="Succeeded">Whether the stage completed successfully.</param>
 13/// <param name="Exception">The exception that caused failure, or <see langword="null"/> on success.</param>
 14/// <param name="FailureDisposition">Controls how the pipeline runner handles a failed result.
 15/// Only meaningful when <paramref name="Succeeded"/> is <see langword="false"/>.</param>
 16/// <example>
 17/// <code>
 18/// var result = StageExecutionResult.Success("Writer", diagnostics, "Draft text");
 19/// if (result.Succeeded)
 20///     Console.WriteLine($"Stage '{result.StageName}' produced: {result.ResponseText}");
 21/// </code>
 22/// </example>
 16823public sealed record StageExecutionResult(
 1024    string StageName,
 17425    IAgentRunDiagnostics? Diagnostics,
 9426    string? ResponseText,
 13027    bool Succeeded,
 2628    Exception? Exception = null,
 18929    FailureDisposition FailureDisposition = FailureDisposition.AbortPipeline)
 30{
 31    /// <summary>
 32    /// Creates a successful result for a stage.
 33    /// </summary>
 34    /// <param name="stageName">The name of the completed stage.</param>
 35    /// <param name="diagnostics">Captured diagnostics, or <see langword="null"/>.</param>
 36    /// <param name="responseText">The text response, or <see langword="null"/>.</param>
 37    /// <returns>A successful <see cref="StageExecutionResult"/>.</returns>
 38    public static StageExecutionResult Success(
 39        string stageName,
 40        IAgentRunDiagnostics? diagnostics,
 41        string? responseText) =>
 12642        new(stageName, diagnostics, responseText, Succeeded: true);
 43
 44    /// <summary>
 45    /// Creates a failed result for a stage.
 46    /// </summary>
 47    /// <param name="stageName">The name of the failed stage.</param>
 48    /// <param name="exception">The exception that caused the failure.</param>
 49    /// <param name="diagnostics">Captured diagnostics, or <see langword="null"/>.</param>
 50    /// <param name="disposition">How the pipeline runner should handle this failure.
 51    /// Defaults to <see cref="FailureDisposition.AbortPipeline"/>.</param>
 52    /// <returns>A failed <see cref="StageExecutionResult"/>.</returns>
 53    public static StageExecutionResult Failed(
 54        string stageName,
 55        Exception exception,
 56        IAgentRunDiagnostics? diagnostics = null,
 57        FailureDisposition disposition = FailureDisposition.AbortPipeline) =>
 4258        new(stageName, diagnostics, ResponseText: null, Succeeded: false,
 4259            Exception: exception, FailureDisposition: disposition);
 60
 61    /// <summary>
 62    /// Creates a result indicating the stage was skipped.
 63    /// </summary>
 64    /// <param name="stageName">The name of the skipped stage.</param>
 65    /// <returns>A successful <see cref="StageExecutionResult"/> with no diagnostics or response.</returns>
 66    public static StageExecutionResult Skipped(string stageName) =>
 067        new(stageName, Diagnostics: null, ResponseText: null, Succeeded: true);
 68}