From f2a05fb4408356c8a86d9eb636a690fb8cc04e45 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 20 Nov 2026 02:38:21 +0100 Subject: [PATCH] T2 no-callers-hook: the runner admits every caller by serving, with no hook that judges who may call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- node-tools/internal/runtime/caller_test.go | 24 ++++----------------- node-tools/internal/runtime/gate.go | 10 ++------- node-tools/internal/runtime/runtime.go | 16 +++++--------- node-tools/internal/runtime/runtime_test.go | 3 +-- 4 files changed, 12 insertions(+), 41 deletions(-) diff --git a/node-tools/internal/runtime/caller_test.go b/node-tools/internal/runtime/caller_test.go index 20d6532..86c4a0f 100644 --- a/node-tools/internal/runtime/caller_test.go +++ b/node-tools/internal/runtime/caller_test.go @@ -68,15 +68,14 @@ func TestACallOnTheCallerNamedSubjectReachesTheModuleWithItsCaller(t *testing.T) } } -// deskDefined is the seat list's definition of the fixture seat node-desk, its verb who taking its class's default. +// deskDefined is the seat list's definition of the fixture seat node-desk, its verb who. var deskDefined = WithSeatDefinitions(func() map[string]seatdef.Definition { return map[string]seatdef.Definition{"node-desk": {Seat: "node-desk", Verbs: []seatdef.Verb{{Name: "who"}}}} }) // The subject that names no caller is still served for a module's tool, for one release (retired by hq issue 464), and says -// so: the module is named no caller, whatever the body claims. A seat's verb refuses it before the bundle runs (design 47 G -// §610; lead answers A-165, A-179), and refuses every caller while the seat's definition is unread, names no such verb or -// opens it to none. +// so: the module is named no caller, whatever the body claims. A seat's verb answers every caller, an unproven one too (design 47 +// H §752). func TestTheSubjectThatNamesNoCallerStillWorksAndNamesNone(t *testing.T) { mesh := mt.New(t) mesh.Issue(t, mt.MembershipOf("ledger", "anchor", true, map[string][]string{"node-desk": {"who"}})) @@ -104,7 +103,7 @@ func TestTheSubjectThatNamesNoCallerStillWorksAndNamesNone(t *testing.T) { } return err }) - // Every caller is admitted, an unproven one too (the operator, 2026-11-15 23:25 CET). + // Every caller is answered, an unproven one too (design 47 H §752). if strings.HasPrefix(subject, "mesh.seat.") { if reply.Error != "" { t.Errorf("%s: an unproven caller of a seat's verb was refused: %q, want answered", subject, reply.Error) @@ -115,21 +114,6 @@ func TestTheSubjectThatNamesNoCallerStillWorksAndNamesNone(t *testing.T) { t.Errorf("%s: the module was named caller %q (error %q), want none", subject, reply.Result.Caller, reply.Error) } } - for _, c := range []struct { - defs map[string]seatdef.Definition - says string - }{ - {nil, ""}, - {map[string]seatdef.Definition{"node-desk": {Seat: "node-desk"}}, ""}, - {map[string]seatdef.Definition{"node-desk": {Seat: "node-desk", Verbs: []seatdef.Verb{{Name: "who", Callers: &seatdef.Callers{List: []string{}}}}}}, ""}, - {map[string]seatdef.Definition{"node-desk": {Seat: "node-desk", Verbs: []seatdef.Verb{{Name: "who", Class: seatdef.ClassAct}}}}, ""}, - } { - defs := c.defs - err := (&consumers{definitions: func() map[string]seatdef.Definition { return defs }}).admitted("node-desk", "who", "workstation.node-tools") - if c.says == "" && err != nil || c.says != "" && (err == nil || !strings.Contains(err.Error(), c.says)) { - t.Errorf("a proven caller with the definitions %v: %v, want %q", c.defs, err, c.says) - } - } // Design 47 G A-249: a bundle's seat call is received by the runner in chunks only for a verb whose definition says `chunks`, // of any machine: a verb a node holds is asked of the node that ran the ask (A-254). t.Run("OnlyAChunkedSeatVerbIsAskedInChunks", func(t *testing.T) { diff --git a/node-tools/internal/runtime/gate.go b/node-tools/internal/runtime/gate.go index 289c94f..499aef4 100644 --- a/node-tools/internal/runtime/gate.go +++ b/node-tools/internal/runtime/gate.go @@ -49,18 +49,12 @@ func WithGate(g Gate) Option { return func(c *consumers) { c.gate = g } } var _ Gate = (*approval.Gate)(nil) -// WithSeatDefinitions refuses, where a seat's verb is answered, a caller outside the verb's effective callers, before the -// bundle runs (design 47 G §610; lead answers A-165, A-179): defs are the seat definitions the runner's seat list holds. -// Without it a verb is answered for every caller, as before. +// WithSeatDefinitions gives the runner the seat definitions its seat list holds: a verb's `chunks` and `timeout` are read from them +// (design 47 H §760). No definition names who may call: every caller is answered (design 47 H §752). func WithSeatDefinitions(defs func() map[string]seatdef.Definition) Option { return func(c *consumers) { c.definitions = defs } } -// admitted says why a seat's verb is refused to a caller: never. Every caller is admitted, whether or not the seat's 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, held by the gate). -func (c *consumers) admitted(seat, verb, caller string) error { return nil } - // unservedMarks is, of the module's marked tools, those its bundle's registrations under its own name do not register. func (r *runner) unservedMarks(module string, regs []launch.Registration) []string { if r.events.gate == nil { diff --git a/node-tools/internal/runtime/runtime.go b/node-tools/internal/runtime/runtime.go index a2713ab..144459f 100644 --- a/node-tools/internal/runtime/runtime.go +++ b/node-tools/internal/runtime/runtime.go @@ -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 diff --git a/node-tools/internal/runtime/runtime_test.go b/node-tools/internal/runtime/runtime_test.go index c97e2e5..2d07444 100644 --- a/node-tools/internal/runtime/runtime_test.go +++ b/node-tools/internal/runtime/runtime_test.go @@ -328,8 +328,7 @@ func TestANodeScopedSeatVerbIsAlsoAnsweredWithNoMachine(t *testing.T) { 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 }, func(string) time.Duration { return 0 }, nil, func(string) string { return "" }, (&mt.Logs{}).Logf) + stop, _ := serveSeats(nodeTools, []string{"theta"}, regs, gated, func(string) bool { return false }, func(string) time.Duration { return 0 }, 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) {