CALLERS-1: claude-code and mesh-recovery keep no callers list for the seat list
mesh-sdk's callers set goes in H1, so the seat list's two tools of claude-code answer every caller, and mesh-recovery's seat list part is made with its prefix alone. Builds: design 47 H §752, §764 (every seat contract's callers); H-A-41, H-A-66 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"slices"
|
||||
"strings"
|
||||
@@ -118,12 +119,21 @@ func TestTheMeshsToolsAreReadFromTheBus(t *testing.T) {
|
||||
if got := strings.Join(addresses, ","); got != "mesh-module-assigner.assignments,node-service-manager.status,node-service-manager.journal,docker.docker_logs" {
|
||||
t.Errorf("replacements: %s", got)
|
||||
}
|
||||
t.Run("the again tool answers the operator and the healers only", func(t *testing.T) {
|
||||
// An operator's session through the mesh MCP server is proved as its machine's tool runner (issue 627, issue 1966).
|
||||
for caller, refused := range map[string]bool{"person.jochen": false, "shanks.node-tools": false, "shanks.mesh-healers": false,
|
||||
"shanks.mesh-config": true} {
|
||||
if err := seatlist.Refusal("claude_code_seat_list_again", seatListAgainCallers, caller); (err != nil) != refused {
|
||||
t.Errorf("%s: refused=%v, err %v", caller, refused, err)
|
||||
t.Run("the again tool answers every caller", func(t *testing.T) {
|
||||
// H-A-66 (design 47 H §752): no holder keeps a callers list; the seat list's tools answer every caller.
|
||||
files, _ := filepath.Glob("*.go")
|
||||
for _, f := range files {
|
||||
if strings.HasSuffix(f, "_test.go") {
|
||||
continue
|
||||
}
|
||||
raw, err := os.ReadFile(f)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, gone := range []string{"AnyPerson", "seatListAgainCallers", "seatlist.Refusal"} {
|
||||
if strings.Contains(string(raw), gone) {
|
||||
t.Errorf("%s still names %s", f, gone)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -734,17 +734,12 @@ func refusals(n int) string {
|
||||
return fmt.Sprintf(" (after %d refusal(s))", n)
|
||||
}
|
||||
|
||||
// seatListAgainCallers may read the seat list again: every operator's session and the healers (ADR 0636 §7). A call through
|
||||
// the mesh MCP server is proved only as its machine's tool runner (<node>.node-tools, issue 627), so node-tools stands for
|
||||
// an operator's session until a session is proved (issue 1966).
|
||||
var seatListAgainCallers = []string{stdio.AnyPerson, "node-tools", "mesh-healers"}
|
||||
|
||||
// seatListTools are the seat list reader's two tools: what the list holds and what it waits for, and a read now. The
|
||||
// reader starts once the runtime serves, after the tools are listed, so each tool finds it when it is called.
|
||||
// seatListTools are the seat list reader's two tools: what the list holds and what it waits for, and a read now, each
|
||||
// answering every caller (design 47 H §752, H-A-66). The reader starts once the runtime serves, after the tools are
|
||||
// listed, so each tool finds it when it is called.
|
||||
func seatListTools() []stdio.Tool {
|
||||
names := []string{"claude_code_seat_list", "claude_code_seat_list_again"}
|
||||
callers := seatListAgainCallers
|
||||
shape := seatlist.Tools(&seatlist.Reader{}, names[0], names[1], callers)
|
||||
shape := seatlist.Tools(&seatlist.Reader{}, names[0], names[1])
|
||||
for i := range shape {
|
||||
run := i
|
||||
shape[i].Run = func(args map[string]any) (any, error) {
|
||||
@@ -754,7 +749,7 @@ func seatListTools() []stdio.Tool {
|
||||
if r == nil {
|
||||
return nil, errors.New("the seat list reader has not started yet: the runtime has not served this module")
|
||||
}
|
||||
return seatlist.Tools(r, names[0], names[1], callers)[run].Run(args)
|
||||
return seatlist.Tools(r, names[0], names[1])[run].Run(args)
|
||||
}
|
||||
}
|
||||
return shape
|
||||
|
||||
@@ -177,9 +177,9 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
|
||||
for _, x := range e.Start(ctx) {
|
||||
logger.Printf("the aside %s of %s's %s holds data the live bus lacks: recovery_restore_aside puts it back", x.Aside.ID, x.Module, x.Kept)
|
||||
}
|
||||
// The seat list, read over the connection and heard on the module's event hub (seatlist.Part), which the seat's verbs check
|
||||
// their callers against (A-179, A-186): registered before the hub starts, read again once its events are live.
|
||||
seats := seatlist.NewPart("recovery", nil)
|
||||
// The seat list, read over the connection and heard on the module's event hub (seatlist.Part), from which the seat's verbs
|
||||
// are answered (A-179, A-186): registered before the hub starts, read again once its events are live.
|
||||
seats := seatlist.NewPart("recovery")
|
||||
seats.Follow(seatlist.ProcessBus(conn.Call, hub), nil, logger.Printf)
|
||||
if err := hub.StartUntilBound(ctx, js, account, nil, seats.EventsLive); err != nil {
|
||||
logger.Printf("the consumer %s is not bound yet (%v): bound once the bus makes it, the seat list read then", account.EventConsumerName(), err)
|
||||
|
||||
@@ -40,13 +40,13 @@ func TestWhatTheProcessReads(t *testing.T) {
|
||||
t.Run("the seat's definition from the seat list once read (A-186)", func(t *testing.T) {
|
||||
t.Cleanup(busretry.Waits(20*time.Millisecond, time.Millisecond, 5*time.Millisecond))
|
||||
follow := func(silent bool) *seatlist.Part {
|
||||
p := seatlist.NewPart("recovery", nil)
|
||||
p := seatlist.NewPart("recovery")
|
||||
if r := p.Follow(listingCatalog{silent: silent}, nil, t.Logf); r != nil {
|
||||
<-r.Ready()
|
||||
}
|
||||
return p
|
||||
}
|
||||
if _, ok := seatlist.Definition(seatlist.NewPart("recovery", nil).Reader, meshbroker.Seat)(); ok {
|
||||
if _, ok := seatlist.Definition(seatlist.NewPart("recovery").Reader, meshbroker.Seat)(); ok {
|
||||
t.Error("a definition is answered before the seat list's reader started")
|
||||
}
|
||||
if _, ok := seatlist.Definition(follow(true).Reader, meshbroker.Seat)(); ok {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"callers": ["mesh-config"]
|
||||
}
|
||||
Reference in New Issue
Block a user