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:
2026-11-20 04:25:00 +01:00
parent e4d098c4b9
commit 39e16689fa
12 changed files with 286 additions and 5 deletions
+18 -2
View File
@@ -67,6 +67,12 @@ type Env struct {
// EntryNotFound is told when the catalog half answered it holds no entry of a fingerprint (notFound), and when that is no longer so:
// the entry answered, or nothing the node holds names it (design 47 G §614, A-117). Nil tells nobody.
EntryNotFound func(fp string, notFound bool)
// EntryUnanswered is told when an ask of the catalog half's entry failed to reach the holder as often as EntryAsks allows
// (unanswered), and when that is no longer so (design 47 H, H-A-60). Nil tells nobody.
EntryUnanswered func(fp string, asks int, unanswered bool)
// EntryAsks is the setting `entry-asks`: how often an entry whose ask failed in transport is asked again before it is
// unanswered; meshcatalogclient.DefaultEntryAsks when 0 (design 47 H, H-A-60).
EntryAsks int
// Watch follows one bucket's keys matching pattern, as the agent's watches do.
Watch func(ctx context.Context, bucket, pattern string) (<-chan agent.Update, error)
// Get reads one key's latest value; nil and no error when there is none.
@@ -168,7 +174,10 @@ type Composer struct {
OnEngine func(module string)
// AlsoEntryAgain is told each entry asked again by hand, so the shadow's own cache of entries asks it again too.
AlsoEntryAgain func(ctx context.Context, fp string)
env Env
// AlsoEntriesAskAgain is told each catalog-revision the composer hears, so the shadow, which hears nothing itself, asks its
// own entries again too (design 47 H, H-A-110).
AlsoEntriesAskAgain func(ctx context.Context)
env Env
mu sync.Mutex
wants map[string]meshwants.WantsByWantNodeModuleValue // by module, the node's own under agent.NodeModule
@@ -202,6 +211,8 @@ type Composer struct {
keptEnt map[string]keptEntry
// notFound is each fingerprint whose entry-not-found the composer told, so it is told once and cleared once.
notFound map[string]bool
// unanswered is each fingerprint whose entry-unanswered the composer told, so it is told once and cleared once.
unanswered map[string]bool
// resolved is each wanted build's digests as its version resolved them through the registry seats (versions.go, A-430a).
resolved map[resolvedKey]versionParts
keptWantVal map[string]keptWant
@@ -706,7 +717,7 @@ func (c *Composer) Watch(ctx context.Context, _ string) (<-chan agent.Update, er
return out, nil
}
// hearCatalogRevisions hears the seat mesh-catalog's event catalog-revision: each one clears the backoffs of the trunk builds the
// hearCatalogRevisions hears the seat mesh-catalog's event catalog-revision: each one asks again the entries whose ask failed (H-A-110), clears the backoffs of the trunk builds the
// catalog gave none of and wakes a pass (A-487a). A wake-up only, the backoff bounds the asks without it: a subscription refused
// is said once with its subject and error (principle 3), the composer goes on composing, and the subscription is tried again on
// laterAgain's steps until it holds.
@@ -725,6 +736,11 @@ func (c *Composer) hearCatalogRevisions(ctx context.Context, wake func()) {
return
}
c.trunkRetryCleared()
// And each entry whose ask failed in transport is asked again, once per take-in (design 47 H, H-A-110).
c.EntriesAskAgain(ctx)
if c.AlsoEntriesAskAgain != nil {
c.AlsoEntriesAskAgain(ctx)
}
wake()
}
}