diff --git a/go/process/call_test.go b/go/process/call_test.go index 188df54d..77cd6e74 100644 --- a/go/process/call_test.go +++ b/go/process/call_test.go @@ -169,12 +169,12 @@ func TestUserOfTokenAndAnswerSeatRefusals(t *testing.T) { def func() (seatdef.Definition, bool) says string }{ - {"an unproven caller", "", defined, "takes no unproven caller"}, - {"the definition unread", "novox.mesh-recovery", func() (seatdef.Definition, bool) { return seatdef.Definition{}, false }, "not yet read"}, - {"a verb the definition does not name", "novox.mesh-recovery", func() (seatdef.Definition, bool) { return seatdef.Definition{Seat: "seat"}, true }, "names no verb v"}, + {"an unproven caller", "", defined, ""}, // every caller is admitted (the operator, 2026-11-15) + {"the definition unread", "novox.mesh-recovery", func() (seatdef.Definition, bool) { return seatdef.Definition{}, false }, ""}, + {"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 - }, "open to no caller"}, + }, ""}, {"a marked verb with no gate (§677)", "novox.mesh-recovery", func() (seatdef.Definition, bool) { return seatdef.Definition{Seat: "seat", Verbs: []seatdef.Verb{{Name: "v", NeedsApproval: true}}}, true }, "through no gate"}, diff --git a/go/process/serve.go b/go/process/serve.go index 79fe1392..442e3512 100644 --- a/go/process/serve.go +++ b/go/process/serve.go @@ -121,37 +121,25 @@ 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) -// admitted is h behind the check of its caller against the verb's effective callers (A-179, A-186), and, for a verb the -// definition marks, behind the gate (§677). +// 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 caller == "" { - return nil, nil, fmt.Errorf("%s.%s takes no unproven caller: call it on its subject that names its caller, "+ - "mesh.seat.%s.call.%s.", seat, verb, seat, verb) + if def, read := definition(); read { + for _, v := range def.Verbs { + if v.Name != verb || !v.NeedsApproval { + continue + } + if gate == nil { + return nil, nil, fmt.Errorf("Not run: %s.%s needs the operator's approval, and its holder serves it through no gate", seat, verb) + } + return gate.Hold(approval.Call{Address: seat + "." + verb, Module: c.account.Module, Seat: seat, Name: verb, + Caller: caller, Args: body, Description: v.Description}, wait, func() (any, error) { return h(caller, body) }) + } } - def, read := definition() - if !read { - return nil, nil, fmt.Errorf("the definition of the seat %s is not yet read by this process's seat list, so no caller of %s.%s "+ - "is admitted", seat, seat, verb) - } - for _, v := range def.Verbs { - if v.Name != verb { - continue - } - if len(v.EffectiveCallers()) == 0 { - return nil, nil, fmt.Errorf("%s.%s is open to no caller", seat, verb) - } - if !v.NeedsApproval { - answer, err := h(caller, body) - return answer, nil, err - } - if gate == nil { - return nil, nil, fmt.Errorf("Not run: %s.%s needs the operator's approval, and its holder serves it through no gate", seat, verb) - } - return gate.Hold(approval.Call{Address: seat + "." + verb, Module: c.account.Module, Seat: seat, Name: verb, - Caller: caller, Args: body, Description: v.Description}, wait, func() (any, error) { return h(caller, body) }) - } - return nil, nil, fmt.Errorf("the seat %s's definition names no verb %s, so no caller is admitted", seat, verb) + answer, err := h(caller, body) + return answer, nil, err } }