From 579cd33cd540d2dccdeeb5aa2b78d38327cd4111 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 11 Nov 2026 14:55:49 +0100 Subject: [PATCH] GATE2: the whole-module test counts the merges handed in the state merges, the merge as an owed act being left out of the join MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: design 47 G §160, tests 34, 39 (eb131beb left out, G §167, §542) Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ --- .../cmd/mesh-delivery-gate/bus_test.go | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/bus_test.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/bus_test.go index bcbf1772a..13b2afa6b 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/bus_test.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/bus_test.go @@ -16,6 +16,7 @@ import ( "os" "os/exec" "reflect" + "strconv" "strings" "sync" "testing" @@ -697,7 +698,7 @@ func TestAPassingVerdictAsksTheApproveAndItsApproveMergesWithinSecondsOverARealB var d Delivery return err == nil && json.Unmarshal(e.Value(), &d) == nil && d.State == Merged }) - if n := len(rt2.mergesSaid()); n != 0 || len(onlyAskKeys(b)) > 1 { + if n := len(rt2.mergesSaid()); n != merges || len(onlyAskKeys(b)) > 1 { t.Fatalf("the restarted gate said the merge %d more times (%d before), or asked again: %v", n, merges, onlyAskKeys(b)) } // Quiet follows: nothing asks the forge or the controller again with no event to say so. @@ -908,3 +909,25 @@ func mustDecode[T any](t *testing.T, raw []byte) T { // (issue 1404). A failed first ask is asked again only after askAgainAfter (30 s, react.go), and 20 s deliberately does not // cover that: a failed first ask still fails the test. const eventWithin = 20 * time.Second + +// mergesSaid are the writes of the gate's state merges, the merges it handed to the forge bridge, in order (the old form of +// the merge: eb131beb, the merge as an owed act, is left out of the join). +func (r *runtime) mergesSaid() []string { + ctx := context.Background() + kv := r.b.kvs["merges"] + keys, err := kv.Keys(ctx) + if err != nil { + return nil + } + var out []string + for _, k := range keys { + hist, err := kv.History(ctx, k) + if err != nil { + continue + } + for _, e := range hist { + out = append(out, k+"@"+strconv.FormatUint(e.Revision(), 10)) + } + } + return out +}