diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/adr661_test.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/adr661_test.go index 164d3a1f7..19e7d353e 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/adr661_test.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/adr661_test.go @@ -1,6 +1,8 @@ package main import ( + "encoding/json" + "reflect" "strings" "testing" "time" @@ -134,3 +136,20 @@ func TestNoCheckGatesAMergeAtTheGate(t *testing.T) { t.Run(name, run) } } + +// Issue 1794: the gate keeps no mark of an own ask of a check, so no verdict of another check of the head can clear one while +// the gate's own is in flight: since issue 1318 the gate asks no check, only the checker's verdict at the heads is read, and a +// run holds no field that marks an ask of one. +func TestTheGateAsksNoCheckOfItsOwnSoNoMarkOfOneCanBeClearedByAnother(t *testing.T) { + typ := reflect.TypeOf(ReadyRun{}) + for i := 0; i < typ.NumField(); i++ { + if f := typ.Field(i).Name; strings.HasPrefix(f, "OwnAsk") || strings.HasPrefix(f, "OwnCheck") { + t.Errorf("ReadyRun holds %s: a mark of a check the gate asked itself, which it no longer asks", f) + } + } + for _, key := range []string{"own_asked_at", "own_ask"} { + if raw, _ := json.Marshal(ReadyRun{}); strings.Contains(string(raw), key) { + t.Errorf("a run is kept with %s", key) + } + } +} diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/ready.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/ready.go index 18749f9f6..3898e05de 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/ready.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/ready.go @@ -81,9 +81,6 @@ type ReadyRun struct { // (merges.go). MergeCommit string `json:"merge_commit,omitempty"` SourceMoved bool `json:"source_moved,omitempty"` - // OwnAskedAt is when its own check was asked after the merge tool refused it for a pending status of its own (issue - // 1049): once for the head this run is for. - OwnAskedAt time.Time `json:"own_asked_at,omitempty"` // Urgent is set once a refusal of this head was one that is urgent at once: its severity never steps down to a // warning after (issue 1275, AC6). Urgent bool `json:"urgent,omitempty"`