Skip to content

feat(pipeline): add optional step support for non-blocking failures#124

Draft
nextlevelshit wants to merge 1 commit intomainfrom
118-optional-pipeline-steps
Draft

feat(pipeline): add optional step support for non-blocking failures#124
nextlevelshit wants to merge 1 commit intomainfrom
118-optional-pipeline-steps

Conversation

@nextlevelshit
Copy link
Collaborator

Summary

  • Add optional: true field on pipeline step definitions allowing steps to fail without halting the pipeline
  • Introduce StateFailedOptional state across pipeline executor, event emitter, display layer, and state store
  • Gracefully skip dependent steps when their optional dependency fails, while independent steps continue
  • Support optional step handling in both Execute and ResumeFromStep code paths
  • Display optional failures with distinct warning styling (⚠ icon, yellow color) in the TUI

Spec

See specs/118-optional-pipeline-steps/spec.md for the full feature specification including user stories, functional requirements, success criteria, and edge cases.

Test plan

  • Unit tests: 7 new tests covering optional step behavior:
    • TestOptionalStepFailureContinuesPipeline — optional step fails, pipeline continues
    • TestOptionalStepDependencySkipping — dependent steps skipped when optional dep fails
    • TestNonOptionalStepFailureHaltsPipeline — backward compatibility: non-optional still halts
    • TestOptionalStepDefaultsFalseOptional defaults to false
    • TestPipelineCompletionWithOptionalFailures — completion message includes optional failure count
    • TestStateFailedOptionalConstant — state constant verification
    • TestShouldSkipDueToOptionalDep — table-driven tests for dependency skip logic
  • YAML parsing tests: Verify optional: true/false/absent parses correctly
  • Race detector: Full suite passes with go test -race ./...
  • All existing tests continue to pass (backward compatible)

Known limitations

  • Resume does not reconstruct failedOptionalSteps map from prior run state (steps re-execute on resume)
  • No manifest-level validation that optional is only used on leaf or non-critical steps (left to user)

Closes #118

Add `optional: true` field on pipeline step definitions that allows
steps to fail without halting the entire pipeline. When an optional
step fails, dependent steps are gracefully skipped while independent
steps continue executing.

Key changes:
- Add Optional bool field to Step type with YAML support
- Introduce StateFailedOptional state across pipeline, event, display,
  and state store layers
- Handle optional failure in both Execute and ResumeFromStep paths
- Skip dependent steps when their optional dependency fails
- Display optional failures with warning styling (⚠ icon, yellow)
- Include optional failure counts in pipeline completion messages
- Comprehensive test coverage for all optional step scenarios

Closes #118
@nextlevelshit nextlevelshit marked this pull request as draft March 1, 2026 00:50
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.

feat: add possibility to mark pipeline steps as optional

1 participant