The delivery repository's contracts and SDK live under modules/ as mesh-delivery-contracts and mesh-delivery-sdk, their Go module paths renamed to match the folders (the TypeScript names already did), and every importer in mesh-delivery, mesh-catalog, mesh-host, mesh-tools and mesh-sdk follows in the same group: a design as it should be, one path per module, checked by the group's check building every importer. Builds: design 47 G §427, §88 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
54 lines
1.9 KiB
Go
54 lines
1.9 KiB
Go
package buildrun
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
|
|
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
|
|
)
|
|
|
|
// 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 name lookup, a deadline or, for every other refused, reset or cut
|
|
// connection, a connection.
|
|
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", strings.ToLower(buildstep.HolderSilentWords), "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
|
|
}
|