From cd246777568b4f8ad584798c3e858e9f9e7e9e68 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 11 Nov 2026 21:59:18 +0100 Subject: [PATCH] mesh-self-check and mesh-healers give the writer the findings-asked subject of the seat's contract, and the reader the writer itself Builds: design 47 G A-17, A-16 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ --- modules/mesh-healers/cmd/mesh-healers/healers_test.go | 2 +- modules/mesh-healers/cmd/mesh-healers/main.go | 3 ++- .../mesh-healers/cmd/mesh-healers/whole_integration_test.go | 3 +-- modules/mesh-self-check/cmd/mesh-self-check/main.go | 5 +++-- .../mesh-self-check/cmd/mesh-self-check/selfcheck_test.go | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/mesh-healers/cmd/mesh-healers/healers_test.go b/modules/mesh-healers/cmd/mesh-healers/healers_test.go index 6bb3d37c1..8b1413991 100644 --- a/modules/mesh-healers/cmd/mesh-healers/healers_test.go +++ b/modules/mesh-healers/cmd/mesh-healers/healers_test.go @@ -161,7 +161,7 @@ func (w *world) fresh() { }, } wr, err := views.NewWriter(views.WriterConfig[Finding, FindingCleared, FindingsStated, FindingsAsked]{ - Module: Module, Node: "ace", State: findingState{w.store}, Observe: w.h.Observe, Now: func() time.Time { return w.now }, + Module: Module, Node: "ace", Asked: "mesh.seat.mesh-conditions.event.findings-asked", State: findingState{w.store}, Observe: w.h.Observe, Now: func() time.Time { return w.now }, Publish: func(_ context.Context, subject string, _ []byte, _ string) error { w.events = append(w.events, subject) return nil diff --git a/modules/mesh-healers/cmd/mesh-healers/main.go b/modules/mesh-healers/cmd/mesh-healers/main.go index 969f0a6fe..55cafb836 100644 --- a/modules/mesh-healers/cmd/mesh-healers/main.go +++ b/modules/mesh-healers/cmd/mesh-healers/main.go @@ -14,6 +14,7 @@ import ( "os" "time" + meshconditions "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions" stdio "git.novox.be/novox/mesh-sdk/go" "git.novox.be/novox/mesh-sdk/go/views" ) @@ -58,7 +59,7 @@ func main() { Ask: func(key string, body any) (json.RawMessage, error) { return stdio.Ask(key, body) }, Publish: stdio.SeatPublish} w, err := views.NewStdioWriter(views.WriterConfig[Finding, FindingCleared, FindingsStated, FindingsAsked]{ - Module: Module, State: stdio.State(FindingsState), Observe: h.Observe, Logf: logf}) + Module: Module, State: stdio.State(FindingsState), Observe: h.Observe, Asked: meshconditions.SubjectFindingsAsked, Logf: logf}) if err != nil { logf("%v", err) os.Exit(1) diff --git a/modules/mesh-healers/cmd/mesh-healers/whole_integration_test.go b/modules/mesh-healers/cmd/mesh-healers/whole_integration_test.go index 58cf1869e..cf6173115 100644 --- a/modules/mesh-healers/cmd/mesh-healers/whole_integration_test.go +++ b/modules/mesh-healers/cmd/mesh-healers/whole_integration_test.go @@ -30,7 +30,6 @@ import ( "github.com/nats-io/nats.go/jetstream" "git.novox.be/novox/mesh-sdk/go/testbus" - "git.novox.be/novox/mesh-sdk/go/views" ) type wire struct { @@ -390,7 +389,7 @@ func TestTheHealersWholeHearTheKeeperAndPassOverWhatEnded(t *testing.T) { // The runtime's consumer holds an event until the bundle subscribes: delivered once it hears them. eventually(t, "the healers hearing the keeper's conditions", func() bool { return p.hears(RaisedEvent) && p.hears(ChangedEvent) }) // The writer hears the keeper's asks for findings, and states at its start the findings it observes: none. - eventually(t, "the writer hearing findings-asked", func() bool { return p.hears(views.FindingsAskedEvent) }) + eventually(t, "the writer hearing findings-asked", func() bool { return p.hears("mesh-conditions.findings-asked") }) if msg, err := stated.NextMsg(10 * time.Second); err != nil || !strings.Contains(string(msg.Data), `"findings":[]`) { t.Errorf("findings-stated at the start: %v", err) } diff --git a/modules/mesh-self-check/cmd/mesh-self-check/main.go b/modules/mesh-self-check/cmd/mesh-self-check/main.go index 985011397..75ef37b47 100644 --- a/modules/mesh-self-check/cmd/mesh-self-check/main.go +++ b/modules/mesh-self-check/cmd/mesh-self-check/main.go @@ -17,6 +17,7 @@ import ( stdio "git.novox.be/novox/mesh-sdk/go" "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient" + meshconditions "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions" "git.novox.be/novox/mesh-sdk/go/views" ) @@ -69,7 +70,7 @@ func NewChecker() *Checker { Ask: func(key string, body any) (json.RawMessage, error) { return stdio.Ask(key, body) }, Publish: stdio.SeatPublish} w, err := views.NewStdioWriter(views.WriterConfig[Finding, FindingCleared, FindingsStated, FindingsAsked]{ - Module: Module, State: stdio.State(FindingsState), Observe: c.Observe, Logf: logf}) + Module: Module, State: stdio.State(FindingsState), Observe: c.Observe, Asked: meshconditions.SubjectFindingsAsked, Logf: logf}) if err != nil { logf("%v", err) os.Exit(1) @@ -83,7 +84,7 @@ func NewChecker() *Checker { // its owner's read tool, then followed by the owner's events. A first view unanswered past its bound is a finding of the // self-check's own (first-view-unanswered), written into its state findings. func newViews(w *FindingsWriter) *views.Reader { - r := &views.Reader{Module: Module, Logf: logf, Findings: views.WriterFindings{Writer: w}, Acts: meshhandactsclient.Recorder{Ask: stdio.Ask}} + r := &views.Reader{Module: Module, Logf: logf, Findings: w, Acts: meshhandactsclient.Recorder{Ask: stdio.Ask}} r.Follow(assignerModule, placing.StateAssignments, AssignmentsTool) r.Follow(assignerModule, placing.StateSeatHolders, SeatHoldersTool) r.Follow(indexerModule, "modules", ModulesTool) diff --git a/modules/mesh-self-check/cmd/mesh-self-check/selfcheck_test.go b/modules/mesh-self-check/cmd/mesh-self-check/selfcheck_test.go index 04922b800..74b4984d3 100644 --- a/modules/mesh-self-check/cmd/mesh-self-check/selfcheck_test.go +++ b/modules/mesh-self-check/cmd/mesh-self-check/selfcheck_test.go @@ -127,7 +127,7 @@ func checker(store *memStore, registry ...Probe) (*Checker, *[]string) { return nil }} w, err := views.NewWriter(views.WriterConfig[Finding, FindingCleared, FindingsStated, FindingsAsked]{ - Module: Module, Node: "novox", State: findingState{store}, Observe: c.Observe, Logf: c.Logf, Now: c.Now, + Module: Module, Node: "novox", Asked: "mesh.seat.mesh-conditions.event.findings-asked", State: findingState{store}, Observe: c.Observe, Logf: c.Logf, Now: c.Now, Publish: func(_ context.Context, subject string, _ []byte, _ string) error { store.events = append(store.events, subject) return nil