process: an unread seat definition holds a verb that may need approval for a caller that is no module's account
A-435: the mesh MCP server's account, a person and an unproven caller are held as before while the definition is unread; a module's account runs it (A-433). Builds: design 47 G A-433, A-435
This commit is contained in:
@@ -169,8 +169,11 @@ func TestUserOfTokenAndAnswerSeatRefusals(t *testing.T) {
|
||||
def func() (seatdef.Definition, bool)
|
||||
says string
|
||||
}{
|
||||
{"an unproven caller", "", defined, ""}, // every caller is admitted (the operator, 2026-11-15)
|
||||
{"an unproven caller", "", defined, ""}, // a read definition admits every caller (the operator, 2026-11-15)
|
||||
{"the definition unread", "novox.mesh-recovery", func() (seatdef.Definition, bool) { return seatdef.Definition{}, false }, ""},
|
||||
{"the definition unread, the console's account (A-435)", "novox.node-tools", func() (seatdef.Definition, bool) { return seatdef.Definition{}, false }, "may need approval"},
|
||||
{"the definition unread, a person (A-435)", "person.jo", func() (seatdef.Definition, bool) { return seatdef.Definition{}, false }, "may need approval"},
|
||||
{"the definition unread, an unproven caller (A-435)", "", func() (seatdef.Definition, bool) { return seatdef.Definition{}, false }, "may need approval"},
|
||||
{"a verb the definition does not name", "novox.mesh-recovery", func() (seatdef.Definition, bool) { return seatdef.Definition{Seat: "seat"}, true }, ""},
|
||||
{"a verb open to none", "novox.mesh-recovery", func() (seatdef.Definition, bool) {
|
||||
return seatdef.Definition{Seat: "seat", Verbs: []seatdef.Verb{{Name: "v", Callers: &seatdef.Callers{List: []string{}}}}}, true
|
||||
|
||||
+15
-1
@@ -121,12 +121,26 @@ func Gated(g *approval.Gate) SeatOption { return func(o *seatOptions) { o.gate =
|
||||
// heldHandler is a verb's handler behind its checks: its answer, the held answer of a kept call, or its error.
|
||||
type heldHandler func(caller string, body json.RawMessage, wait bool) (any, *approval.Held, error)
|
||||
|
||||
// moduleAccount says a proven caller is a module's account, `<node>.<module>`: not a person's, not the tool runner's own
|
||||
// account (`<node>.node-tools`, the one the mesh MCP server's sessions and agents call as), not an unproven caller (A-433, A-435).
|
||||
func moduleAccount(caller string) bool {
|
||||
node, module, ok := strings.Cut(caller, ".")
|
||||
return ok && node != "person" && node != "" && module != "" && module != "node-tools" && !strings.Contains(module, ".")
|
||||
}
|
||||
|
||||
// admitted is h, and for a verb the definition marks, h behind the gate (§677). Every caller is admitted, whether or not the
|
||||
// definition is read and whatever callers it names (the operator, 2026-11-15 23:25 CET: every module, agent and operator may
|
||||
// call anything; approval stays as the mark on a verb).
|
||||
func (c *Conn) admitted(seat, verb string, definition func() (seatdef.Definition, bool), h SeatHandler, gate *approval.Gate) heldHandler {
|
||||
return func(caller string, body json.RawMessage, wait bool) (any, *approval.Held, error) {
|
||||
if def, read := definition(); read {
|
||||
def, read := definition()
|
||||
if !read && !moduleAccount(caller) {
|
||||
// A-435: a verb that may need approval is held while its definition is unread, as before, for a caller that is not
|
||||
// a module's account (the mesh MCP server's, a person's, an unproven one); a module's account runs it (A-433).
|
||||
return nil, nil, fmt.Errorf("the definition of the seat %s is not yet read by this process's seat list, so %s.%s, which may "+
|
||||
"need approval, is not run for a caller that is no module's account", seat, seat, verb)
|
||||
}
|
||||
if read {
|
||||
for _, v := range def.Verbs {
|
||||
if v.Name != verb || !v.NeedsApproval {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user