From e0d2298f5818cfd154b0c69526be7dcf9309d828 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 5 Nov 2026 14:31:27 +0100 Subject: [PATCH] =?UTF-8?q?seatlist:=20the=20again=20tool=20answers=20a=20?= =?UTF-8?q?VerbCallers-style=20list,=20so=20the=20operator's=20sessions=20?= =?UTF-8?q?can=20be=20named=20(ADR=200636=20=C2=A77;=20issue=201966)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i --- go/seatlist/seatlist.go | 15 ++++++++------- go/seatlist/seatlist_test.go | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/go/seatlist/seatlist.go b/go/seatlist/seatlist.go index e18878e..70835ea 100644 --- a/go/seatlist/seatlist.go +++ b/go/seatlist/seatlist.go @@ -383,7 +383,7 @@ func (r *Reader) changed() { // (every definition, its source and digest) and what it waits for; and again, which makes it read the list now, and // answers only to the callers the host's list names (the operator and the healers). The host names the tools and the list; // again records nothing but the read it asked. -func Tools(r *Reader, read, again string, callers stdio.Callers) []stdio.Tool { +func Tools(r *Reader, read, again string, callers []string) []stdio.Tool { return []stdio.Tool{ {Name: read, Description: "The seat list this part holds (novox/hq ADR 0636): each seat's definition with its source (trunk or bootstrap) and " + @@ -412,11 +412,12 @@ func Tools(r *Reader, read, again string, callers stdio.Callers) []stdio.Tool { } } -// Refusal is why caller may not make the reader read again, or nil: the caller's proof, never an argument, against the -// list of the operator and the healers. -func Refusal(tool string, callers stdio.Callers, caller string) error { - if callers.Allows(caller) { - return nil +// Refusal is why caller may not make the reader read again, or nil: the caller's proof, never an argument, against +// callers, the entries of a verb's list as VerbCallers reads them, so stdio.AnyPerson names every operator's session +// the runtime proved (person.) and a module name its instances (ADR 0636 §7). +func Refusal(tool string, callers []string, caller string) error { + if err := (stdio.VerbCallers{tool: callers}).Allowed(tool, caller); err != nil { + return fmt.Errorf("%s is refused to %q: it answers only %s (novox/hq ADR 0636 §7)", tool, caller, strings.Join(callers, ", ")) } - return fmt.Errorf("%s is refused to %q: it answers only %s (novox/hq ADR 0636 §7)", tool, caller, strings.Join(callers, ", ")) + return nil } diff --git a/go/seatlist/seatlist_test.go b/go/seatlist/seatlist_test.go index 0f87205..673c002 100644 --- a/go/seatlist/seatlist_test.go +++ b/go/seatlist/seatlist_test.go @@ -199,13 +199,13 @@ func TestTheTwoToolsReadTheHeldListAndReadItAgainForTheirCallers(t *testing.T) { if err != nil { t.Fatal(err) } - callers := stdio.Callers{"person.jo", "mesh-healers"} + callers := []string{stdio.AnyPerson, "mesh-healers"} tools := Tools(r, "seat_list", "seat_list_again", callers) out, err := tools[0].Run(map[string]any{}) if err != nil || out.(map[string]any)["health"] == "" || !strings.Contains(fmt.Sprint(out.(map[string]any)["status"]), "bootstrap") { t.Fatalf("read: %v %v", out, err) } - for caller, allowed := range map[string]bool{"person.jo": true, "ace.mesh-healers": true, "ace.mesh-other": false, "person.al": false, stdio.Unproven: false} { + for caller, allowed := range map[string]bool{"person.jo": true, "ace.mesh-healers": true, "ace.mesh-other": false, "person.al": true, stdio.Unproven: false} { if err := Refusal("seat_list_again", callers, caller); (err == nil) != allowed { t.Fatalf("%s: %v, allowed %v", caller, err, allowed) }