diff --git a/modules/mesh-delivery-watchman/internal/watch/records.go b/modules/mesh-delivery-watchman/internal/watch/records.go index 39b7a48c..c1ce908d 100644 --- a/modules/mesh-delivery-watchman/internal/watch/records.go +++ b/modules/mesh-delivery-watchman/internal/watch/records.go @@ -19,6 +19,7 @@ import ( // The kinds of these findings. const ( KindActingPartLate = "acting-part-late" + KindPutStands = "put-stands" KindStoreFilling = "store-filling" KindRecordOpen = "record-open" ) diff --git a/modules/mesh-delivery-watchman/internal/watch/signals.go b/modules/mesh-delivery-watchman/internal/watch/signals.go index c82d83ad..6db0439f 100644 --- a/modules/mesh-delivery-watchman/internal/watch/signals.go +++ b/modules/mesh-delivery-watchman/internal/watch/signals.go @@ -942,7 +942,7 @@ var SignalRows = []struct{ Row, Signal, Bound, Kind string }{ {"S21", "a machine's have failed or its provisioner client's files not placed", ApplyEvery.String(), KindApplyFailing}, {"health", "a have unhealthy in two writes in a row; urgent after " + UnhealthyUrgentAfter.String(), "two writes", KindUnhealthy}, {"take-in", "a source revision or a delivery group the indexer holds back (ADR 0633 §5)", TakeInRevisionBound.String() + " a revision, " + TakeInGroupBound.String() + " a group", KindTakeInWaits}, - {actingRow, "an acting part's wait held (the seats' wait-held, ended by wait-ended)", "the wait's own bound", KindActingPartLate}, + {actingRow, "an acting part's wait held, or a put's, a put without hold that stands (the seats' wait-held, ended by wait-ended)", "the wait's own bound", KindActingPartLate + ", " + KindPutStands}, {storeRow, "a store of the delivery's parts filling or full (the seats' filling, full and room)", "filling from " + fmt.Sprintf("%.0f", FillingFrom*100) + " %, full urgent", KindStoreFilling}, {recordRow, "a delivery record open (the seat mesh-delivery's record-opened, ended by record-ended)", RecordOpenBound.String(), KindRecordOpen}, {"provisions", "a provision of mesh-provisioner in waits (ADR 0570 §7)", "at once", KindNeedsOperator}, diff --git a/modules/mesh-delivery-watchman/internal/watch/waits.go b/modules/mesh-delivery-watchman/internal/watch/waits.go index 9b77f889..b9d4d0c4 100644 --- a/modules/mesh-delivery-watchman/internal/watch/waits.go +++ b/modules/mesh-delivery-watchman/internal/watch/waits.go @@ -44,11 +44,12 @@ func (w *Watchman) WaitEnded(seat string, body []byte) { id := waitID(seat, a) w.unsignal(actingRow, id) w.unfind(FindingKey(ScopeDelivery, id, KindActingPartLate)) + w.unfind(FindingKey(ScopeDelivery, id, KindPutStands)) } func decodeWait(w *Watchman, seat, event string, body []byte) (meshwants.Wait, bool) { var a meshwants.Wait - if err := json.Unmarshal(body, &a); err != nil || a.Part == "" || a.Module == "" || a.Since.IsZero() { + if err := json.Unmarshal(body, &a); err != nil || (a.Part == "" && a.Step != meshwants.WaitStepPut) || a.Module == "" || a.Since.IsZero() { w.say("the %s of the seat %s does not read, left: %v", event, seat, err) return a, false } @@ -67,6 +68,10 @@ func (w *Watchman) waitHeld(seat string, a meshwants.Wait) { from = *a.ClockFrom } id := waitID(seat, a) + if a.Step == meshwants.WaitStepPut { + w.putStands(id, a, bound, from) + return + } f := Finding{Scope: ScopeDelivery, ID: id, Kind: KindActingPartLate, Severity: Warning, Source: actingRow, Since: a.Since, Summary: fmt.Sprintf("%s on %s waits for %s to run %s at the step %s, since %s (bound %s)", a.Module, orWords(a.Node, "no node"), a.Part, orWords(a.Version, "its new version"), a.Step, stamp(a.Since), bound), @@ -84,3 +89,24 @@ func (w *Watchman) waitHeld(seat string, a meshwants.Wait) { } w.find(f) } + +// putStands is a put's wait held (`step: put`, design 47 G §498): a put without hold that stands past its bound is said as the +// finding `put-stands`, never `acting-part-late`, since no acting part is waited for. w.mu held. +func (w *Watchman) putStands(id string, a meshwants.Wait, bound time.Duration, from time.Time) { + f := Finding{Scope: ScopeDelivery, ID: id, Kind: KindPutStands, Severity: Warning, Source: actingRow, Since: a.Since, + Summary: fmt.Sprintf("a put of %s on %s at %s stands, since %s (bound %s)", a.Module, orWords(a.Node, "no node"), + orWords(a.Fingerprint, "its build"), stamp(a.Since), bound), + Said: "stands for " + bound.String(), + Headline: "A put has not gone through", + Explanation: "A put of " + a.Module + " without a hold has stood past its bound of " + bound.String() + + ", so the node's want is not at the build that was put.", + Needs: "the put to go on, or released by hand (assigner_release)"} + left := bound - w.now().Sub(from) + w.unsignal(actingRow, id) + w.unfind(f.Key()) + if left > 0 { + w.signal(actingRow, id, left, signalDue{Do: dueFind, Finding: f}) + return + } + w.find(f) +} diff --git a/modules/mesh-delivery-watchman/internal/watch/waits_test.go b/modules/mesh-delivery-watchman/internal/watch/waits_test.go index 40bd094f..481bd363 100644 --- a/modules/mesh-delivery-watchman/internal/watch/waits_test.go +++ b/modules/mesh-delivery-watchman/internal/watch/waits_test.go @@ -70,3 +70,26 @@ func TestAnActingPartsWaitIsLateByItsBoundFromItsClock(t *testing.T) { } }) } + +// design 47 G §498 (WM14): a put's wait (`step: put`, no part) raises `put-stands` once its bound has run, and a pipeline's wait +// raises nothing for it; `wait-ended` ends it. +func TestAPutWithoutHoldThatStandsIsPutStands(t *testing.T) { + put := func(since time.Time) []byte { + b, _ := json.Marshal(meshwants.Wait{Step: meshwants.WaitStepPut, Node: "ace", Module: "web", Fingerprint: "fp-1", Since: since, Bound: "30m"}) + return b + } + id := "mesh-wants-put--ace-web" + w, o, c := setup() + w.WaitHeld("mesh-wants", put(c.t)) + if len(o.findings) != 0 { + t.Fatalf("within the bound: %v", o.findings) + } + expire(w, c, signalKey(actingRow, id), 30*time.Minute) + if _, ok := o.findings[FindingKey(ScopeDelivery, id, KindPutStands)]; !ok || len(o.findings) != 1 { + t.Fatalf("past its bound: %v", o.findings) + } + w.WaitEnded("mesh-wants", put(c.t)) + if len(o.findings) != 0 { + t.Fatalf("wait-ended left %v", o.findings) + } +}