Files
mesh-delivery/modules/mesh-delivery-builder/buildrun/faults.go
T
jschoubben f6e7f4210b B9: a fetch or a publish met away ends its run again, by again-delays, with no seat call
The build modules' shared steprun parts of §799: again-delays (15s,60s) read
into a Puller's Delay; a fetch's 401/5xx or connection fault and a publish's
no responders or exited bundle are transport faults whose why opens fetch: or
publish:; the assigner call that named a silent holder goes. The builder reads
an exited bundle as no responders and keeps the part in a key's fault words.

Builds: design 47 H2 §799 (H-A-390)
2026-11-22 00:20:17 +01:00

54 lines
2.0 KiB
Go

package buildrun
import (
"strings"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
)
// The words of a key that failed on a transport fault (design 47 G §568, A-76): `transport fault: <class>, <seat> <node>,
// <cause>`, the class one of ADR 0664 §1's four, the seat and node the step's, the cause the last run's in the build
// module's words. No other failure opens `transport fault:`.
// TransportFaultPrefix opens the error of a key that failed on a transport fault.
const TransportFaultPrefix = builds.TransportFaultPrefix
// The classes of a transport fault.
const (
ClassNoResponders = "no responders"
ClassNameLookup = "name lookup"
ClassConnection = "connection"
ClassDeadline = "deadline"
)
// FaultClass is the class of a call's error or a step's reason: the words the builder's retake reads a transport fault by
// (buildstep.PassingCause), read as no responders (a registry's bundle that exited included, design 47 H2 §799), a name
// lookup, a deadline or, for every other refused, reset or cut connection (a forge's 401 or 5xx included), a connection.
// A build module's why keeps its part, `fetch: ` or `publish: ` (§799), in the cause TransportFault says.
func FaultClass(cause string) string {
c := strings.ToLower(cause)
has := func(words ...string) bool {
for _, w := range words {
if strings.Contains(c, w) {
return true
}
}
return false
}
switch {
case has("no responders", "bundle exited", "jetstream not enabled"):
return ClassNoResponders
case has("no such host", "name resolution", "lookup ", "could not resolve", "enotfound", "eai_again"):
return ClassNameLookup
case has("deadline", "timeout", "timed out", "etimedout"):
return ClassDeadline
}
return ClassConnection
}
// TransportFault is the error of a key that failed on a transport fault of the seat's step on node, with the cause of its
// last run.
func TransportFault(class, seat, node, cause string) string {
return TransportFaultPrefix + " " + class + ", " + seat + " " + node + ", " + cause
}