DLV-G1, DLV-W1: the grants part and the watchman hear mesh-broker's events on the seat's subject; the keeper is granted them

The lead's ruling of 13:0x (registry milestone): mesh-broker's events are mesh.seat.mesh-broker.event.<event> on the
shared events stream like every seat's. The grants part and the watchman consume mesh-broker.<event> and no longer hear
the bus module's own stream, which is its history for its tool. The keeper's process account is composed the seat's
event subjects, and the acknowledgement of a snapshot's chunks of each entry it keeps, which ADR 0626 §1 grants and the
composition lacked; a row holds it to no subscription of a restricted stream's subjects and no consumer of one.

Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
2026-11-04 13:05:27 +01:00
parent 20a4a79993
commit 8a78e00bb0
14 changed files with 105 additions and 55 deletions
@@ -1069,12 +1069,14 @@ func aLedgerIsWrittenByItsLedgerAccountAlone(t *testing.T) {
func theBusModulesProcessKeepsBusState(t *testing.T) {
r := Records{Nodes: []string{"a"}, Assigned: map[string][]Declared{"a": {
{Module: "node-tools", ToolRunner: true},
{Module: "nats", SnapshotsTheBus: true, Holds: []Seat{{Name: catalogue.BrokerSeat, Serves: BrokerVerbs()}},
{Module: "nats", SnapshotsTheBus: true, Holds: []Seat{{Name: catalogue.BrokerSeat, Serves: BrokerVerbs(),
Emits: []string{"created", "refused"}}},
Consumes: []string{"mesh-delivery-indexer.manifest-accepted"}, Uses: []Seat{{Name: "operator-channel", Accepts: []string{"condition"}, ByCaller: []string{"condition"}}},
Streams: []ModuleStream{{Module: "nats", Name: "BROKER_EVENTS", Events: []string{"created", "refused"}, MaxAgeDays: 30, MaxMiB: 256}},
Processes: []ProcessPrincipal{{Process: "keeper", State: []string{"asked"}, Keeps: true}, {Process: "other"},
{Process: "nats-tools", Tools: true, Removes: []string{catalogue.RemovesEngineActs}}}},
{Module: "mod-x", Processes: []ProcessPrincipal{{Process: "sneak", Keeps: true}}},
{Module: "mod-x", Processes: []ProcessPrincipal{{Process: "sneak", Keeps: true}},
Streams: []ModuleStream{{Module: "mod-x", Name: "SECRETS", Events: []string{"sealed"}, Restricted: true}}},
{Module: "admin-ish", Invokes: []string{"*"}},
}},
BusState: map[string][]catalogue.BusStateEntry{"mod-x": {
@@ -1132,11 +1134,39 @@ func theBusModulesProcessKeepsBusState(t *testing.T) {
t.Error("the bus module's process answers what it was asked")
}
for _, s := range []string{"$JS.API.CONSUMER.MSG.NEXT.EVENTS.a_nats_keeper", "$JS.ACK.EVENTS.a_nats_keeper.x",
"mesh.stream.nats.event.created", "mesh.seat.operator-channel.accept.condition.nats"} {
"mesh.stream.nats.event.created", "mesh.seat.operator-channel.accept.condition.nats",
// The seat's events on the seat's subjects, as every seat's (the lead's ruling, registry milestone 13:0x), and the
// acknowledgement of a snapshot's chunks of an entry it keeps (ADR 0626 §1).
"mesh.seat.mesh-broker.event.created", "mesh.seat.mesh-broker.event.refused", "$JS.SNAPSHOT.ACK.KV_mod-x_records.x.1.0"} {
if !MayPublish(keeper, s) {
t.Errorf("the bus module's process may not publish %s", s)
}
}
for _, other := range []string{"a.nats.other", "a.mod-x.sneak"} {
if MayPublish(perms[other], "mesh.seat.mesh-broker.event.created") {
t.Errorf("%s, which is no keeper of the bus, says mesh-broker's created", other)
}
}
// ADR 0626, How it is checked: no subscription to a restricted stream's subjects, nor a consumer of it or of any
// stream it keeps; a snapshot's chunks come to its own inbox alone, and only of a stream it keeps.
for _, s := range []string{"mesh.stream.mod-x.event.sealed", "mesh.stream.mod-x.event.>", "mesh.bus.mod-x.records.x"} {
if MaySubscribe(keeper, s) {
t.Errorf("the bus module's process hears %s", s)
}
}
for _, s := range []string{"$JS.API.CONSUMER.CREATE.SECRETS.x.y", "$JS.API.CONSUMER.CREATE.KV_mod-x_records.x",
"$JS.API.CONSUMER.MSG.NEXT.SECRETS.x", "$JS.API.DIRECT.GET.SECRETS", "$JS.API.STREAM.SNAPSHOT.SECRETS",
"$JS.SNAPSHOT.ACK.SECRETS.x.1.0", "$JS.API.STREAM.MSG.GET.KV_mod-x_records"} {
if MayPublish(keeper, s) {
t.Errorf("the bus module's process may publish %s", s)
}
}
for _, s := range keeper.Subscribe {
if !strings.HasPrefix(s, "_INBOX.a.nats.keeper.") && !strings.HasPrefix(s, "$JS.EVENT.ADVISORY.STREAM.CREATED.KV_nats_") &&
!strings.HasPrefix(s, "mesh.seat.operator-channel.") {
t.Errorf("the bus module's process subscribes %s, beyond its inbox, its own state's creation and its conditions' answers", s)
}
}
made := false
for _, mc := range AccountConsumers(users) {
if mc.Consumer.Stream == "EVENTS" && mc.Consumer.Name == "a_nats_keeper" &&