SD-M2b: mesh-broker whole: its eight verbs, nine events and the bus-state binding (design 25 § 12.3, ADR 0595 §5, §6)

Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
2026-11-04 11:50:54 +01:00
parent 2fade8d603
commit 4f37cc2db9
3 changed files with 800 additions and 0 deletions
+213
View File
@@ -0,0 +1,213 @@
[
{
"name": "created on the seat's subject",
"of": "event:created",
"subject": "mesh.seat.mesh-broker.event.created",
"given": {
"module": "mesh-knowledge",
"local-name": "ledger",
"storage-type": "ledger",
"template": "ledger",
"bus-name": "mesh-knowledge_ledger",
"asked": {
"max-mib": 64
},
"held": {
"max-mib": 64
},
"fill": {
"count": 10,
"bytes": 2048,
"cap": 67108864
}
}
},
{
"name": "refused on the seat's subject",
"of": "event:refused",
"subject": "mesh.seat.mesh-broker.event.refused",
"given": {
"module": "mesh-knowledge",
"local-name": "ledger",
"storage-type": "ledger",
"template": "ledger",
"bus-name": "mesh-knowledge_ledger",
"asked": {
"max-mib": 64
},
"held": {
"max-mib": 64
},
"fill": {
"count": 10,
"bytes": 2048,
"cap": 67108864
},
"why": "the bus refused it"
}
},
{
"name": "drifted on the seat's subject",
"of": "event:drifted",
"subject": "mesh.seat.mesh-broker.event.drifted",
"given": {
"module": "mesh-knowledge",
"local-name": "ledger",
"storage-type": "ledger",
"template": "ledger",
"bus-name": "mesh-knowledge_ledger",
"asked": {
"max-mib": 64
},
"held": {
"max-mib": 64
},
"fill": {
"count": 10,
"bytes": 2048,
"cap": 67108864
},
"why": "the bus refused it"
}
},
{
"name": "drift-cleared on the seat's subject",
"of": "event:drift-cleared",
"subject": "mesh.seat.mesh-broker.event.drift-cleared",
"given": {
"module": "mesh-knowledge",
"local-name": "ledger",
"storage-type": "ledger",
"template": "ledger",
"bus-name": "mesh-knowledge_ledger",
"asked": {
"max-mib": 64
},
"held": {
"max-mib": 64
},
"fill": {
"count": 10,
"bytes": 2048,
"cap": 67108864
}
}
},
{
"name": "full on the seat's subject",
"of": "event:full",
"subject": "mesh.seat.mesh-broker.event.full",
"given": {
"module": "mesh-knowledge",
"local-name": "ledger",
"storage-type": "ledger",
"template": "ledger",
"bus-name": "mesh-knowledge_ledger",
"asked": {
"max-mib": 64
},
"held": {
"max-mib": 64
},
"fill": {
"count": 10,
"bytes": 2048,
"cap": 67108864
}
}
},
{
"name": "full-cleared on the seat's subject",
"of": "event:full-cleared",
"subject": "mesh.seat.mesh-broker.event.full-cleared",
"given": {
"module": "mesh-knowledge",
"local-name": "ledger",
"storage-type": "ledger",
"template": "ledger",
"bus-name": "mesh-knowledge_ledger",
"asked": {
"max-mib": 64
},
"held": {
"max-mib": 64
},
"fill": {
"count": 10,
"bytes": 2048,
"cap": 67108864
}
}
},
{
"name": "orphaned on the seat's subject",
"of": "event:orphaned",
"subject": "mesh.seat.mesh-broker.event.orphaned",
"given": {
"module": "mesh-knowledge",
"local-name": "ledger",
"storage-type": "ledger",
"template": "ledger",
"bus-name": "mesh-knowledge_ledger",
"asked": {
"max-mib": 64
},
"held": {
"max-mib": 64
},
"fill": {
"count": 10,
"bytes": 2048,
"cap": 67108864
}
}
},
{
"name": "recreated on the seat's subject",
"of": "event:recreated",
"subject": "mesh.seat.mesh-broker.event.recreated",
"given": {
"module": "mesh-knowledge",
"local-name": "ledger",
"storage-type": "ledger",
"template": "ledger",
"bus-name": "mesh-knowledge_ledger",
"asked": {
"max-mib": 64
},
"held": {
"max-mib": 64
},
"fill": {
"count": 10,
"bytes": 2048,
"cap": 67108864
},
"why": "the bus refused it"
}
},
{
"name": "dropped on the seat's subject",
"of": "event:dropped",
"subject": "mesh.seat.mesh-broker.event.dropped",
"given": {
"module": "mesh-knowledge",
"local-name": "ledger",
"storage-type": "ledger",
"template": "ledger",
"bus-name": "mesh-knowledge_ledger",
"asked": {
"max-mib": 64
},
"held": {
"max-mib": 64
},
"fill": {
"count": 10,
"bytes": 2048,
"cap": 67108864
},
"why": "the bus refused it"
}
}
]
+51
View File
@@ -0,0 +1,51 @@
[
{
"name": "create one entry",
"of": "verb:create.input",
"given": {
"module": "mesh-knowledge",
"local-name": "ledger",
"storage-type": "ledger",
"template": "ledger",
"options": {
"max-mib": 64
}
}
},
{
"name": "drop on the operator's warrant",
"of": "verb:drop.input",
"given": {
"module": "mesh-knowledge",
"local-name": "old",
"warrant": "w-1",
"why": "the operator approved the drop"
}
},
{
"name": "list answers every entry",
"of": "verb:list.answer",
"given": {
"entries": [
{
"module": "mesh-knowledge",
"local-name": "ledger",
"storage-type": "ledger",
"template": "ledger",
"options": {
"max-mib": 64
},
"bus-name": "mesh-knowledge_ledger",
"settings": {
"max-mib": 64
},
"fill": {
"count": 10,
"bytes": 2048,
"cap": 67108864
}
}
]
}
}
]
+536
View File
@@ -0,0 +1,536 @@
{
"format": 1,
"seat": "mesh-broker",
"scope": "mesh",
"grain": "whole",
"decision": "novox/hq ADR 0079; novox/hq ADR 0595",
"delivers": "mesh-bus",
"description": "The mesh's bus, and the bus state modules ask of it in requires (design 25 § 12). create, apply, recreate and drop are granted to the bus module's own credential alone.",
"verbs": [
{
"name": "list",
"description": "Every entry the bus module created, its template, its settings and its fill against its cap.",
"callers": "any caller whose role grants it",
"input": {
"type": "object",
"properties": {
"module": {
"type": "string",
"description": "one module (optional)"
}
}
},
"answer": {
"type": "object",
"properties": {
"entries": {
"type": "array",
"items": {
"$ref": "#/defs/Held"
},
"description": "every entry"
}
},
"required": [
"entries"
]
}
},
{
"name": "show",
"description": "One entry, its template, settings and fill.",
"callers": "any caller whose role grants it",
"input": {
"$ref": "#/defs/Named"
},
"answer": {
"$ref": "#/defs/Held"
}
},
{
"name": "check",
"description": "Compare what the bus holds with what was asked, entry by entry; a difference that only grows is said as such.",
"callers": "any caller whose role grants it",
"input": {
"type": "object",
"properties": {
"module": {
"type": "string",
"description": "one module (optional)"
}
}
},
"answer": {
"type": "object",
"properties": {
"differences": {
"type": "array",
"items": {
"type": "object",
"properties": {
"module": {
"type": "string",
"description": "the module"
},
"local-name": {
"type": "string",
"description": "the entry"
},
"asked": {
"type": "object",
"description": "asked"
},
"held": {
"type": "object",
"description": "held"
},
"grows": {
"type": "boolean",
"description": "the difference only grows: apply may act on it"
}
},
"required": [
"module",
"local-name"
]
},
"description": "every difference"
}
},
"required": [
"differences"
]
}
},
{
"name": "orphans",
"description": "Entries the bus holds that no manifest asks for; never one whose manifest the judge refused or outgrew, nor one of the foundation's old sections.",
"callers": "any caller whose role grants it",
"input": {
"type": "object",
"properties": {},
"description": "no arguments"
},
"answer": {
"type": "object",
"properties": {
"entries": {
"type": "array",
"items": {
"$ref": "#/defs/Held"
},
"description": "every orphan"
}
},
"required": [
"entries"
]
}
},
{
"name": "create",
"description": "Create one entry now.",
"callers": "the bus module's own process only",
"input": {
"$ref": "#/defs/Entry"
},
"answer": {
"$ref": "#/defs/Held"
}
},
{
"name": "apply",
"description": "Apply a difference that only grows: a larger cap, a longer age.",
"callers": "the bus module's own process only",
"input": {
"$ref": "#/defs/Named"
},
"answer": {
"$ref": "#/defs/Held"
}
},
{
"name": "recreate",
"description": "Rebuild an entry whose settings differ in a way that cannot grow, from its data where the storage type allows, after a stream snapshot.",
"callers": "the bus module's process, on the operator's warrant",
"input": {
"$ref": "#/defs/Warranted"
},
"answer": {
"$ref": "#/defs/Held"
}
},
{
"name": "drop",
"description": "Remove one orphan, after a stream snapshot.",
"callers": "the bus module's process, on the operator's warrant",
"input": {
"$ref": "#/defs/Warranted"
},
"answer": {
"type": "object",
"properties": {
"dropped": {
"type": "boolean",
"description": "it is gone"
},
"snapshot": {
"type": "string",
"description": "the snapshot taken first"
}
},
"required": [
"dropped"
]
}
}
],
"events": [
{
"name": "created",
"body": {
"$ref": "#/defs/Said"
}
},
{
"name": "refused",
"body": {
"$ref": "#/defs/Said"
}
},
{
"name": "drifted",
"body": {
"$ref": "#/defs/Said"
}
},
{
"name": "drift-cleared",
"body": {
"$ref": "#/defs/Said"
}
},
{
"name": "full",
"body": {
"$ref": "#/defs/Said"
}
},
{
"name": "full-cleared",
"body": {
"$ref": "#/defs/Said"
}
},
{
"name": "orphaned",
"body": {
"$ref": "#/defs/Said"
}
},
{
"name": "recreated",
"body": {
"$ref": "#/defs/Said"
}
},
{
"name": "dropped",
"body": {
"$ref": "#/defs/Said"
}
}
],
"family": {
"name": "mesh-broker.events",
"max-age-days": 30,
"max-mib": 256
},
"provisions": [
{
"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)"
}
}
],
"defs": {
"Entry": {
"type": "object",
"properties": {
"module": {
"type": "string",
"description": "the module asking it"
},
"local-name": {
"type": "string",
"description": "its local name in the module's manifest"
},
"storage-type": {
"type": "string",
"enum": [
"stream",
"key-value",
"object-store",
"ledger"
],
"description": "how the bus keeps it"
},
"template": {
"type": "string",
"enum": [
"state",
"events",
"work-queue",
"log",
"objects",
"ledger",
""
],
"description": "its template; empty for a configuration of its own"
},
"options": {
"type": "object",
"description": "the template's options the module set, within their bounds"
},
"configuration": {
"type": "object",
"description": "its own configuration, where no template fits"
}
},
"required": [
"module",
"local-name",
"storage-type"
],
"description": "one piece of bus state as a manifest asks it"
},
"Fill": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"description": "messages, keys or objects held"
},
"bytes": {
"type": "integer",
"description": "bytes held"
},
"cap": {
"type": "integer",
"description": "its cap in bytes"
}
},
"required": [
"count",
"bytes",
"cap"
]
},
"Held": {
"type": "object",
"properties": {
"module": {
"type": "string",
"description": "the module asking it"
},
"local-name": {
"type": "string",
"description": "its local name in the module's manifest"
},
"storage-type": {
"type": "string",
"enum": [
"stream",
"key-value",
"object-store",
"ledger"
],
"description": "how the bus keeps it"
},
"template": {
"type": "string",
"enum": [
"state",
"events",
"work-queue",
"log",
"objects",
"ledger",
""
],
"description": "its template; empty for a configuration of its own"
},
"options": {
"type": "object",
"description": "the template's options the module set, within their bounds"
},
"configuration": {
"type": "object",
"description": "its own configuration, where no template fits"
},
"bus-name": {
"type": "string",
"description": "its name on the bus, <module>_<local name>"
},
"settings": {
"type": "object",
"description": "the settings the bus holds"
},
"fill": {
"$ref": "#/defs/Fill"
}
},
"required": [
"module",
"local-name",
"storage-type",
"bus-name"
],
"description": "one entry as the bus holds it"
},
"Said": {
"type": "object",
"properties": {
"module": {
"type": "string",
"description": "the module asking it"
},
"local-name": {
"type": "string",
"description": "its local name in the module's manifest"
},
"storage-type": {
"type": "string",
"enum": [
"stream",
"key-value",
"object-store",
"ledger"
],
"description": "how the bus keeps it"
},
"template": {
"type": "string",
"enum": [
"state",
"events",
"work-queue",
"log",
"objects",
"ledger",
""
],
"description": "its template; empty for a configuration of its own"
},
"options": {
"type": "object",
"description": "the template's options the module set, within their bounds"
},
"configuration": {
"type": "object",
"description": "its own configuration, where no template fits"
},
"bus-name": {
"type": "string",
"description": "its name on the bus"
},
"asked": {
"type": "object",
"description": "the settings asked"
},
"held": {
"type": "object",
"description": "the settings held"
},
"why": {
"type": "string",
"description": "why: a refusal's cause, a drift's difference, a drop's or recreate's reason"
},
"fill": {
"$ref": "#/defs/Fill"
},
"snapshot": {
"type": "string",
"description": "the stream snapshot taken before a recreate or drop"
}
},
"required": [
"module",
"local-name",
"bus-name"
],
"description": "the body of every event of the seat"
},
"Named": {
"type": "object",
"properties": {
"module": {
"type": "string",
"description": "the module"
},
"local-name": {
"type": "string",
"description": "the entry's local name"
}
},
"required": [
"module",
"local-name"
]
},
"Warranted": {
"type": "object",
"properties": {
"module": {
"type": "string",
"description": "the module"
},
"local-name": {
"type": "string",
"description": "the entry's local name"
},
"warrant": {
"type": "string",
"description": "the operator's warrant, as the operator channel decided it (ADR 0259 §6)"
},
"why": {
"type": "string",
"description": "why, kept in the record"
}
},
"required": [
"module",
"local-name",
"warrant",
"why"
]
}
}
}