feat(config): add per-command continue-on-error and always policies - #53
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
==========================================
+ Coverage 92.84% 92.97% +0.12%
==========================================
Files 27 27
Lines 1524 1565 +41
==========================================
+ Hits 1415 1455 +40
- Misses 106 107 +1
Partials 3 3
🚀 New features to boost your workflow:
|
quike
force-pushed
the
feat/command-failure-policy
branch
from
September 16, 2026 20:10
c3832c4 to
9b59575
Compare
Owner
Author
|
🎉 This PR is included in version 1.31.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Implements item 2 of #37. Item 3 (the composition decision) is the only part left.
Two independent, composable keys on map-form
commands:entries:continue-on-errortolerates an entry's failure: warn-logged, sequence continues, group still succeeds withexitCode0.alwaysguarantees the entry runs after an earlier failure but does not forgive it — the group still fails with the original error.Why this closes a real gap
Splitting the sequence into separate groups does not work as a substitute: a failed group aborts the flow, so a downstream cleanup group never runs. And because
runGroupreturns the error beforee.outputs.Set, a failed group stores no result, so downstreamwhen:cannot react to it either. Before this change there was no way to guarantee cleanup at all.alwayscovers cancellation, not just failureA hung test that trips
timeout:is exactly when teardown matters, so pendingalwaysentries also run when the context is cancelled — detached viacontext.WithoutCanceland bounded by a 30-second grace period. Their own failures are logged rather than returned, since the cancellation is the real cause.This matters for the name: in GitHub Actions
if: always()runs on cancellation too, so anyone arriving with that mental model would have been surprised by analwaysthat quietly skipped on timeout.Demonstrated on a group with
timeout: 1swhose second command sleeps for 10:The error text is also more specific now — first-error-wins names the failing command rather than reporting a bare deadline.
Semantics
alwaysfailure and a subsequent cancellation, so the diagnostic keeps pointing at the real cause.continue-on-errorfailure is not recorded inExitCode/Status— a group reported as successful must not carry a non-zero exit code.on-error:; per-entry is strictly more expressive and a group default can be layered on later.alwaysentry are skipped, not run.Cache
Both keys fold into the fingerprint — unlike
silent, they change whether the group succeeds, so a cached "ok" produced undercontinue-on-errormust not be replayed after the flag is removed. Distinct markers keep the two from aliasing. Emitted only when set, so configs not using them keep their fingerprints.Two things found while implementing
Status: "".RunResult's doc reserves the empty status for groups that never ran, so a group whose only entry was tolerated would have published a meaningless status. Fixed by foldingStatusOKwithout disturbing an earlier non-ok status.RunResult.ExitCode's doc was stale. It said the field was "laid down for a future soft-fail / continue-on-error feature". That feature is this one, and with fully-tolerated semantics the field still stays 0 in stored results — corrected rather than left pointing at work that no longer implies it.Verification
gofmt,go vet,golangci-lint, andgo test -race ./...all clean.Unit tests cover each policy and their interactions: teardown after failure, tolerated failure continuing, both keys combined, an
alwaysentry failing after a prior failure, a real failure after a tolerated one, entries being skipped, and all three cancellation paths. Thetest-resources/config-commands-valid.ymlfixture gained apolicygroup, which the existing end-to-end test executes for real.Both scenarios were also driven through the built binary rather than only through tests — the failure path returns exit 1 with the original error after running teardown, and the timeout path now does the same.
Remaining limitation
retries:replays the whole sequence, so analwaysteardown runs once per attempt. Pre-existing behaviour, documented indocs/CONFIG.md; keep teardowns idempotent.