Tool runner: serve a node-scoped seat's verb also with no machine, in a queue group

A verb asked with no machine (the indexer's seed asks node-build-go's steps) is
answered by any one holder, on the tool and the caller-named subject.

Builds: lead answer A-393 (design 47 G)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-14 11:33:57 +01:00
parent 30027347e9
commit 9fa29ad801
3 changed files with 74 additions and 2 deletions
@@ -312,3 +312,47 @@ func TestAnUntakenEventSaysWhoFailed(t *testing.T) {
t.Errorf("the event is not named by its id: %q", got)
}
}
// A node-scoped seat's verb asked with no machine is answered by a holder, by the tool form the SDK asks
// (lead answer A-393).
func TestANodeScopedSeatVerbIsAlsoAnsweredWithNoMachine(t *testing.T) {
mesh := mt.New(t)
mesh.Issue(t, mt.MembershipOf("theta", "anchor", false, map[string][]string{"node-shelf": {"list"}}))
nodeTools := connect(t, "node-tools", "anchor")
asker := connect(t, "console", "workstation")
regs := func() []registration {
return []registration{{module: "node-shelf", owner: "theta", tools: []launch.Tool{{Name: "list",
Run: func(string, json.RawMessage) (json.RawMessage, error) { return json.RawMessage(`{"shelf":["x"]}`), nil }}}}}
}
gated := func(_ approval.Call, tool launch.Tool, caller string) (any, error) {
return tool.Run(caller, nil)
}
nodeTools.Follow("theta")
stop, _ := serveSeats(nodeTools, []string{"theta"}, regs, gated, func(_, _, _ string) error { return nil },
func(string) bool { return false }, nil, func(string) string { return "" }, (&mt.Logs{}).Logf)
defer stop()
for _, key := range []string{"seat:node-shelf.list@anchor", "seat:node-shelf.list"} {
t.Run(key, func(t *testing.T) {
mt.Until(t, func() error {
got, err := call(t, asker, key, map[string]any{})
if err == nil {
same(t, got, `{"shelf":["x"]}`)
}
return err
})
})
}
}
func TestAnyHolderSubject(t *testing.T) {
for _, c := range []struct{ subject, node, want string }{
{"mesh.seat.node-build-go.tool.steps.shanks", "shanks", "mesh.seat.node-build-go.tool.steps"},
{"mesh.seat.mesh-delivery.tool.show", "shanks", ""},
{"mesh.seat.node-build-go.tool.steps.shanks", "", ""},
} {
got, ok := anyHolderSubject(bus.SeatVerb{Seat: "s", Verb: "steps", Subject: c.subject}, c.node)
if got != c.want || ok != (c.want != "") {
t.Errorf("%s on %q: %q %v", c.subject, c.node, got, ok)
}
}
}