H-A-150: forget only on the store's own answer, and on the apply's fetch too

A fetch nothing answered for (a bus or store that did not answer, a gateway
saying the store is away) proves nothing about the digest, so it is tried
again as before and the module is not held for it; only an answer of the
store's (a 404, bytes not of the digest) forgets the resolution. The apply's
fetch of a bundle meets the same wrong digest as the take-in's, so it tells
the composer too (apply.WithFetchFailed, set in the node agent's apply).

Builds: design 47 H H-A-150, H-A-146, G A-430a
This commit is contained in:
2026-11-20 16:35:42 +01:00
parent dc95fb5673
commit 132b767043
8 changed files with 91 additions and 9 deletions
+12 -2
View File
@@ -1693,8 +1693,11 @@ func (r reader) Archive(ctx context.Context, url, digest string) ([]byte, error)
defer cancel()
body, err := r.c.env.Fetch(fetching, url)
if r.c.note(err) != nil {
// A resolution whose fetch failed is forgotten, and versions asked again (H-A-146).
r.c.forgetFetched(digest, fmt.Sprintf("the fetch of %s failed: %v", url, err))
// A resolution whose fetch the store answered and failed is forgotten, and versions asked again (H-A-146); a fetch
// nothing answered for is tried again as before, the module not held for it (H-A-150).
if storeAnswered(err) {
r.c.forgetFetched(digest, fmt.Sprintf("the fetch of %s failed: %v", url, err))
}
return nil, err
}
sum := sha256.Sum256(body)
@@ -1707,6 +1710,13 @@ func (r reader) Archive(ctx context.Context, url, digest string) ([]byte, error)
return body, nil
}
// storeAnswered is whether a fetch failed with the store's own answer (the apply's fetch says so by StoreAnswered: a 404, never a
// store nothing answered for), H-A-150.
func storeAnswered(err error) bool {
var a interface{ StoreAnswered() bool }
return errors.As(err, &a) && a.StoreAnswered()
}
// Served reads, of another node's module, the keys named of mesh-config's resolved values, one key each: the node is
// granted those keys alone (buscompose Principal.ServedReads, issue 1126).
func (r reader) Served(ctx context.Context, node, module string, keys []string) (map[string]any, error) {