H-A-146: the bound before a failed resolution is asked again is the setting resolve-again-minutes

A failed resolution of a want's version, or one forgotten after a failed fetch, stood a minute written into
the code; by principle 11 a bound is a setting with a default. The manifest declares resolve-again-minutes
(1 to 60, default 1) and its file, the engine reads it at its start and hands it to the composer's Env.

Builds: design 47 H H-A-146 (hq 26f5505e), principle 11
This commit is contained in:
2026-11-20 20:54:32 +01:00
parent 79a0dbf41d
commit 7d5faee346
8 changed files with 87 additions and 15 deletions
+15 -8
View File
@@ -149,12 +149,13 @@ func aResolutionWhoseFetchFailedIsForgotten(t *testing.T) {
Artifacts: []meshcatalog.Artifact{{Ref: "mail:files", Kind: "archive"}}}
want := meshwants.WantsByWantNodeModuleValue{Fp: fp, Version: "1.2.3", Self: true}
for name, row := range map[string]struct {
answer string // the digest versions answers
fetch error // the store's answer to the fetch
then string // what follows the fetch: "" (a pass within the bound), want, compose, bound
asked bool // versions is asked again
forgets bool // the journal says it forgot
failed bool // the fetch fails though nothing is forgotten
answer string // the digest versions answers
fetch error // the store's answer to the fetch
then string // what follows the fetch: "" (a pass within the bound), want, compose, bound
asked bool // versions is asked again
forgets bool // the journal says it forgot
failed bool // the fetch fails though nothing is forgotten
again time.Duration // the setting resolve-again-minutes; 0 is its default
}{
"a fetch that succeeded keeps its resolution": {answer: good, then: "bound"},
"a 404, the next pass within the bound": {answer: wrong, fetch: notFound{}, forgets: true},
@@ -162,13 +163,17 @@ func aResolutionWhoseFetchFailedIsForgotten(t *testing.T) {
"a 404, then a compose by hand": {answer: wrong, fetch: notFound{}, then: "compose", asked: true, forgets: true},
"a 404, then the bound while it is held": {answer: wrong, fetch: notFound{}, then: "bound", asked: true, forgets: true},
"bytes that are not of the digest": {answer: wrong, then: "want", asked: true, forgets: true},
// Principle 11: the bound is the setting resolve-again-minutes, one minute by default.
"a 404, a minute within a setting of five": {answer: wrong, fetch: notFound{}, then: "minute", forgets: true, again: 5 * time.Minute},
"a 404, then the setting's bound of five": {answer: wrong, fetch: notFound{}, then: "bound", asked: true, forgets: true, again: 5 * time.Minute},
// H-A-150: a fetch nothing answered for keeps its resolution, and the module is not held for it.
"a bus that did not answer keeps it": {answer: good, fetch: errors.New("nats: timeout"), failed: true},
"a store away keeps it": {answer: good, fetch: storeAway{}, failed: true},
} {
now := time.Date(2026, 11, 20, 16, 0, 0, 0, time.UTC)
var said []string
env := Env{Node: "desk", Say: func(line string) { said = append(said, line) }, Now: func() time.Time { return now }}
env := Env{Node: "desk", Say: func(line string) { said = append(said, line) }, Now: func() time.Time { return now },
ResolveAgain: row.again}
calls := 0
env.Registry = EntryCall(func(context.Context, string, string, any) (json.RawMessage, error) {
calls++
@@ -196,7 +201,9 @@ func aResolutionWhoseFetchFailedIsForgotten(t *testing.T) {
cancel()
c.ComposeNow(ended)
case "bound":
now = now.Add(resolveAgain)
now = now.Add(max(row.again, DefaultResolveAgain))
case "minute":
now = now.Add(time.Minute)
}
before := calls
again, missing := c.partsOf("mail", entry, want)