MH-0: an entry whose ask failed is asked again, at most entry-asks times, then unanswered
The node-engine consumes the entries client's asking again (H-A-60, H-A-110): the setting entry-asks (default 5; module.json config and file resource, read at the engine's start) goes to Entries.Asks; Entries.AskAgain is called at each link's start and on each catalog-revision the composer hears (the shadow's cache too); the finding entry-unanswered joins the engine's finding kinds, written with a journal line when an entry ends unanswered and cleared when it is answered or no longer wanted; the shadow's wait and the have's hold end on it instead of waiting without bound. Builds: design 47 H, H-A-60, H-A-110 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -13,6 +13,10 @@ import (
|
||||
// running for (design 47 G §614, A-15, A-117): scope module, its id the fingerprint escaped as a name.
|
||||
const EntryNotFoundKind = "entry-not-found"
|
||||
|
||||
// EntryUnansweredKind is the finding a part writes when its ask of the catalog half's entry of a fingerprint failed to reach the
|
||||
// holder as often as the setting `entry-asks` allows (design 47 H, H-A-60): scope module, its id the fingerprint escaped as a name.
|
||||
const EntryUnansweredKind = "entry-unanswered"
|
||||
|
||||
// EntryNotFoundID is the finding's id for a fingerprint.
|
||||
func EntryNotFoundID(fp string) string { return keys.EscapeName(fp) }
|
||||
|
||||
@@ -31,3 +35,20 @@ func SayEntryNotFound(ctx context.Context, w Writer, node, observer, fp string,
|
||||
Explanation: "A want or a running names this build and the catalog half answered that it holds no entry of it. The finding clears when the entry is answered or nothing the node holds names the build.",
|
||||
At: now()})
|
||||
}
|
||||
|
||||
// SayEntryUnanswered writes the finding for fp when unanswered, and clears it when no longer: the entry answered later, asked
|
||||
// again by hand, or nothing the node holds names the fingerprint any more (design 47 H, H-A-60). A write or a clear that fails is
|
||||
// returned for the caller to say.
|
||||
func SayEntryUnanswered(ctx context.Context, w Writer, node, observer, fp string, asks int, unanswered bool, now func() time.Time) error {
|
||||
id := EntryNotFoundID(fp)
|
||||
if !unanswered {
|
||||
return w.Clear(ctx, scopeModule, id, EntryUnansweredKind, "the entry is answered, or nothing the node holds names its fingerprint")
|
||||
}
|
||||
return w.Write(ctx, condseat.Finding{Observer: observer, Kind: EntryUnansweredKind, Scope: scopeModule, ID: id,
|
||||
Severity: condseat.FindingSeverityWarning, Source: EntryUnansweredKind,
|
||||
Subject: condseat.Subject{Scope: scopeModule, ID: observer, Machine: node},
|
||||
Summary: fmt.Sprintf("the ask of the catalog half's entry of the build %s failed to reach the holder %d times, so %s composes nothing new of it", fp, asks, node),
|
||||
Headline: fmt.Sprintf("the entry of the build %s is unanswered on %s", fp, node),
|
||||
Explanation: "The ask failed in transport and was asked again as often as the setting entry-asks allows. The finding clears when the entry is answered, asked again by hand (the seat node-engine's verb entry-again) or nothing the node holds names the build.",
|
||||
At: now()})
|
||||
}
|
||||
|
||||
@@ -230,6 +230,17 @@ func caseAnEntryNotFoundIsAFindingOfTheFingerprint(t *testing.T) {
|
||||
if err := SayEntryNotFound(context.Background(), w, "n1", "mesh-host", fp, false, now); err != nil || len(w.cleared) != 1 || w.cleared[0].ID != w.put[0].ID {
|
||||
t.Fatalf("cleared %+v, %v", w.cleared, err)
|
||||
}
|
||||
// And design 47 H, H-A-60: an entry unanswered is the finding entry-unanswered, of the same scope and id, cleared by the same.
|
||||
u := &fakeFindings{}
|
||||
if err := SayEntryUnanswered(context.Background(), u, "n1", "mesh-host", fp, 5, true, now); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(u.put) != 1 || u.put[0].Kind != EntryUnansweredKind || u.put[0].Scope != "module" || u.put[0].ID != keys.EscapeName(fp) {
|
||||
t.Fatalf("written %+v", u.put)
|
||||
}
|
||||
if err := SayEntryUnanswered(context.Background(), u, "n1", "mesh-host", fp, 0, false, now); err != nil || len(u.cleared) != 1 || u.cleared[0].Kind != EntryUnansweredKind || u.cleared[0].ID != u.put[0].ID {
|
||||
t.Fatalf("cleared %+v, %v", u.cleared, err)
|
||||
}
|
||||
}
|
||||
|
||||
// ADR 0636 §1, the node's finding of a seat list unread.
|
||||
|
||||
Reference in New Issue
Block a user