Every account may call every verb: the grants part reads no definition's callers (callerOf, the verb and accept callers, admits) and grants every module's account every verb of every seat (mesh.seat.*.tool.> and its caller-named form), a sent store to every module invoking a verb of its claimant's seat, and every queue's named ask to every asker. grants_callers goes; grants_why_refused answers the bus's own verdict. The indexer keeps no verdicts: their first view, events, invoke and the engine's read go, and a want names its build alone (no newest). internal/... and cmd/... tests are green; the root package's grants_test.go still reads the verdicts (rows at grants_test.go:303-307, 741, 1184, 3700-3870, 4560-4615) and does not compile. Builds: design 47 H §745, §750, §752, §764 (every seat contract: the callers lists); lead answers H-A-37, H-A-66, H-A-79, H-A-113 (hq f599b761) Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
56 lines
1.9 KiB
Go
56 lines
1.9 KiB
Go
package grants
|
|
|
|
import (
|
|
"slices"
|
|
"strings"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
)
|
|
|
|
// **A module's sent store is read by the modules it is for** (design 47 G §59, §124): the grants part derives, from the
|
|
// catalog graph, never from a manifest field, a standing read of `<module>_sent-objects` for every module invoking a verb of a
|
|
// seat it claims (every account may call every verb, design 47 H §752, H-A-66), and for the consumers whose `consumes` declare
|
|
// its events. The grant follows the catalog graph, so it is composed with each module's declaration at every pass.
|
|
|
|
// sentStoresRead are the bus names of the sent stores the module m reads: of each module whose event it consumes (the module's
|
|
// own, or the seat a module claims), and of each module claiming a seat whose verb m invokes.
|
|
// Never m's own store, which its binding grants it.
|
|
func sentStoresRead(m catalogue.Manifest, all map[string]catalogue.Manifest) []string {
|
|
claimants := func(name string) []string {
|
|
var out []string
|
|
if _, ok := all[name]; ok {
|
|
out = append(out, name)
|
|
}
|
|
for module, x := range all {
|
|
if slices.ContainsFunc(x.Claims, func(c catalogue.Claim) bool { return c.Name == name }) {
|
|
out = append(out, module)
|
|
}
|
|
}
|
|
return out
|
|
}
|
|
var stores []string
|
|
for _, c := range m.Consumes {
|
|
name, _, ok := strings.Cut(strings.TrimPrefix(c, "seat:"), ".")
|
|
if !ok || name == "*" {
|
|
continue
|
|
}
|
|
for _, module := range claimants(name) {
|
|
stores = append(stores, catalogue.SentObjectsName(module))
|
|
}
|
|
}
|
|
for _, in := range m.Invokes {
|
|
seat, _, ok := catalogue.SeatInvoke(in)
|
|
if !ok {
|
|
continue
|
|
}
|
|
for module, x := range all {
|
|
if slices.ContainsFunc(x.Claims, func(c catalogue.Claim) bool { return c.Name == seat }) {
|
|
stores = append(stores, catalogue.SentObjectsName(module))
|
|
}
|
|
}
|
|
}
|
|
stores = slices.DeleteFunc(stores, func(s string) bool { return s == catalogue.SentObjectsName(m.Module) })
|
|
slices.Sort(stores)
|
|
return slices.Compact(stores)
|
|
}
|