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
+21 -5
View File
@@ -154,13 +154,17 @@ func aResolutionWhoseFetchFailedIsForgotten(t *testing.T) {
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
}{
"a fetch that succeeded keeps its resolution": {answer: good, then: "bound"},
"a 404, the next pass within the bound": {answer: wrong, fetch: errors.New("404 Not Found"), forgets: true},
"a 404, then the module's next want": {answer: wrong, fetch: errors.New("404 Not Found"), then: "want", asked: true, forgets: true},
"a 404, then a compose by hand": {answer: wrong, fetch: errors.New("404 Not Found"), then: "compose", asked: true, forgets: true},
"a 404, then the bound while it is held": {answer: wrong, fetch: errors.New("404 Not Found"), then: "bound", asked: true, forgets: true},
"a 404, the next pass within the bound": {answer: wrong, fetch: notFound{}, forgets: true},
"a 404, then the module's next want": {answer: wrong, fetch: notFound{}, then: "want", asked: true, forgets: true},
"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},
// 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
@@ -179,7 +183,7 @@ func aResolutionWhoseFetchFailedIsForgotten(t *testing.T) {
c.keptEnt[fp] = keptEntry{entry: entry}
parts, _ := c.partsOf("mail", entry, want)
_, err := reader{c: c}.Archive(context.Background(), referenceOf("mail", "files", parts["mail:files"]), parts["mail:files"])
if (err != nil) != row.forgets {
if (err != nil) != (row.forgets || row.failed) {
t.Errorf("%s: the fetch: %v", name, err)
}
switch row.then {
@@ -211,3 +215,15 @@ func aResolutionWhoseFetchFailedIsForgotten(t *testing.T) {
}
}
}
// notFound is the artifact store's answer that it holds no such blob, as the apply's fetch says it (StoreAnswered).
type notFound struct{}
func (notFound) Error() string { return "artifact-store answered 404 Not Found" }
func (notFound) StoreAnswered() bool { return true }
// storeAway is a gateway's answer that the store is away (a 503): no answer of the store's own.
type storeAway struct{}
func (storeAway) Error() string { return "artifact-store answered 503 Service Unavailable" }
func (storeAway) StoreAnswered() bool { return false }