From 5d1456257c11649701367b206343a268488e1c13 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 12 Nov 2026 01:00:59 +0100 Subject: [PATCH] Fix 9.3: the nats keeper's process serves its four mesh-broker snapshot verbs, beside its bus Builds: design 47 G A-109, A-110, A-115 (serves is a field of the process itself) Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h --- modules/nats/cmd/nats-tools/manifest_test.go | 33 ++++++++++++++++++++ modules/nats/module.json | 6 ++++ 2 files changed, 39 insertions(+) diff --git a/modules/nats/cmd/nats-tools/manifest_test.go b/modules/nats/cmd/nats-tools/manifest_test.go index 5065ebf0e..998cb2a9f 100644 --- a/modules/nats/cmd/nats-tools/manifest_test.go +++ b/modules/nats/cmd/nats-tools/manifest_test.go @@ -282,3 +282,36 @@ func TestTheBussManifestMountsItsProgramsIntoTheUpstreamImage(t *testing.T) { } } } + +// The keeper's process declares the four verbs of the seat mesh-broker it answers itself, beside its `bus` (design 47 G +// A-109, A-110, A-115), and exactly the verbs its code answers. +func TestTheKeepersProcessServesTheVerbsItAnswers(t *testing.T) { + raw, err := os.ReadFile("../../module.json") + if err != nil { + t.Fatal(err) + } + var m struct { + Resources []struct { + ID string `json:"id"` + Serves []string `json:"serves"` + } `json:"resources"` + } + if err := json.Unmarshal(raw, &m); err != nil { + t.Fatal(err) + } + var served []string + for _, r := range m.Resources { + if r.ID == "keeper" { + served = r.Serves + } + } + var want []string + for verb := range snapshotAnswers(nil, nil, nil) { + want = append(want, "seat:mesh-broker."+verb) + } + slices.Sort(want) + slices.Sort(served) + if !slices.Equal(served, want) { + t.Errorf("the keeper process serves %v; its code answers %v", served, want) + } +} diff --git a/modules/nats/module.json b/modules/nats/module.json index 87e0071f0..7acc5ebdd 100644 --- a/modules/nats/module.json +++ b/modules/nats/module.json @@ -276,6 +276,12 @@ "MESH_NATS_SNAPSHOT_KEEP_DAYS": "90", "MESH_NATS_SNAPSHOTS_DIR": "${dir:keeper-state}" }, + "serves": [ + "seat:mesh-broker.snapshot-get", + "seat:mesh-broker.snapshot-restore", + "seat:mesh-broker.snapshot-restore-cancel", + "seat:mesh-broker.snapshot-remove" + ], "bus": { "state": [ "asked",