From f3a9cd17d6653ba91f6fe7fd19a2e293ae1848c6 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 4 Nov 2026 12:35:30 +0100 Subject: [PATCH] SD-M2b: mesh-broker's events carry the binding and the verdict's revision (the lead's ruling, 12:4x) The binding a module receives is one named type, Binding, the provision's form and each event's binding. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig --- go/seats/meshbroker/contract.go | 28 +++++++++------ seats/mesh-broker/seat.json | 64 +++++++++++++++++++-------------- ts/src/mesh-broker.ts | 26 ++++++++------ 3 files changed, 70 insertions(+), 48 deletions(-) diff --git a/go/seats/meshbroker/contract.go b/go/seats/meshbroker/contract.go index 2a95c36..374d7de 100644 --- a/go/seats/meshbroker/contract.go +++ b/go/seats/meshbroker/contract.go @@ -73,6 +73,18 @@ const SubjectRecreated = "mesh.seat.mesh-broker.event.recreated" // SubjectDropped is where dropped is published. const SubjectDropped = "mesh.seat.mesh-broker.event.dropped" +// Binding is the binding a module receives in its membership for one entry (ADR 0595 §1, §7). +type Binding struct { + // the entry's name on the bus + BusName string `json:"bus-name"` + // how the bus keeps it + StorageType string `json:"storage-type"` + // its subjects, for a stream + Subjects []string `json:"subjects,omitempty"` + // its template + Template string `json:"template,omitempty"` +} + // Entry is one piece of bus state as a manifest asks it. type Entry struct { // its own configuration, where no template fits @@ -131,7 +143,8 @@ type Named struct { // Said is the body of every event of the seat. type Said struct { // the settings asked - Asked map[string]any `json:"asked,omitempty"` + Asked map[string]any `json:"asked,omitempty"` + Binding *Binding `json:"binding,omitempty"` // its name on the bus BusName string `json:"bus-name"` // its own configuration, where no template fits @@ -145,6 +158,8 @@ type Said struct { Module string `json:"module"` // the template's options the module set, within their bounds Options map[string]any `json:"options,omitempty"` + // the indexer's revision of the verdict the bus module acted on (ADR 0622 §2), so a reader orders what it hears + Revision int64 `json:"revision,omitempty"` // the stream snapshot taken before a recreate or drop Snapshot string `json:"snapshot,omitempty"` // how the bus keeps it @@ -278,13 +293,4 @@ type RecreatedEvent = Said type DroppedEvent = Said // BusStateForm is the form of the provision bus-state. -type BusStateForm struct { - // the entry's name on the bus - BusName string `json:"bus-name"` - // how the bus keeps it - StorageType string `json:"storage-type"` - // its subjects, for a stream - Subjects []string `json:"subjects,omitempty"` - // its template - Template string `json:"template,omitempty"` -} +type BusStateForm = Binding diff --git a/seats/mesh-broker/seat.json b/seats/mesh-broker/seat.json index 1aa166f..d551eb7 100644 --- a/seats/mesh-broker/seat.json +++ b/seats/mesh-broker/seat.json @@ -258,33 +258,7 @@ { "name": "bus-state", "form": { - "type": "object", - "properties": { - "bus-name": { - "type": "string", - "description": "the entry's name on the bus" - }, - "storage-type": { - "type": "string", - "description": "how the bus keeps it" - }, - "template": { - "type": "string", - "description": "its template" - }, - "subjects": { - "type": "array", - "items": { - "type": "string" - }, - "description": "its subjects, for a stream" - } - }, - "required": [ - "bus-name", - "storage-type" - ], - "description": "the binding a module receives in its membership for one entry (ADR 0595 §1, §7)" + "$ref": "#/defs/Binding" } } ], @@ -487,6 +461,13 @@ "snapshot": { "type": "string", "description": "the stream snapshot taken before a recreate or drop" + }, + "binding": { + "$ref": "#/defs/Binding" + }, + "revision": { + "type": "integer", + "description": "the indexer's revision of the verdict the bus module acted on (ADR 0622 §2), so a reader orders what it hears" } }, "required": [ @@ -539,6 +520,35 @@ "warrant", "why" ] + }, + "Binding": { + "type": "object", + "properties": { + "bus-name": { + "type": "string", + "description": "the entry's name on the bus" + }, + "storage-type": { + "type": "string", + "description": "how the bus keeps it" + }, + "template": { + "type": "string", + "description": "its template" + }, + "subjects": { + "type": "array", + "items": { + "type": "string" + }, + "description": "its subjects, for a stream" + } + }, + "required": [ + "bus-name", + "storage-type" + ], + "description": "the binding a module receives in its membership for one entry (ADR 0595 §1, §7)" } } } diff --git a/ts/src/mesh-broker.ts b/ts/src/mesh-broker.ts index 5f94f67..01c8c50 100644 --- a/ts/src/mesh-broker.ts +++ b/ts/src/mesh-broker.ts @@ -47,6 +47,18 @@ export const recreatedSubject = "mesh.seat.mesh-broker.event.recreated"; export const droppedSubject = "mesh.seat.mesh-broker.event.dropped"; +/** the binding a module receives in its membership for one entry (ADR 0595 §1, §7) */ +export interface Binding { + /** the entry's name on the bus */ + "bus-name": string; + /** how the bus keeps it */ + "storage-type": string; + /** its subjects, for a stream */ + "subjects"?: string[]; + /** its template */ + "template"?: string; +} + /** one piece of bus state as a manifest asks it */ export interface Entry { /** its own configuration, where no template fits */ @@ -104,6 +116,7 @@ export interface Named { export interface Said { /** the settings asked */ "asked"?: Record; + "binding"?: Binding; /** its name on the bus */ "bus-name": string; /** its own configuration, where no template fits */ @@ -117,6 +130,8 @@ export interface Said { "module": string; /** the template's options the module set, within their bounds */ "options"?: Record; + /** the indexer's revision of the verdict the bus module acted on (ADR 0622 §2), so a reader orders what it hears */ + "revision"?: number; /** the stream snapshot taken before a recreate or drop */ "snapshot"?: string; /** how the bus keeps it */ @@ -248,14 +263,5 @@ export type RecreatedEvent = Said; export type DroppedEvent = Said; /** is the form of the provision bus-state. */ -export interface BusStateForm { - /** the entry's name on the bus */ - "bus-name": string; - /** how the bus keeps it */ - "storage-type": string; - /** its subjects, for a stream */ - "subjects"?: string[]; - /** its template */ - "template"?: string; -} +export type BusStateForm = Binding;