K1 stopping-goes: the kind stopping is read nowhere; PublishFault reads no responders as the transport fault

Builds: design 47 H2 H-A-570 (3), H-A-624 (3), H-A-658
This commit is contained in:
2026-11-25 17:11:41 +01:00
parent e0f69f73d3
commit 81bf6c7cc9
4 changed files with 14 additions and 32 deletions
@@ -11,20 +11,12 @@ import (
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
)
// stoppingFault is a call a stopping tool runner did not take, as mesh-sdk's stdio hands it: its typed fault stopping.
type stoppingFault struct{}
func (stoppingFault) Error() string {
return "registry's publish was not taken: the tool runner is stopping"
}
func (stoppingFault) ErrorKind() string { return "stopping" }
// Design 47 H2 §799: a fetch met by a forge's 401 or a connection fault, and a publish met by no responders or a bundle
// that exited, end their run `again` after again-delays' delay, with no seat call; a third run's fault ends the step failed
// with the why `fetch: <words>` or `publish: <words>`. ADR 0664 §1 with the bus's count above the runs that started: an ask
// given back twice before its first run (the bus says delivered 3, the step key 1 run began) meets its fault in run 2,
// given again after again-delays' second, 60 s, not 3. A publish met by a stopping tool runner is one too (H-A-542); a
// bare timeout is not.
// given again after again-delays' second, 60 s, not 3. A publish met by a stopping tool runner is met by no responders (H-A-570 (3)), so it
// is one too; a bare timeout is not.
func TestAFetchOrAPublishMetAwayIsATransportFault(t *testing.T) {
delay, err := AgainDelays("")
if err != nil || delay(1) != 15*time.Second || delay(2) != time.Minute || delay(3) != time.Minute {
@@ -47,7 +39,8 @@ func TestAFetchOrAPublishMetAwayIsATransportFault(t *testing.T) {
{"a publish met by a bundle that exited", "publish: ", PublishFault(errors.New("the bundle exited"))},
{"a fetch of a commit that is not there", "", gitFailure("fetch", "fatal: unknown revision or path not in the working tree")},
{"a publish refused", "", PublishFault(errors.New("refused: the digest differs"))},
{"a publish met by a stopping tool runner", "publish: ", PublishFault(fmt.Errorf("asked again: %w", stoppingFault{}))},
{"a publish met by a stopping tool runner, no responders wrapped", "publish: ", PublishFault(fmt.Errorf("asked again: %w", errors.New("nats: no responders available for request")))},
{"a publish met by a fault kinded stopping, which no code reads", "", PublishFault(errors.New("registry's publish was not taken: the tool runner is stopping"))},
{"a publish met by a bare timeout", "", PublishFault(errors.New("timeout"))},
} {
t.Run(tc.name, func(t *testing.T) {
+3 -3
View File
@@ -82,8 +82,8 @@ func PublishParts(ctx context.Context, call SeatCall, seat string, in reg.Publis
return sent, PublishFault(err)
}
// PublishFault is err, or, when a publish met no responders, a registry's bundle that exited or a stopping tool runner (its
// typed fault stopping, which sdkstep.IsPassing counts, design 47 H2 H-A-542), a sdkstep.Passing whose words open with
// PublishFault is err, or, when a publish met no responders (a stopping tool runner's calls meet none, design 47 H2 H-A-570
// (3)) or a registry's bundle that exited, a sdkstep.Passing whose words open with
// "publish: " (design 47 H2 §799, ADR 0664 §1): the run ends `again`, with no seat call to learn why, and a third run's
// fault ends the step failed with the why `publish: <words>`. Any other error, a bare "timeout" among them, is returned as
// it is.
@@ -93,7 +93,7 @@ func PublishFault(err error) error {
return err
}
words := strings.ToLower(err.Error())
if !sdkstep.IsPassing(err) && !strings.Contains(words, "no responders") && !strings.Contains(words, "bundle exited") {
if !strings.Contains(words, "no responders") && !strings.Contains(words, "bundle exited") {
return err
}
return &sdkstep.Passing{Err: fmt.Errorf("publish: %w", err)}