All of mesh-build-go's buildstep Go module leaves mesh-catalog for modules/mesh-delivery-sdk: the step run, fetch and release and the regenerate-and-compare step as the package steprun, the CPU share as steprun/buildcpu, the conformance kit as steprun/conformance, the seat generator as seatgen with cmd/seatgen, and cmd/mesh-pack. The three build modules and the builder's and checker's tests import the SDK and keep no copy; the SDK requires nothing of mesh-catalog. Code the build modules share is the delivery domain's SDK, not one module's package. It carries the build-module round's two new files of that package (dropdetected.go 247c422f, storedbuilds.go 904b8aed). Builds: design 47 G §464, §680, §327, §420, §495 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
36 lines
1.5 KiB
Go
36 lines
1.5 KiB
Go
package steprun
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// DropDetected is the drop of the build seats' `steps` (design 47 G §463, §480): a person's word deletes the kept key of
|
|
// an artifact's detected steps. The act is written in the hand-act log first, with the caller the bus proved; a drop
|
|
// whose log write fails deletes nothing and is answered by the text it returns, which names the log. A drop with no
|
|
// `why`, or whose call the runtime proved no caller for, is refused (an error, nothing recorded).
|
|
//
|
|
// record writes the act in the hand-act log of the seat mesh-hand-acts; forget deletes the key (nil where the seat keeps
|
|
// none, as an image's).
|
|
func DropDetected(artifact, why, caller, key string, record func(what, why string) error, forget func(key string) error) (string, error) {
|
|
switch {
|
|
case strings.TrimSpace(why) == "":
|
|
return "", errors.New("steps: a drop says why")
|
|
case caller == "" || caller == "unproven":
|
|
return "", errors.New("steps: a drop names who drops it, and the runtime proved no caller")
|
|
}
|
|
if record == nil {
|
|
return "the hand-act log is not served here: nothing was deleted", nil
|
|
}
|
|
if err := record(fmt.Sprintf("dropped the detected steps of %s (by %s)", artifact, caller), why); err != nil {
|
|
return fmt.Sprintf("the hand-act log refused the drop of %s, so nothing was deleted: %v", artifact, err), nil
|
|
}
|
|
if forget != nil {
|
|
if err := forget(key); err != nil {
|
|
return fmt.Sprintf("the drop of %s was recorded in the hand-act log and the key could not be deleted: %v", artifact, err), nil
|
|
}
|
|
}
|
|
return "", nil
|
|
}
|