GT: an owed act ended not-needed is ended, never said as a refusal
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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user