Files
mesh-controller/cmd/mesh-controller/new_head_words_test.go
T
jschoubben b7d03b6897
mesh/repo-check head b7d03b68974d merged into trunk 8f2d22db0caa beside mesh-catalog#444@09e749bc — pass: its merge-check.sh passed
mesh/merge-gate head b7d03b68974d merged into trunk 8f2d22db0caa — pass: group feat/quiet-deliveries composed: every machine composes with the change as it…
mesh/delivery delivered
mesh/delivery-group group feat/quiet-deliveries delivered: every member is delivered
mesh/check checking b7d03b68974d on 8f2d22db0caa
Word a delivery that needs its author's new head as its author's, with no Stop (ADR 0505 §5)
2026-10-22 14:25:26 +02:00

41 lines
2.0 KiB
Go

package main
import (
"strings"
"testing"
"github.com/novox/mesh-controller/internal/conditions"
)
// novox/hq ADR 0505 §5: a delivery whose cure is its author's new head reaches the operator in words that name its
// author and say a new head is needed, offer no Stop and never call it the operator's; the line as mesh-delivery-gate
// says it (ready.go readyLines: needs "new-head", author, branch).
func TestADeliveryThatNeedsANewHeadNamesItsAuthorAndOffersNoStop(t *testing.T) {
l := stalledLine{ID: "novox/mesh-controller@499ff5c21861", Number: 432, State: "rejected", For: "2h1m0s", Bound: "2h0m0s",
H2: "none: a new head from its author, or a recheck that passes", Needs: needsNewHead,
Author: "the author of feat/quiet-deliveries (quiet-deliveries on shanks)", Branch: "feat/quiet-deliveries",
Says: "novox/mesh-controller#432 passed its checks at 499ff5c21861 and is not merged: a conflict"}
o := stalledObservations([]stalledLine{l})[0]
for _, words := range []string{o.Headline, o.Explanation, o.Resolved, o.Needs} {
if why, ok := conditions.Plain(words); !ok {
t.Errorf("%q is not plain: %s", words, why)
}
for _, never := range []string{"stop it", "operator's"} {
if strings.Contains(words, never) {
t.Errorf("%q says %q", words, never)
}
}
}
if o.Headline != "Pull request 432 of mesh-controller needs a new head from its author" ||
!strings.Contains(o.Explanation, "until the author of feat/quiet-deliveries (quiet-deliveries on shanks) pushes a new head") ||
!strings.Contains(o.Explanation, "for 2 hours") || len(o.Actions) != 0 ||
o.Needs != "ask the author of feat/quiet-deliveries (quiet-deliveries on shanks) for a new head." {
t.Fatalf("words: %q / %q / %q / %v", o.Headline, o.Explanation, o.Needs, o.Actions)
}
// A branch in code is not said; the author is then "its author".
l.Author = "the author of fix/a1b2c3d4e5f6"
if o := stalledObservations([]stalledLine{l})[0]; !strings.Contains(o.Needs, "ask its author") {
t.Fatalf("a dotted branch was said: %q", o.Needs)
}
}