From a89aaf56447fe46b2f063875fe04b574728f8da3 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 5 Nov 2026 17:30:39 +0100 Subject: [PATCH] =?UTF-8?q?nats=20and=20mesh-config:=20their=20event=20str?= =?UTF-8?q?eams=20keep=20their=20history,=20the=20bus's=20predefined=20for?= =?UTF-8?q?m=20of=20an=20event=20family,=20not=20an=20age-limited=20stream?= =?UTF-8?q?=20of=20their=20own=20(V1;=20ADR=200592=20=C2=A76;=20issue=2019?= =?UTF-8?q?66)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i --- modules/mesh-config/README.md | 2 +- modules/mesh-config/cmd/mesh-config/manifest_test.go | 4 ++-- modules/mesh-config/cmd/mesh-config/renames.go | 2 +- modules/mesh-config/module.json | 2 +- modules/nats/cmd/nats-tools/keep.go | 2 +- modules/nats/cmd/nats-tools/main.go | 2 +- modules/nats/cmd/nats-tools/manifest_test.go | 8 +++++--- modules/nats/module.json | 2 +- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/mesh-config/README.md b/modules/mesh-config/README.md index b3ebf2b9a..071c64e5d 100644 --- a/modules/mesh-config/README.md +++ b/modules/mesh-config/README.md @@ -74,7 +74,7 @@ them, newest first; with `proposal`, one read whole, with whether the router's a said per node. State `retiring`; the tool `config_retiring` lists, asks again and cancels. - Findings (state `findings`, read by the condition keeper): `rename-refused`, `rename-window-held` and `retirement-held` (seven days, naming the node), `retiring-unanswered` (asked twice). -- The events `renamed`, `retiring` and `retired` are carried by the stream `config-events`, kept seven days. +- The events `renamed`, `retiring` and `retired` are carried by the stream `config-events`, which keeps its history (the bus refuses a new event when it is full). ## Files it does not know diff --git a/modules/mesh-config/cmd/mesh-config/manifest_test.go b/modules/mesh-config/cmd/mesh-config/manifest_test.go index 0950206f0..a6b5331b0 100644 --- a/modules/mesh-config/cmd/mesh-config/manifest_test.go +++ b/modules/mesh-config/cmd/mesh-config/manifest_test.go @@ -63,9 +63,9 @@ func TestEveryStateAndActHasItsTool(t *testing.T) { if !slices.Equal(dm.Emits, []string{ConfigChanged}) { t.Errorf("emits %v, want only %s: the stream carries the others", dm.Emits, ConfigChanged) } - if len(dm.Streams) != 1 || dm.Streams[0].Name != StreamName || dm.Streams[0].Days() != 7 || !dm.Streams[0].Carries(EventRenamed) || + if len(dm.Streams) != 1 || dm.Streams[0].Name != StreamName || !dm.Streams[0].KeepsHistory() || !dm.Streams[0].Carries(EventRenamed) || !dm.Streams[0].Carries(EventRetiring) || !dm.Streams[0].Carries(EventRetired) || dm.Streams[0].Carries(ConfigChanged) { - t.Errorf("streams %+v: want %s, seven days, carrying renamed, retiring and retired but not config-changed", dm.Streams, StreamName) + t.Errorf("streams %+v: want %s, keeping its history, carrying renamed, retiring and retired but not config-changed", dm.Streams, StreamName) } } for _, verb := range SeatVerbs { diff --git a/modules/mesh-config/cmd/mesh-config/renames.go b/modules/mesh-config/cmd/mesh-config/renames.go index e82958fb9..a22de1506 100644 --- a/modules/mesh-config/cmd/mesh-config/renames.go +++ b/modules/mesh-config/cmd/mesh-config/renames.go @@ -21,7 +21,7 @@ import ( const ( RenamesState = "renames" // EventRenamed is `renamed`, EventRetiring `retiring` and EventRetired `retired`, the family `config.events` of the - // seat's definition (design 26), under the holder's subjects: each carried by the stream StreamName, kept seven days. + // seat's definition (design 26), under the holder's subjects: each carried by the stream StreamName, which keeps its history. EventRenamed = "renamed" EventRetiring = "retiring" EventRetired = "retired" diff --git a/modules/mesh-config/module.json b/modules/mesh-config/module.json index c92985611..91df05da2 100644 --- a/modules/mesh-config/module.json +++ b/modules/mesh-config/module.json @@ -122,7 +122,7 @@ "retiring", "retired" ], - "max-age-days": 7 + "retention": "history" } ] } diff --git a/modules/nats/cmd/nats-tools/keep.go b/modules/nats/cmd/nats-tools/keep.go index f1a529cf5..6576c1284 100644 --- a/modules/nats/cmd/nats-tools/keep.go +++ b/modules/nats/cmd/nats-tools/keep.go @@ -112,7 +112,7 @@ func (s processStore) Create(state, key string, value []byte) (uint64, error) { // streamEmitter says an event of the seat mesh-broker, with the SDK's headers, under its one event id (the lead's ruling, // registry milestone, 13:0x; design 25 § 12.3): on the seat's own subject `mesh.seat.mesh-broker.event.`, which the // shared events stream keeps 7 days and every consumer of `mesh-broker.` hears, like any seat's event; then on the -// bus module's own stream (its old `streams` section, 30 days, 256 MiB), which its tool `history` reads. The seat's subject +// bus module's own stream (a stream that keeps its history, 256 MiB), which its tool `history` reads. The seat's subject // first: a reader hears it before the history holds it, never the other way round. It says it on s.Left (every subject // when nil) and leaves in s.Left what the bus did not take, so the keeper says that again with the same id and the bus // keeps it once (the two publishes are not one act: a failed second one is kept and said again, never silent). diff --git a/modules/nats/cmd/nats-tools/main.go b/modules/nats/cmd/nats-tools/main.go index 2c757f079..420d106a7 100644 --- a/modules/nats/cmd/nats-tools/main.go +++ b/modules/nats/cmd/nats-tools/main.go @@ -169,7 +169,7 @@ func main() { var ReadingVerbs = []string{"list", "show", "check", "orphans"} // Events are the seat mesh-broker's events (ADR 0595 §6, ADR 0620 §2): said on the seat's subjects on the shared events stream -// and kept 30 days on the bus module's own stream broker-events (BROKER_EVENTS), which `history` reads (keep.go). +// and kept in full on the bus module's own stream broker-events (BROKER_EVENTS), which `history` reads (keep.go). var Events = []string{"created", "refused", "drifted", "drift-cleared", "full", "full-cleared", "orphaned", "recreated", "dropped"} // allTools is every tool and seat verb this bundle serves. diff --git a/modules/nats/cmd/nats-tools/manifest_test.go b/modules/nats/cmd/nats-tools/manifest_test.go index f02e67307..b485cea3e 100644 --- a/modules/nats/cmd/nats-tools/manifest_test.go +++ b/modules/nats/cmd/nats-tools/manifest_test.go @@ -161,7 +161,8 @@ func TestTheBussManifestMountsItsProgramsIntoTheUpstreamImage(t *testing.T) { // The bus module provides bus state (design 25 § 12.2-12.3, ADR 0595 §4-§6; CAT-N1): its keeper is a process of // its own on its own account (own secret broker-keeper, ADR 0436 §1), creating only bus state; it hears the indexer's // manifest-accepted, keeps what it heard in its own old state `asked` (ADR 0595 §10) and the persons' requests in - // `requests`; its nine events are its own (ADR 0620 §2), on its own stream kept 30 days at 256 MiB; the seat's four + // `requests`; its nine events are its own (ADR 0620 §2), on its own stream that keeps its history (ADR 0592 §6, the manifest + // validator's predefined form) at 256 MiB; the seat's four // reading verbs are served, its four acting verbs are the keeper's own work and no other account's; its health is // the keeper's own tool, beside the server's tcp check. var nm struct { @@ -177,6 +178,7 @@ func TestTheBussManifestMountsItsProgramsIntoTheUpstreamImage(t *testing.T) { Name string `json:"name"` Events []string `json:"events"` MaxAgeDays int `json:"max-age-days"` + Retention string `json:"retention"` MaxMiB int `json:"max-mib"` } `json:"streams"` State []struct { @@ -205,8 +207,8 @@ func TestTheBussManifestMountsItsProgramsIntoTheUpstreamImage(t *testing.T) { t.Errorf("uses %v: the operator channel, for the warrant of recreate and drop", nm.Uses) } if len(nm.Streams) != 1 || nm.Streams[0].Name != "broker-events" || !slices.Equal(nm.Streams[0].Events, Events) || - nm.Streams[0].MaxAgeDays != 30 || nm.Streams[0].MaxMiB != 256 { - t.Errorf("streams are %+v: broker-events carrying %v, 30 days, 256 MiB", nm.Streams, Events) + nm.Streams[0].MaxAgeDays != 0 || nm.Streams[0].Retention != "history" || nm.Streams[0].MaxMiB != 256 { + t.Errorf("streams are %+v: broker-events carrying %v, keeping its history, 256 MiB", nm.Streams, Events) } for _, e := range Events { if slices.Contains(m.Emits, e) { diff --git a/modules/nats/module.json b/modules/nats/module.json index a3dc719f1..d39e9d45b 100644 --- a/modules/nats/module.json +++ b/modules/nats/module.json @@ -79,7 +79,7 @@ "recreated", "dropped" ], - "max-age-days": 30, + "retention": "history", "max-mib": 256 } ],