A-163: the asker in `accept.<queue>.<asker>` is the asking seat's name (mesh-pipeline-runner, mesh-catalog, mesh-wants, mesh-builds), never a nickname: the builder asks as mesh-builds (was "builder"), the indexer's validation as mesh-catalog (was "indexer"), the assigner's runs as mesh-wants (was "assigner"), the runner's steps on `accept.check.mesh-pipeline-runner` and `accept.delivery.mesh-pipeline-runner` (were `accept.check.step` and `accept.delivery.step`, where the holder read `step` as the asker). An asker naming none (the checker) asks on main's subject (A-184). A build seat's queues are delivery, check and recheck alone (A-170, A-184): buildstep's AskKinds holds no step, a holder takes a step from check or delivery, and the grants part makes a worker per queue, never per kind. A holder keys a named ask's step `<asker>.<node>.<id>` and main's `<node>.<id>` (§481, §483); readers watch their own name's keys. The composition step's step-progress names the one caller mesh-wants' definition lists for step, read from the seat list (A-294). Builds: design 47 G §481, §483, §543, §600, A-163, A-170, A-184, A-248, A-294 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
44 lines
1.9 KiB
Go
44 lines
1.9 KiB
Go
package grants
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
"git.novox.be/novox/mesh-sdk/go/seatdef"
|
|
)
|
|
|
|
// The askers of a build seat's queue are read from the definition's callers lists (design 47 G §543, §600, A-163): a kind's
|
|
// `stream` is its queue, a text callers names none, and only `seat:` entries are askers.
|
|
func TestAcceptCallersOf(t *testing.T) {
|
|
msg := func(name, stream string, callers ...string) seatdef.Message {
|
|
m := seatdef.Message{Name: name, Stream: stream}
|
|
if callers != nil {
|
|
m.Callers = &seatdef.Callers{List: callers}
|
|
}
|
|
return m
|
|
}
|
|
got := acceptCallersOf(map[string]seatdef.Definition{
|
|
"node-build-go": {Seat: "node-build-go", PulledByKind: true, Accepts: []seatdef.Message{
|
|
msg("check", "", "seat:mesh-catalog", "operator"),
|
|
msg("step", "check", "seat:mesh-pipeline-runner"),
|
|
msg("delivery", "", "seat:mesh-builds"),
|
|
{Name: "recheck", Callers: &seatdef.Callers{Text: "the checker"}},
|
|
}},
|
|
"other": {Seat: "other", Accepts: []seatdef.Message{msg("go", "", "seat:x")}},
|
|
})
|
|
if len(got) != 1 {
|
|
t.Fatalf("seats: %v, want node-build-go alone", got)
|
|
}
|
|
q := got["node-build-go"]
|
|
if !slices.Equal(q["check"], []string{"mesh-catalog", "mesh-pipeline-runner"}) || !slices.Equal(q["delivery"], []string{"mesh-builds"}) || len(q) != 2 {
|
|
t.Errorf("queues: %v", q)
|
|
}
|
|
// A-170, A-184: the seat's workers are per queue, never per kind: step and run ride check or delivery.
|
|
build := catalogue.SeatFromDefinition(seatdef.Definition{Seat: "node-build-go", PulledByKind: true, Accepts: []seatdef.Message{
|
|
msg("delivery", ""), msg("check", ""), msg("step", "check"), msg("step", "delivery"), msg("recheck", ""), msg("run", "check")}})
|
|
if got := queuesOf(build); !slices.Equal(got, []string{"delivery", "check", "recheck"}) {
|
|
t.Errorf("the queues of %v on %v: %v, want delivery, check and recheck", build.Accepts, build.AcceptedOn, got)
|
|
}
|
|
}
|