From c8e1e2b2fa317198deed7ff7a8667768046670f8 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 26 Oct 2026 11:41:42 +0100 Subject: [PATCH] =?UTF-8?q?gate:=20a=20merge=20held=20past=2030=20minutes?= =?UTF-8?q?=20by=20another=20delivery's=20check=20is=20a=20stalled=20line?= =?UTF-8?q?=20naming=20that=20check=20and=20since=20when,=20said=20as=20de?= =?UTF-8?q?livery..stalled=20(ADR=200548=20=C2=A74;=20issue=20568=20G3?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cmd/mesh-delivery-gate/adr548_test.go | 19 +++++++++++++++++++ .../cmd/mesh-delivery-gate/conditions.go | 3 +++ .../cmd/mesh-delivery-gate/verbs.go | 1 + 3 files changed, 23 insertions(+) diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/adr548_test.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/adr548_test.go index f9d28bcf..05a44104 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/adr548_test.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/adr548_test.go @@ -5,6 +5,7 @@ import ( "strings" "sync" "testing" + "time" sdk "git.novox.be/novox/mesh-sdk/go/delivery" ) @@ -85,6 +86,24 @@ func TestOneCheckPerDeliveryAtTheGate(t *testing.T) { d.Ready.HeldSince == nil { t.Fatalf("the merge does not say what it waits for: %+v", d.Ready) } + // §4: past 30 minutes the held merge is a stalled line naming the check it waits for and since when. + for _, l := range w.h.Stalled() { + if l.ID == id { + t.Fatalf("a stalled line within the bound: %+v", l) + } + } + w.later(turnBound + time.Minute) + w.settleAll() + var line *StalledLine + for _, l := range w.h.Stalled() { + if l.ID == id { + line = &l + } + } + if line == nil || line.Bound != "30m0s" || !strings.Contains(line.Says, "waits for the check of g") || !strings.Contains(line.Says, "held since") || + !strings.Contains(line.Says, "checker_status") || !strings.Contains(line.H2, "delivery_hand_now") { + t.Fatalf("the stalled line of the held merge = %+v", line) + } putCheckerVerdict(w, "pass", headOf(oneRepo, 9, otherHead)) w.settleAll() if len(w.forge.merges) != 1 || w.op.count() != 1 { diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/conditions.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/conditions.go index bbce1e24..d25132d9 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/conditions.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/conditions.go @@ -224,6 +224,9 @@ func (h *Holder) nextStall(now time.Time) time.Time { consider(r.RefusedSince.Add(h.answeredRefusalBound(d.Repository))) consider(r.RefusedSince.Add(outOfDateFor)) } + if r.HeldSince != nil { + consider(r.HeldSince.Add(turnBound)) + } } return next } diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/verbs.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/verbs.go index 627ae019..7d6caf09 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/verbs.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/verbs.go @@ -218,6 +218,7 @@ func (h *Holder) Stalled() []StalledLine { } out = append(out, h.withChecks(h.uncheckedLines(now))...) out = append(out, h.readyLines(now)...) + out = append(out, h.turnLines(now)...) // an approved merge held past its bound by another delivery's check (ADR 0548 §4) out = append(out, h.groupLines(now)...) sort.Slice(out, func(i, j int) bool { return out[i].ID < out[j].ID }) return out