Grants: every module is composed as invoking the tool runner's own reads (A-396)

Live on shanks the build runtimes' seat list and catalog-half reads were refused on their caller-named subjects, since the modules' manifests do not invoke them, and the no-caller fallback is answered by nobody.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-14 12:09:51 +01:00
parent 34e1938df1
commit 7e4c9b9992
2 changed files with 41 additions and 1 deletions
+16 -1
View File
@@ -171,7 +171,7 @@ func declaredFor(m catalogue.Manifest, seats map[string]catalogue.SeatDeclaratio
fromModules, watches := consumedOf(m, seats, declarers)
d := buscompose.Declared{
Module: m.Module, ToolRunner: catalogue.IsToolRunner(m), Emits: m.EmitsAll(), Consumes: fromModules, Watches: watches, Serves: m.Tools,
Invokes: m.Invokes, State: bucketsOf(m), Reads: m.Reads, Logs: logsOf(m),
Invokes: withRunnerReads(m.Invokes), State: bucketsOf(m), Reads: m.Reads, Logs: logsOf(m),
Streams: streamsOf(m), Queues: queueOwnersOf(m), Processes: processesOf(m), ServesOwn: ownServesOf(m), Checks: catalogue.HealthChecks(m),
RunsAs: m.RunsAs, Issued: issuedTools(m),
// The keys its served values fill, which every node may read where it runs (issue 1126).
@@ -807,3 +807,18 @@ func findingEventsOf(m catalogue.Manifest) []string {
}
return nil
}
// RunnerReads are the seat verbs the tool runner itself asks for every module it serves, on that module's account: its seat
// list and the catalog half's first views. Every module is composed as invoking them (lead answer A-396, beside A-395).
var RunnerReads = []string{"seat:mesh-catalog.seat-definitions", "seat:mesh-catalog.revision", "seat:mesh-catalog.registrations", "seat:mesh-delivery.source"}
// withRunnerReads is invokes with each of RunnerReads it lacks.
func withRunnerReads(invokes []string) []string {
out := slices.Clone(invokes)
for _, r := range RunnerReads {
if !slices.Contains(out, r) && !slices.Contains(out, "*") {
out = append(out, r)
}
}
return out
}
@@ -0,0 +1,25 @@
package grants
import (
"slices"
"testing"
"git.novox.be/novox/mesh-sdk/go/catalogue"
)
// A-396: every module is composed as invoking the runner's own reads, so its account may ask them.
func TestEveryModuleInvokesTheRunnersReads(t *testing.T) {
for _, c := range []struct {
name string
invokes []string
want int
}{{"none declared", nil, len(RunnerReads)}, {"one declared", []string{"seat:mesh-catalog.revision"}, len(RunnerReads)}, {"every verb", []string{"*"}, 1}} {
d := declaredFor(catalogue.Manifest{Module: "mesh-build-go", Invokes: c.invokes}, nil, nil)
if len(d.Invokes) != c.want {
t.Errorf("%s: invokes %v, want %d", c.name, d.Invokes, c.want)
}
if c.want > 1 && !slices.Contains(d.Invokes, "seat:mesh-catalog.seat-definitions") {
t.Errorf("%s: invokes %v lack the seat list's verb", c.name, d.Invokes)
}
}
}