A-382 every-account-lists-stream-names: the composer gives every module, process, node and runner account the streams' names, in place of grants' own row
Builds: design 47 G A-382 (G-22-lead-answers-2.md), replaces A-381's special case Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -1050,9 +1050,10 @@ func everyNodesCompositions(t *testing.T) {
|
||||
t.Errorf("node one writes %s: %v", bucket, node != "one")
|
||||
}
|
||||
}
|
||||
// Every account lists the streams' names (design 47 G A-382); only the view hears the creation of a node's bucket.
|
||||
if !MayPublish(view, "$JS.API.STREAM.NAMES") || !MaySubscribe(view, "$JS.EVENT.ADVISORY.STREAM.CREATED.KV_composed-three") ||
|
||||
MayPublish(plex, "$JS.API.STREAM.NAMES") {
|
||||
t.Error("the view cannot find a node's bucket, or a module not named lists the streams")
|
||||
!MayPublish(plex, "$JS.API.STREAM.NAMES") || MaySubscribe(plex, "$JS.EVENT.ADVISORY.STREAM.CREATED.KV_composed-three") {
|
||||
t.Error("the view cannot find a node's bucket, or a module lacks the streams' names, or one not named hears its creation")
|
||||
}
|
||||
if MayPublish(view, "$JS.API.DIRECT.GET.KV_mesh-host_composed.x") {
|
||||
t.Error("the read is granted as one bucket mesh-host_composed")
|
||||
|
||||
@@ -99,9 +99,10 @@ func theGrantsPartCreatesOnlyDeclaredStreams(t *testing.T) {
|
||||
{GrantsModule, "$JS.API.CONSUMER.DELETE.OBJ_mesh-grants-user-list.abc", true},
|
||||
{GrantsModule, "$JS.FC.OBJ_mesh-grants-user-list.abc.def.ghi", true},
|
||||
{GrantsModule, "$JS.API.CONSUMER.CREATE.OBJ_declaration-files-novox.abc.$O.declaration-files-novox.C.abc", false},
|
||||
// A-381: creating a kept event's stream asks the names of the bus's streams first.
|
||||
// A-381, A-382: every account asks the names of the bus's streams, as a client finds the stream that carries a subject.
|
||||
{GrantsModule, "$JS.API.STREAM.NAMES", true},
|
||||
{"mesh-delivery-builder", "$JS.API.STREAM.NAMES", false},
|
||||
{"mesh-delivery-builder", "$JS.API.STREAM.NAMES", true},
|
||||
{"novox.node-tools", "$JS.API.STREAM.NAMES", true},
|
||||
{GrantsModule, "$O.declaration-files-novox.C.abc", false},
|
||||
{GrantsModule, "$JS.API.STREAM.DELETE.OBJ_mesh-grants-user-list", false},
|
||||
{"mesh-delivery-builder", "$O.mesh-grants-user-list.C.abc", false},
|
||||
|
||||
@@ -698,9 +698,17 @@ func PermissionsFor(p Principal) (Permissions, error) {
|
||||
sub = append(sub, answered...)
|
||||
}
|
||||
perms.Publish, perms.Subscribe = append(perms.Publish, pub...), append(perms.Subscribe, sub...)
|
||||
// Every account of a module, its processes, its node and the tool runner (not a ledger's or an enrolling node's, which publish on a few subjects alone) asks the names of the bus's streams: a client finds the stream that carries a subject by it (the tool runner's
|
||||
// subscription to a seat's event, the grants part's creation of a kept stream; design 47 G A-381, A-382).
|
||||
if slices.Contains([]Kind{KindModule, KindNodeTools, KindNode, KindProcess}, p.Kind) && !slices.Contains(perms.Publish, StreamNamesSubject) {
|
||||
perms.Publish = append(perms.Publish, StreamNamesSubject)
|
||||
}
|
||||
return perms, nil
|
||||
}
|
||||
|
||||
// StreamNamesSubject is the request for the names of the bus's streams, granted to every account.
|
||||
const StreamNamesSubject = "$JS.API.STREAM.NAMES"
|
||||
|
||||
func permissionsFor(p Principal) (Permissions, error) {
|
||||
for _, part := range []struct{ what, value string }{
|
||||
{"node", p.Node}, {"module", p.Module}, {"process", p.Process},
|
||||
@@ -961,8 +969,6 @@ func permissionsFor(p Principal) (Permissions, error) {
|
||||
// And creating each stream a manifest declares, by its own name (the operator, 2026-10-26 08:54; issue
|
||||
// 1790): the create and the read of that one stream, never an update, a delete or a stream not declared.
|
||||
pub = append(pub, CreateStreamGrants(p.CreatesStreams)...)
|
||||
// And the names of the bus's streams, which creating a stream whose messages are sourced from another asks first (design 47 G A-381).
|
||||
pub = append(pub, "$JS.API.STREAM.NAMES")
|
||||
// And creating each durable consumer an account needs, by its stream and name (ADR 0561 §6).
|
||||
pub = append(pub, CreateConsumerGrants(p.CreatesConsumers)...)
|
||||
// And the purge of the build seats' named asks and the delete of their named workers (design 47 G §544).
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user