diff --git a/cmd/mesh-controller/plain_words.go b/cmd/mesh-controller/plain_words.go index 61cab51d..0599d6f2 100644 --- a/cmd/mesh-controller/plain_words.go +++ b/cmd/mesh-controller/plain_words.go @@ -748,6 +748,22 @@ func stalledWords(l stalledLine, o conditions.Observation) (headline, explanatio actions []conditions.Action) { repository, _, _ := strings.Cut(l.ID, "@") name := repoName(repository) + if l.State == "unannounced" { + // A pull request the forge never announced (novox/hq issue 347): no delivery exists, so there is nothing to + // stop, release or close; a new commit on its branch is announced and checked. + long := "for too long" + if d, err := time.ParseDuration(l.For); err == nil { + long = "for " + humanDuration(d) + } + if o.Resolver == conditions.ResolverOperator { + needs = "push a new commit to its branch; the forge announces it and the mesh checks it." + } + return fmt.Sprintf("A pull request of %s has had no merge check %s", name, long), + fmt.Sprintf("A pull request of %s has been open %s on a branch that requires the merge check, and the "+ + "mesh was never asked to check it: the forge never announced it. It cannot merge until it is checked.", + name, long), + fmt.Sprintf("The pull request of %s has a merge check now, or is closed", name), needs, nil + } held := l.State if held == "" { held = "held" diff --git a/cmd/mesh-controller/plain_words_test.go b/cmd/mesh-controller/plain_words_test.go index c0626897..41665ee2 100644 --- a/cmd/mesh-controller/plain_words_test.go +++ b/cmd/mesh-controller/plain_words_test.go @@ -309,3 +309,23 @@ func TestANeedNoNotificationAnswersNamesTheMeshMCPServer(t *testing.T) { } check("updates held", releaseHeldWords([]string{"openrazer"}, []string{"g14"})) } + +// **A pull request the forge never announced says what to do about it** (novox/hq issue 347): mesh-delivery says one +// as a stalled line in state `unannounced` — no delivery exists, so there is nothing to stop, release or close — +// and the operator's one act is a new commit on its branch, which the forge announces. +func TestAnUnannouncedPullRequestSaysToPushANewCommit(t *testing.T) { + l := stalledLine{ID: "novox/hq@bfe82315f42c", State: "unannounced", For: "11m0s", Bound: "10m0s", + H2: "none: the forge never announced it, so there is no delivery to close — the operator's", + Says: "novox/hq#243 is open on main, which requires the merge check, and its head has had no merge check"} + obs := stalledObservations([]stalledLine{l}) + if len(obs) != 1 || obs[0].Resolver != conditions.ResolverOperator { + t.Fatalf("an unannounced pull request is not the operator's: %+v", obs) + } + o := obs[0] + if strings.Contains(o.Needs, "stop") || strings.Contains(o.Needs, "release") || !strings.Contains(o.Needs, "commit") { + t.Fatalf("it says to %q", o.Needs) + } + if !strings.Contains(o.Headline, "no merge check") || !strings.Contains(o.Explanation, "never") { + t.Fatalf("it reads %q / %q", o.Headline, o.Explanation) + } +}