A test over the gate's waits: no wait reads a description (ADR 0659 clause 6)
mesh/delivery merged: source.main moved to novox/mesh-catalog@0cd706b044ae

Claude-Session: https://claude.ai/code/session_01NcbgfFfQ4Z9UE5jK32PmE5
This commit is contained in:
2026-11-07 23:36:49 +01:00
parent 8b84ac7487
commit 908f3918de
@@ -168,3 +168,41 @@ func TestAPushAfterTheAskEndsItAndSaysSoOnceOnThePullRequest(t *testing.T) {
t.Fatalf("said more than once: %v", w.forge.comments)
}
}
// ADR 0659 clause 6: no wait of ready.go reads a description field. A delivery and a group whose descriptions differ only
// (no line, a Reviewed-by line naming the head, another head, garbage, an after: and a Pushed-by line) answer the same
// readyWaits, ungatedWaits and group state.
func TestNoWaitReadsADescription(t *testing.T) {
heads := map[string]string{"novox/a": "a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", "novox/b": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2"}
bodies := []string{"", "Fixes issue 7.", "Reviewed-by: lead@shanks at %s", "Reviewed-by: lead@shanks at " + pushed,
"\x00garbage: Reviewed-by pending\nafter: novox/zzz\nPushed-by: x@y"}
var first []string
for i, body := range bodies {
w := newWorld(t)
w.op.auto = false
for n, repo := range []string{"novox/a", "novox/b"} {
p := pr(repo, n+1, heads[repo], "feat/y", "x")
p.Body = strings.ReplaceAll(body, "%s", heads[repo])
w.h.PullUpdated(p)
w.h.Checked(verdict(repo, n+1, heads[repo], "pass"))
}
w.h.Checked(CheckedEvent{Group: "feat/y", ID: "check-1", Verdict: "pass", Summary: "compose"})
w.settleAll()
g := w.h.groups["feat/y"]
state, why := GroupState(g, w.h.membersOf(g))
ds := []*Delivery{w.delivery(IDOf("novox/a", heads["novox/a"])), w.delivery(IDOf("novox/b", heads["novox/b"]))}
w.h.mu.Lock()
got := []string{state, why}
for _, d := range ds {
got = append(got, w.h.readyWaits(d), w.h.ungatedWaits(d))
}
w.h.mu.Unlock()
if i == 0 {
first = got
continue
}
if strings.Join(got, "|") != strings.Join(first, "|") {
t.Fatalf("description %q changes the waits:\n got %q\nwant %q", body, got, first)
}
}
}