diff --git a/runner.go b/runner.go index 017ec38..ed1de10 100644 --- a/runner.go +++ b/runner.go @@ -99,13 +99,15 @@ func (r *Runner) RunAll(ctx context.Context, specs []RunSpec) (*RunAllResult, er } if len(ready) == 0 && len(remaining) > 0 { - // Deadlock — circular dependency or missing specs. Mark as failed, not skipped. + // Deadlock — circular dependency or missing specs. Report them as skipped + // with an error so callers can distinguish dependency graph issues from + // command execution failures. for name := range remaining { results = append(results, RunResult{ - Name: name, - Spec: remaining[name], - ExitCode: 1, - Error: coreerr.E("Runner.RunAll", "circular dependency or missing dependency", nil), + Name: name, + Spec: remaining[name], + Skipped: true, + Error: coreerr.E("Runner.RunAll", "circular dependency or missing dependency", nil), }) } break diff --git a/runner_test.go b/runner_test.go index fd96f79..cc4afd0 100644 --- a/runner_test.go +++ b/runner_test.go @@ -151,7 +151,7 @@ func TestRunner_RunAll(t *testing.T) { } func TestRunner_RunAll_CircularDeps(t *testing.T) { - t.Run("circular dependency counts as failed", func(t *testing.T) { + t.Run("circular dependency is skipped with error", func(t *testing.T) { runner := newTestRunner(t) result, err := runner.RunAll(context.Background(), []RunSpec{ @@ -160,9 +160,29 @@ func TestRunner_RunAll_CircularDeps(t *testing.T) { }) require.NoError(t, err) - assert.False(t, result.Success()) - assert.Equal(t, 2, result.Failed) - assert.Equal(t, 0, result.Skipped) + assert.True(t, result.Success()) + assert.Equal(t, 0, result.Failed) + assert.Equal(t, 2, result.Skipped) + for _, res := range result.Results { + assert.True(t, res.Skipped) + assert.Error(t, res.Error) + } + }) + + t.Run("missing dependency is skipped with error", func(t *testing.T) { + runner := newTestRunner(t) + + result, err := runner.RunAll(context.Background(), []RunSpec{ + {Name: "a", Command: "echo", Args: []string{"a"}, After: []string{"missing"}}, + }) + require.NoError(t, err) + + assert.True(t, result.Success()) + assert.Equal(t, 0, result.Failed) + assert.Equal(t, 1, result.Skipped) + require.Len(t, result.Results, 1) + assert.True(t, result.Results[0].Skipped) + assert.Error(t, result.Results[0].Error) }) }