From 30a3e665e0070ae5b0ebfede985da5759af8affd Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 02:06:45 +0100 Subject: [PATCH] GT: an owed act ended not-needed is ended, never said as a refusal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A pull request closed unmerged is a fact of the forge, not a fault of the act, so the gate no longer keeps a refusal for an act the forge bridge ends not-needed: the record's acts and gate_record show it ended with that outcome, and delivery_status says no refusal of it. Every other outcome other than performed is still said as a refusal. Builds: design 47 H2 §807; H-A-432 (2), H-A-444 --- .../cmd/mesh-delivery-gate/owedacts_test.go | 22 +++++++++++++++++++ .../cmd/mesh-delivery-gate/owedended.go | 8 ++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/owedacts_test.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/owedacts_test.go index 41338b81c..f7331bc9e 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/owedacts_test.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/owedacts_test.go @@ -98,6 +98,28 @@ func TestARecordsChangesOweTheNoteTheViewAndWhenFailedOrHeldAComment(t *testing. if owed := h.Status("")["owed"]; owed != 1 { t.Fatalf("%v acts owed, not the one left", owed) } + // H-A-444: ended not-needed is a fact of the forge, never a refusal: gate_record shows it ended with that outcome, + // and delivery_status says no refusal of it. + views, err := rs.RecordOf(r.Instance, "") + if err != nil || len(views) != 1 || views[0].Record.Acts[id].Outcome != forgemsg.OwedNotNeeded { + t.Fatalf("gate_record shows %+v: %v", views, err) + } + if refused, ok := h.Status("")["refused"]; ok { + t.Fatalf("delivery_status says a not-needed act as refused: %v", refused) + } + // an act that could not be performed is a fault, and stays said as refused + other := f.said[1].ID + body, err = forgemsg.EncodeOwedEnded(forgemsg.OwedEnded{V: 1, Of: seat.Seat, ID: other, Outcome: forgemsg.OwedCouldNotBePerformed, + Words: "the forge answered 500", At: at}) + if err != nil { + t.Fatal(err) + } + if err := h.OwedEnded(body); err != nil { + t.Fatal(err) + } + if refused, _ := h.Status("")["refused"].([]string); len(refused) != 1 || !strings.Contains(refused[0], "the forge answered 500") { + t.Fatalf("delivery_status's refusals: %v", h.Status("")["refused"]) + } }) t.Run("a record ended failed says a comment naming why; ended healthy says none", func(t *testing.T) { _, rs, r, f := setup(t) diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/owedended.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/owedended.go index 009902462..1d6d5551f 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/owedended.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/owedended.go @@ -14,8 +14,8 @@ var owedEndedEvent = declared(forgemsg.OwedEndedEvent) // OwedEnded takes the forge bridge's outcome of one act this owner said as owed, and writes it into the delivery record that // holds the act (A-35): an act is answered only once its outcome is recorded. An outcome heard twice, or of an id no record -// holds, changes nothing. An outcome other than performed is said. An error leaves the event to be heard again: the record -// could not take it. +// holds, changes nothing. An outcome other than performed or not-needed is said as a refusal. An error leaves the event to +// be heard again: the record could not take it. func (h *Holder) OwedEnded(body []byte) error { e, err := forgemsg.DecodeOwedEnded(body) if err != nil { @@ -41,7 +41,9 @@ func (h *Holder) OwedEnded(body []byte) error { if !ok { continue } - if e.Outcome != forgemsg.OwedPerformed { + // Not-needed (its pull request closed unmerged) is a fact of the forge, not a fault of the act: ended with that + // outcome in the record, never said as a refusal (design 47 H2 §807, H-A-444). + if e.Outcome != forgemsg.OwedPerformed && e.Outcome != forgemsg.OwedNotNeeded { h.Refuse(fmt.Errorf("%s: the %s owed on %s#%d at %s was %s: %s", r.Instance, held.Act, held.Repository, held.Number, shortOf(held.Head, 12), e.Outcome, e.Words)) }