From 9aaa5c80ac5c4820c4eddf488fbb90ac6981a624 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 21 Oct 2026 19:35:14 +0200 Subject: [PATCH] Accept the gate's recheck status mesh/repo-check among the owed contexts, so a pinned recheck is not refused (issue 1673) --- go/delivery/checker_test.go | 26 ++++++++++++++++++++++++++ go/delivery/gate.go | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/go/delivery/checker_test.go b/go/delivery/checker_test.go index eb79299..6b2f438 100644 --- a/go/delivery/checker_test.go +++ b/go/delivery/checker_test.go @@ -516,3 +516,29 @@ func TestCheckerOwedIsReadableByTheGatesReaderAndAnOldOwedReaderIgnoresNewFields t.Errorf("a preview with a field of tomorrow: %v", err) } } + +// 1673/AC2 (review): the gate's recheck owes a pending status=mesh/repo-check (mesh-catalog mesh-delivery-gate owed.go, +// checks.go ctxRepo); its key and value round trip, and the checker's bucket still refuses it. +func TestTheGatesRecheckStatusRoundTripsAndTheCheckersBucketRefusesIt(t *testing.T) { + key, err := OwedKey("novox/mesh-sdk", 36, "aaaa", "status=mesh/repo-check") + if err != nil || key != "novox/mesh-sdk.36.aaaa.status=mesh/repo-check" { + t.Fatalf("key = %q, %v", key, err) + } + if _, _, _, act, err := ParseOwedKey(key); err != nil || act != "status=mesh/repo-check" { + t.Errorf("parse = %q, %v", act, err) + } + o := Owed{Act: OwedStatus, Context: StatusContextRepoCheck, State: "pending", Target: "https://mesh.example/delivery/36", Text: "checking again"} + data, err := EncodeOwed(o) + if err != nil { + t.Fatal(err) + } + if got, err := DecodeOwed(data); err != nil || !SameOwed(got, o) && got.Context != o.Context { + t.Errorf("round trip = %+v, %v", got, err) + } + if _, err := EncodeCheckerOwed(o); err == nil { + t.Error("the checker's bucket takes the gate's recheck status") + } + if _, _, _, err := ParseCheckerOwedKey(key); err == nil { + t.Error("a checker owed key of the recheck status accepted") + } +} diff --git a/go/delivery/gate.go b/go/delivery/gate.go index 281ab13..18444c5 100644 --- a/go/delivery/gate.go +++ b/go/delivery/gate.go @@ -34,10 +34,11 @@ const ( StatusContextMergeGate = "mesh/merge-gate" StatusContextDelivery = "mesh/delivery" StatusContextDeliveryGroup = "mesh/delivery-group" + StatusContextRepoCheck = "mesh/repo-check" // the gate's pending status of a recheck (mesh-delivery.recheck) StatusContextCheck = "mesh/check" ) -var statusContexts = []string{StatusContextMergeGate, StatusContextDelivery, StatusContextDeliveryGroup, StatusContextCheck} +var statusContexts = []string{StatusContextMergeGate, StatusContextDelivery, StatusContextDeliveryGroup, StatusContextRepoCheck, StatusContextCheck} // AskKindMerge is the kind of the gate's ask for a group's merge, the first part of its key. const AskKindMerge = "merge"