Files
mesh-catalog/modules/mesh-build-go/buildstep/dropdetected.go
T
jschoubben 247c422fbf BG9, BN9, BI3: the build seats' steps with drop writes the hand-act log first
A drop of a kept detected-steps key records the act with the caller the bus proved, then deletes the key; a log that
refuses deletes nothing and is answered error; a drop without why is refused; fetch is asked unless drop.

Builds: design 47 G §463, §480

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 04:56:25 +01:00

36 lines
1.5 KiB
Go

package buildstep
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
}