feat: halt pipeline step progression on error by default - #106
Merged
Conversation
When a step (including a composed command whose inner Build catches the
exception) fails, the pipeline now stops instead of running subsequent
steps on default data. The outermost boundary still returns a result and
does not throw (Roslyn-style result+diagnostics); the failure surfaces via
context.IsError / Exception.
Reuses the existing cancellation short-circuit: Build()/BuildAsProcedure()
call context.CancelAfter() on a caught exception when the new HaltOnError
policy is enabled. No binder changes.
New PipelineOptions { HaltOnError = true } is configured via an
Action<PipelineOptions> delegate on AddPipeline(...). Existing users
restore the prior run-through behavior with one wire-up option:
services.AddPipeline( o => o.HaltOnError = false ).
Adds IPipelineContext.HaltOnError (peer of Throws), propagated through the
clone constructor so WaitAll forks inherit it. CreateFactory gains an
optional trailing PipelineOptions (positional callers unchanged).
Implements ADR-0001; supersedes the pipeline-error.md draft.
- 18 halt-on-error tests; 255 total green across all 6 projects (net10.0)
- dotnet build -warnaserror clean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pipelines now halt step progression on error by default. When any step — including a composed command whose inner
Build()catches the exception — fails, the pipeline stops instead of feedingdefaultdata into subsequent steps (a downstream consumer failure mode).The outermost boundary is unchanged: it still returns a result and does not throw (Roslyn
EmitResult+Diagnosticsmodel). The failure surfaces viacontext.IsError/context.Exception.Implements ADR-0001 (
docs/decisions/0001-pipelines-halt-on-error-by-default.md) and supersedes the rejectedpipeline-error.mddraft (whose premise —ExecuteAsyncisolated-context swallowing — was false for this codebase; composition uses shared-contextcommand.PipelineFunction).Approach (Strategy B — minimal)
Build()/BuildAsProcedure()catch blocks callcontext.CancelAfter()on a caught exception when the newHaltOnErrorpolicy is enabled, reusing the existing cancellation short-circuit inBinder.ProcessPipelineAsync. Zero binder changes.Backward compatibility
New behavior is the default. Existing users restore the prior run-through behavior with one wire-up option, no code changes:
Changes
PipelineOptions { HaltOnError = true }; bothAddPipelineoverloads acceptAction<PipelineOptions> configure = nullIPipelineContext.HaltOnError(peer ofThrows), propagated through the clone constructor soWaitAllforks inherit itPipelineContextFactorycarries/stamps the option;CreateFactorygains an optional trailingPipelineOptions(positional callers unchanged)command-pattern.md(boundary-model section + corrected composition note),dependency-injection.md(Pipeline Options)Verification
ForEach,WaitAllfork isolation + reducer propagation, value-type defaults,Throwsrethrow, and the programmatic-vs-thrown trigger boundarydotnet build -warnaserrorcleanNotes / API surface
IPipelineContextgainingHaltOnErroris a breaking change for external customIPipelineContextimplementers (none in-repo) — flag in release notesIsCanceled == true(halt reuses cancel-after);IsErrordistinguishes the two — consistent with how validation failures already behaveCHANGELOGfile in repo (nbgv / GitHub Releases); release note deferred to the release process