mesh-hand-acts and mesh-healers take the hand-act names and the act from the seat mesh-hand-acts and its client, not mesh-sdk's handacts (B5l; ADR 0634 §4; issue 1966)
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -24,35 +24,36 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
handactsclient "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
|
||||
handacts "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshhandacts"
|
||||
occ "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/clients/operatorchannelclient"
|
||||
oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel"
|
||||
"git.novox.be/novox/mesh-sdk/go/handacts"
|
||||
)
|
||||
|
||||
// The seat, the log, the states and the event, as mesh-sdk's handacts names them.
|
||||
// The seat, the log, the states and the event, as the seat mesh-hand-acts's contract names them.
|
||||
const (
|
||||
Module = handacts.Module
|
||||
Module = "mesh-hand-acts"
|
||||
Seat = handacts.Seat
|
||||
ActsLog = handacts.ActsLog
|
||||
WarrantsState = handacts.WarrantsState
|
||||
ActsLog = handacts.StateActs
|
||||
WarrantsState = handacts.StateWarrants
|
||||
// RouterRecords is the router's record of every ask, `<asker>.<ask>` (ADR 0259): the warrant is read there.
|
||||
RouterRecords = "messenger.asks"
|
||||
RecordedEvent = handacts.EventRecorded
|
||||
RecordedEvent = handacts.EventActRecorded
|
||||
// RecordedSubject is where the seat says it: a seat's events are on mesh.seat.<seat>.event.<name>, which its
|
||||
// consumers hear (catalogue.SeatSays).
|
||||
RecordedSubject = "mesh.seat." + Seat + ".event." + RecordedEvent
|
||||
|
||||
VerbRecord = handacts.VerbRecord
|
||||
VerbDrill = handacts.VerbDrill
|
||||
VerbWarrant = handacts.VerbWarrant
|
||||
CauseDrill = handacts.CauseDrill
|
||||
CauseOperatorAnswer = handacts.CauseOperatorAnswer
|
||||
VerbRecord = handactsclient.VerbRecord
|
||||
VerbDrill = handactsclient.VerbDrill
|
||||
VerbWarrant = handactsclient.VerbWarrant
|
||||
CauseDrill = handactsclient.CauseDrill
|
||||
CauseOperatorAnswer = handactsclient.CauseOperatorAnswer
|
||||
)
|
||||
|
||||
// RepeatedWithin is how far back a cause counts as repeated (S15).
|
||||
const RepeatedWithin = 14 * 24 * time.Hour
|
||||
|
||||
// Act is one entry of the log: mesh-sdk's handacts.Act, the controller's HandAct unchanged.
|
||||
// Act is one entry of the log: the seat's Act.
|
||||
type Act = handacts.Act
|
||||
|
||||
// Store is the bus's buckets and this module's log as it reaches them, through its runtime. Create writes a key only
|
||||
@@ -130,7 +131,7 @@ func (l *Log) HandAct(by, verb, what, why, cause, condition string) (Recorded, e
|
||||
", which no healer is wanted for. Nothing was recorded")
|
||||
}
|
||||
at := l.Now().UTC()
|
||||
act := Act{ID: actKey(at), At: at, By: by, Verb: verb, Args: []string{what}, Why: why, Cause: cause,
|
||||
act := Act{ID: actKey(at), At: at, By: by, Verb: verb, Arguments: []string{what}, Why: why, Cause: cause,
|
||||
Condition: strings.TrimSpace(condition)}
|
||||
if err := l.record(act); err != nil {
|
||||
return Recorded{}, err
|
||||
@@ -219,10 +220,10 @@ func (l *Log) Warranted(caller, asker, ask string) (Recorded, error) {
|
||||
}
|
||||
at := l.Now().UTC()
|
||||
act := Act{ID: "warrant-" + asker + "-" + ask, At: warranted.UTC(), Verb: VerbWarrant,
|
||||
Args: []string{fmt.Sprintf("the operator chose %s on %s's ask %s", w.Label, asker, ask)},
|
||||
Why: fmt.Sprintf("%s (ask %s of %s)", occ.Says(*w), ask, asker),
|
||||
By: fmt.Sprintf("the %s, as %s identity %s", w.By.Who, w.By.Kind, w.By.Identity),
|
||||
Cause: CauseOperatorAnswer, Via: via(*w), Ask: ask, Proofs: w.Proofs,
|
||||
Arguments: []string{fmt.Sprintf("the operator chose %s on %s's ask %s", w.Label, asker, ask)},
|
||||
Why: fmt.Sprintf("%s (ask %s of %s)", occ.Says(*w), ask, asker),
|
||||
By: fmt.Sprintf("the %s, as %s identity %s", w.By.Who, w.By.Kind, w.By.Identity),
|
||||
Cause: CauseOperatorAnswer, Via: via(*w), Ask: ask, Proofs: w.Proofs,
|
||||
RequestedBy: asker + ", recorded at the word of " + caller,
|
||||
Outcome: "chosen; what " + asker + " did with it is in its own record"}
|
||||
if claimed == nil {
|
||||
@@ -297,7 +298,7 @@ func (l *Log) HandActs(days int, cause, who string) Listing {
|
||||
out.Kept[ActsLog] = kept
|
||||
}
|
||||
for _, a := range all {
|
||||
if now.Sub(a.At) <= RepeatedWithin && a.Repair() {
|
||||
if now.Sub(a.At) <= RepeatedWithin && handactsclient.Repair(a) {
|
||||
out.Repeated[a.Cause]++
|
||||
}
|
||||
if a.At.Before(since) || (cause != "" && a.Cause != cause) || (who != "" && !strings.Contains(a.By, who)) {
|
||||
@@ -329,7 +330,7 @@ func (l *Log) read(since time.Time) ([]Act, int, error) {
|
||||
if json.Unmarshal(raw, &a) != nil || a.At.Before(since) {
|
||||
continue
|
||||
}
|
||||
a.Log = handacts.LogSeat
|
||||
a.Log = handacts.Seat
|
||||
out = append(out, a)
|
||||
}
|
||||
return out, len(entries), nil
|
||||
|
||||
@@ -171,7 +171,7 @@ func TestHandActRecordsWhatTheProvenCallerDid(t *testing.T) {
|
||||
raw, _, _ := store.Last(ActsLog, keys[0])
|
||||
_ = json.Unmarshal(raw, &kept)
|
||||
if kept.By != tc.by || kept.Verb != tc.wantVerb || kept.Cause != tc.wantCause || kept.Condition != "bus.x.missing" ||
|
||||
kept.Args[0] != tc.what || kept.Log != "" {
|
||||
kept.Arguments[0] != tc.what || kept.Log != "" {
|
||||
t.Errorf("%s: kept %+v", tc.name, kept)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user