Eleven modules record hand acts through the hand-acts client, the finding writers are the conditions client's, nats takes the broker seat's name from its package (K-21 part, K-4..K-20 part; ADR 0634 §4, ADR 0635 §4; issue 1966)

This commit is contained in:
2026-11-05 14:21:57 +01:00
parent 2f7ff1c911
commit 87388b9046
44 changed files with 140 additions and 95 deletions
@@ -18,10 +18,10 @@ import (
"sync"
"time"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
reg "git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/delivery"
"git.novox.be/novox/mesh-sdk/go/handacts"
"git.novox.be/novox/mesh-sdk/go/health"
"git.novox.be/novox/mesh-sdk/go/parts"
@@ -167,8 +167,8 @@ func learnInto(state casState, module, fp string, attempts int) (bool, error) {
}
// recordAct records a hand act through the seat mesh-hand-acts alone.
func recordAct(q handacts.Request) error {
_, err := handacts.Recorder{Ask: stdio.Ask}.Record(q)
func recordAct(q meshhandactsclient.Request) error {
_, err := meshhandactsclient.Recorder{Ask: stdio.Ask}.Record(q)
return err
}
+1
View File
@@ -3,6 +3,7 @@ module distribution
go 1.26.0
require (
git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261104174359-05b3e2e1b94f
github.com/nats-io/nats.go v1.54.0
@@ -16,8 +16,8 @@ import (
"testing"
"time"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/handacts"
)
type memObjects map[string][]byte
@@ -383,12 +383,12 @@ func TestTheHolderOfTheTwoImageSeats(t *testing.T) {
}
// Seams note 2: registry_incoming's drop is a hand act recorded through mesh-hand-acts before anything goes;
// an act not recorded leaves the transfer open.
var acts []handacts.Request
b.h.Record = func(q handacts.Request) error { return errors.New("mesh-hand-acts has no holder") }
var acts []meshhandactsclient.Request
b.h.Record = func(q meshhandactsclient.Request) error { return errors.New("mesh-hand-acts has no holder") }
if _, err := b.h.DropByHand("t5", "person.jochen", "stuck"); err == nil || !strings.Contains(err.Error(), "stays open") {
t.Errorf("a drop whose act is not recorded = %v; want refused, t5 open", err)
}
b.h.Record = func(q handacts.Request) error { acts = append(acts, q); return nil }
b.h.Record = func(q meshhandactsclient.Request) error { acts = append(acts, q); return nil }
if _, err := b.h.DropByHand("t5", "person.jochen", ""); err == nil || len(acts) != 0 {
t.Errorf("a drop with no why = %v, acts %v; want refused, nothing recorded", err, acts)
}
@@ -9,7 +9,7 @@ import (
"strings"
"time"
"git.novox.be/novox/mesh-sdk/go/handacts"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
"git.novox.be/novox/mesh-sdk/go/parts"
)
@@ -168,9 +168,9 @@ type Holder struct {
Now func() time.Time
// Cap reads incoming's cap from its binding (parts.BusCap); IncomingCap when nil or when the binding names none.
Cap func() (uint64, error)
// Record records a hand act through the seat mesh-hand-acts (handacts.Recorder); a drop by hand is refused
// Record records a hand act through the seat mesh-hand-acts (meshhandactsclient.Recorder); a drop by hand is refused
// without it.
Record func(handacts.Request) error
Record func(meshhandactsclient.Request) error
// Idle writes a transfer's idle key with its own time to live, once (parts.BusArm over IdleState); the receiver
// arms it on each open that leaves a transfer open. Nil arms nothing.
Idle func(id string, ttl time.Duration) error
@@ -312,7 +312,7 @@ func (h *Holder) DropByHand(id, by, why string) (Transfer, error) {
return Transfer{}, fmt.Errorf("transfer %s is not open", id)
}
what := fmt.Sprintf("dropped the open transfer %s of incoming (%s@%s on %s, opened by %s, %d parts lacked), by %s", id, t.Shape.Name, t.Shape.Version, t.Shape.Seat, t.Opener, len(t.Lacks()), by)
if err := h.Record(handacts.Request{What: what, Why: why, Cause: "registry_incoming"}); err != nil {
if err := h.Record(meshhandactsclient.Request{What: what, Why: why, Cause: "registry_incoming"}); err != nil {
return Transfer{}, fmt.Errorf("the hand act cannot be recorded, so transfer %s stays open: %w", id, err)
}
return h.Drop(id)