diff --git a/modules/mesh-delivery-sdk/steprun/pull.go b/modules/mesh-delivery-sdk/steprun/pull.go index 8da13c6f..88d2cd87 100644 --- a/modules/mesh-delivery-sdk/steprun/pull.go +++ b/modules/mesh-delivery-sdk/steprun/pull.go @@ -816,8 +816,8 @@ func (p *Puller) run(ctx context.Context, msg *Pulled, ask sdkstep.StepAsk, key } else { p.sayEnded(msg, ask, sdkstep.OutcomePassed, "", result, written.OutputObject) } - p.logf("the %s ask %s ended on %s after %s, in its phase %q; %s", ask.Kind, ask.ID, p.Node, - now().Sub(step.Started).Round(time.Second), step.Phase, outcome) + p.logf("the %s ask %s ended on %s after %s, in its phase %q; %s%s", ask.Kind, ask.ID, p.Node, + now().Sub(step.Started).Round(time.Second), step.Phase, outcome, stepOutcomeWords(result)) if aerr := msg.Ack(); aerr != nil { p.logf("the ask %s ended on %s and its acknowledgement failed: %v", ask.ID, p.Node, aerr) } @@ -1055,3 +1055,28 @@ func runAnswerOf(ask sdkstep.StepAsk, result any) (sdkstep.RunAnswer, bool) { } return runAnswerIn(result) } + +// stepOutcomeWords is a pipeline step's own outcome, as its step-ended says it, for the line that says the ask ended: the ask +// passing only says its end was said, which a step that could not run or had nothing to run also does (lead-47, 2026-11-15: +// steps "passed" in 0 s and nobody could read what they did). Empty for an ask that is no pipeline step. +func stepOutcomeWords(result any) string { + a, ok := result.(StepAnswer) + if !ok { + return "" + } + words := "; the step's outcome: " + a.Ended.Outcome + if a.Ended.Said != "" { + said := a.Ended.Said + if len(said) > 300 { + said = said[:300] + "..." + } + words += " (" + said + ")" + } + if t := a.Ended.Tests; t != nil { + words += fmt.Sprintf(", %d unit and %d integration tests", t.Unit, t.Integration) + } + if len(a.Ended.Carried) > 0 { + words += fmt.Sprintf(", %d carried from an earlier run", len(a.Ended.Carried)) + } + return words +} diff --git a/modules/mesh-delivery-sdk/steprun/pull_test.go b/modules/mesh-delivery-sdk/steprun/pull_test.go index 94e72343..5fc90720 100644 --- a/modules/mesh-delivery-sdk/steprun/pull_test.go +++ b/modules/mesh-delivery-sdk/steprun/pull_test.go @@ -627,3 +627,18 @@ func TestPullAnswersAnAskItCannotRead(t *testing.T) { t.Fatalf("the unread ask's step = %+v (%v)", s, ok) } } + +// A pipeline step's own outcome is said beside the ask's end, so a step that had nothing to run never reads as a plain pass. +func TestTheStepsOwnOutcomeIsSaid(t *testing.T) { + got := stepOutcomeWords(StepAnswer{Ended: sdkstep.StepEnded{Outcome: sdkstep.OutcomeNothingToRun}}) + if !strings.Contains(got, sdkstep.OutcomeNothingToRun) { + t.Errorf("words = %q", got) + } + got = stepOutcomeWords(StepAnswer{Ended: sdkstep.StepEnded{Outcome: sdkstep.OutcomePassed, Tests: &sdkstep.TestCounts{Unit: 12}}}) + if !strings.Contains(got, "12 unit") { + t.Errorf("words = %q", got) + } + if stepOutcomeWords(map[string]string{"ran": "x"}) != "" { + t.Error("an ask that is no step named an outcome") + } +}