Grants: the holder of a seat pulled by kind says the seat's own events, on its machine where the subject names <node> (A-399): a build seat's step-ended and toolchain-reported were granted to nobody

This commit is contained in:
2026-11-14 18:39:45 +01:00
parent b0756f8b45
commit 5b4c454ca2
3 changed files with 59 additions and 1 deletions
@@ -0,0 +1,27 @@
package buscompose
import (
"slices"
"testing"
)
// A-399: the holder of a seat pulled by kind says the seat's own events on its machine (a build seat's step-ended and
// toolchain-reported, `<event>.<node>`); on 2026-11-14 they were granted to nobody, so the builder never heard a toolchain.
func TestAPulledSeatsHolderSaysItsEvents(t *testing.T) {
held := Seat{Name: "node-build-go", Scope: "node", Accepts: []string{"delivery"}, PulledByKind: true,
Emits: []string{"step-ended", "toolchain-reported"},
EventSubjects: map[string]string{"step-ended": "step-ended.<node>", "toolchain-reported": "toolchain-reported.<node>"}}
perms, err := PermissionsFor(Principal{Kind: KindModule, Node: "shanks", Module: "mesh-build-go", Holds: []Seat{held}})
if err != nil {
t.Fatal(err)
}
for _, want := range []string{"mesh.seat.node-build-go.event.step-ended.shanks", "mesh.seat.node-build-go.event.toolchain-reported.shanks"} {
if !slices.Contains(perms.Publish, want) {
t.Errorf("the holder's account is not granted %s", want)
}
}
tr := SeatTrafficOf("mesh-build-go", []Seat{held}, nil, nil)
if !slices.Contains(tr.Publish, "mesh.seat.node-build-go.event.toolchain-reported.*") {
t.Errorf("the membership does not list toolchain-reported: %v", tr.Publish)
}
}