T2 no-callers-hook: the runner admits every caller by serving, with no hook that judges who may call
The `admitted` hook, its parameter of serveSeats and its comments go; the test rows that built definitions with Callers and Class go with the field mesh-sdk removes. A seat's verb is answered for every caller. Builds: design 47 H §752, §764 (Every seat contract), H-A-41 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -314,7 +314,7 @@ func Run(conn *bus.Conn, served []Served, envs map[string]map[string]string, log
|
||||
}
|
||||
logf("%s", line)
|
||||
conn.OnMembership(func(bus.Membership) { go func() { r.refreshRepairs(); conn.Flush() }() })
|
||||
stopSeats, again := serveSeats(conn, r.modules, r.registrations, r.events.gated, r.events.admitted, r.events.chunked, r.events.withinOf, r.approvalsOf(),
|
||||
stopSeats, again := serveSeats(conn, r.modules, r.registrations, r.events.gated, r.events.chunked, r.events.withinOf, r.approvalsOf(),
|
||||
r.fingerprintOf, logf)
|
||||
r.seatsAgain = again
|
||||
r.stops = append(r.stops, stopSeats)
|
||||
@@ -733,7 +733,7 @@ func subjectsOf(conn *bus.Conn, module, tool string) []string {
|
||||
// whenever a membership changes, and when again is called because a bundle was loaded again. Whether
|
||||
// this machine holds the seat is the bus's to decide. It answers its stop and again.
|
||||
func serveSeats(conn *bus.Conn, modules []string, current func() []registration, gated gatedRun,
|
||||
admitted func(seat, verb, caller string) error, chunked func(key string) bool, within func(key string) time.Duration, approvals func(caller string) (any, error),
|
||||
chunked func(key string) bool, within func(key string) time.Duration, approvals func(caller string) (any, error),
|
||||
fingerprintOf func(string) string, logf func(string, ...any)) (func(), func()) {
|
||||
var mu sync.Mutex
|
||||
var stops []func()
|
||||
@@ -773,9 +773,6 @@ func serveSeats(conn *bus.Conn, modules []string, current func() []registration,
|
||||
if v.Verb == seatdef.ApprovalsVerb && approvals != nil {
|
||||
seat := v.Seat
|
||||
stop, err := conn.HandleSubjectCalled(v.Subject, func(caller string, _ json.RawMessage) (any, error) {
|
||||
if err := admitted(seat, seatdef.ApprovalsVerb, caller); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return approvals(caller)
|
||||
})
|
||||
if err != nil {
|
||||
@@ -791,13 +788,10 @@ func serveSeats(conn *bus.Conn, modules []string, current func() []registration,
|
||||
logf("[mesh-tools] %s claims %s and implements no %s, which that seat promises; not served", module, v.Seat, v.Verb)
|
||||
continue
|
||||
}
|
||||
// Its callers checked, then through the approval gate, before the bundle (design 47 G §610, A-179; design 46
|
||||
// Through the approval gate, for any caller, before the bundle (design 47 H §752; design 46
|
||||
// 7-approval-mark §20).
|
||||
module, v := module, v
|
||||
handle := func(caller string, body json.RawMessage) (any, error) {
|
||||
if err := admitted(v.Seat, v.Verb, caller); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
answer, err := gated(approval.Call{Address: v.Seat + "." + v.Verb, Module: module, Seat: v.Seat, Name: v.Verb,
|
||||
Fingerprint: fingerprintOf(module), Caller: caller, Args: argsOf(body), Description: t.Description}, t.Within(within("seat:"+v.Seat+"."+v.Verb)), caller)
|
||||
if err != nil || !chunked("seat:"+v.Seat+"."+v.Verb) {
|
||||
@@ -812,7 +806,7 @@ func serveSeats(conn *bus.Conn, modules []string, current func() []registration,
|
||||
continue
|
||||
}
|
||||
stops = append(stops, stop)
|
||||
logf("[mesh-tools] serving %s's %s on %s, admitted where %s holds the seat", v.Seat, v.Verb, v.Subject, module)
|
||||
logf("[mesh-tools] serving %s's %s on %s, where %s holds the seat", v.Seat, v.Verb, v.Subject, module)
|
||||
// A verb of a node-scoped seat is also answered on the subject that names no machine, by any one holder, in
|
||||
// one queue group per seat and verb (lead answer A-393).
|
||||
if open, ok := anyHolderSubject(v, m.Node); ok && !have[open] {
|
||||
@@ -869,7 +863,7 @@ type consumers struct {
|
||||
sessions sessionTable
|
||||
// gate is the approval gate every call is served through (gate.go); nil serves every call as before.
|
||||
gate Gate
|
||||
// definitions are the seat definitions a seat verb's callers are read from (gate.go); nil admits every caller.
|
||||
// definitions are the seat definitions a seat verb's `chunks` and `timeout` are read from (gate.go); nil reads none.
|
||||
definitions func() map[string]seatdef.Definition
|
||||
// reread reads the seat list again (gate.go, chunkedAsked); nil reads nothing.
|
||||
reread func() error
|
||||
|
||||
Reference in New Issue
Block a user