A-340 process-bus-consumes: a process's bus reads the events it hears under consumes
mesh/delivery merged: source.main moved to novox/mesh-sdk@b9915abf5128
mesh/delivery-group group feat/47-G-join11 merged: every member is merged
mesh/check checking f30dee54f3df on 93e0a7b50d90

catalogue.ProcessBus gains Consumes, so the strict reader takes a process's bus naming what its module consumes; the judge and the grants part read it.

Builds: design 47 G A-340, A-339

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-13 09:16:31 +01:00
parent b16298c757
commit f30dee54f3
2 changed files with 10 additions and 1 deletions
+4 -1
View File
@@ -19,6 +19,9 @@ type ProcessBus struct {
// Emits are the events this process emits, named locally, as the module's own Emits names them
// (EmitsAll): a process emits only what its module may emit as a whole.
Emits []string `json:"emits,omitempty"`
// Consumes are the events this process hears, each as its module's `consumes` names it: only an event its module
// consumes (design 47 G A-340, after design 42 zfs-owns-zfs V5 and G1).
Consumes []string `json:"consumes,omitempty"`
// Queues are the module's own work-queue streams (ADR 0436 §6) this process consumes.
Queues []string `json:"queues,omitempty"`
// State is the module's own state, by local name, this process reads and writes.
@@ -99,7 +102,7 @@ func (b *ProcessBus) UnmarshalJSON(raw []byte) error {
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&p); err != nil {
return fmt.Errorf("a process's bus is {emits, queues, state, asks, invokes, removes, keeps}; `serves` is a field of the process beside its bus (design 47 G A-127): %w", typedUnknown(err))
return fmt.Errorf("a process's bus is {emits, consumes, queues, state, asks, invokes, removes, keeps}; `serves` is a field of the process beside its bus (design 47 G A-127): %w", typedUnknown(err))
}
*b = ProcessBus(p)
return nil
+6
View File
@@ -25,6 +25,12 @@ func TestProcessServesIsReadBesideTheBusAndRefusedInsideIt(t *testing.T) {
if err := json.Unmarshal([]byte(`{"holds":["x"]}`), &ProcessBus{}); err == nil {
t.Error("an unknown key was accepted")
}
// Design 47 G A-340: a process's bus names the events it hears under `consumes`.
var heard ProcessBus
if err := json.Unmarshal([]byte(`{"consumes":["mesh-conditions.findings-asked"]}`), &heard); err != nil ||
!strSliceEqual(heard.Consumes, []string{"mesh-conditions.findings-asked"}) {
t.Errorf("a bus's consumes read as %v (%v)", heard.Consumes, err)
}
m := Manifest{Module: "nats", Resources: []map[string]any{
{"id": "keeper", "type": "process", "serves": []any{"seat:mesh-broker.snapshot-get", "seat:mesh-broker.list"},
"bus": map[string]any{"keeps": true}},