From 908f3918de24426d5ed91b54cab16dc59ece1fd0 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 7 Nov 2026 23:36:49 +0100 Subject: [PATCH] A test over the gate's waits: no wait reads a description (ADR 0659 clause 6) Claude-Session: https://claude.ai/code/session_01NcbgfFfQ4Z9UE5jK32PmE5 --- .../cmd/mesh-delivery-gate/events_test.go | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/events_test.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/events_test.go index 862f126c2..45a65698c 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/events_test.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/events_test.go @@ -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) + } + } +}