mesh/delivery-group group fix/270-the-bus-module-says-every-users-slow-consumer rejected: a member's own check failed
mesh/merge-gate head fd9308d3287e merged into trunk 3479a35462b2 — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head fd9308d3287e merged into trunk 3479a35462b2 — pass: its merge-check.sh passed
mesh/delivery superseded: a newer head of the same pull request
The controller heard a slow consumer only on its own connection: the server says another user's only in its record of closed connections. The bus module now says that record as events; the watchdogs read the last hour back on every tick and raise one condition per user and kind, naming the module and machine. The module check lets the bus module emit, since its tool runner publishes.
35 lines
1.2 KiB
Go
35 lines
1.2 KiB
Go
package broker
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
)
|
|
|
|
// **The bus module's watch speaks through the runtime that carries it** (novox/hq ADR 0357): the node's
|
|
// runtime is granted the events the bus module declares, under the module's name, while the bus's own
|
|
// account keeps the snapshot API and nothing else (ADR 0235).
|
|
func TestTheRuntimeCarryingTheBusModuleMayPublishItsEventsAndTheBussAccountMayNot(t *testing.T) {
|
|
events := []string{"bus.slow-consumer", "bus.connection-closed"}
|
|
runtime := Principal{Kind: KindNodeTools, Node: "anchor", Module: RuntimeModule,
|
|
Carries: []Declared{{Module: "nats", Emits: events}}}
|
|
p, err := PermissionsFor(runtime)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, e := range events {
|
|
if !slices.Contains(p.Publish, "mesh.mod.nats.event."+e) {
|
|
t.Errorf("the runtime carrying the bus module may not publish %s: %v", e, p.Publish)
|
|
}
|
|
}
|
|
account := Principal{Kind: KindModule, Node: "anchor", Module: "nats", Emits: events, SnapshotsTheBus: true}
|
|
a, err := PermissionsFor(account)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, s := range a.Publish {
|
|
if s == "mesh.mod.nats.event.bus.slow-consumer" || s == "mesh.mod.nats.event.bus.connection-closed" {
|
|
t.Errorf("the bus's own account is granted %s", s)
|
|
}
|
|
}
|
|
}
|