From 1182cadc9dfdcaccc24ac58797016c8323a07bbf Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 16 Nov 2026 02:34:22 +0100 Subject: [PATCH] approval: before the catalog half is read, a module account's call runs unmarked, seat verb or tool, and a module's own call in its runtime of its own (design 47 G A-433) --- go/approval/approval_test.go | 20 ++++++++++++++++---- go/approval/run.go | 16 +++++++++------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/go/approval/approval_test.go b/go/approval/approval_test.go index b0e6287f..f53bdc1c 100644 --- a/go/approval/approval_test.go +++ b/go/approval/approval_test.go @@ -149,9 +149,10 @@ func TestAnUnreadCatalogHalfLetsItsOwnReadsThrough(t *testing.T) { {"", "bridge_merged_message", false, nil, "person.operator", false}, // a person {"", "bridge_merged_message", false, nil, "controller", false}, {"", "bridge_merged_message", false, nil, "unproven", false}, - {"", "bridge_merged_message", false, nil, "n1.mesh-delivery-indexer", false}, // the tool's own module + {"", "bridge_merged_message", true, nil, "n1.mesh-delivery-indexer", false}, // the tool's own module's account (A-433) {"", "ledger_repair", false, nil, "n1.mesh-delivery-runner", true}, // the runner's own tool - {"git", "merge-pull", false, nil, "n1.mesh-delivery-runner", false}, // a seat verb's act is no module tool + {"git", "merge-pull", true, nil, "n1.mesh-delivery-runner", false}, // a module's account, a seat verb too (A-433) + {"git", "merge-pull", false, nil, "n1.node-tools", false}, // the console's account stays held } { ran := false address := tc.seat + "." + tc.name @@ -171,14 +172,25 @@ func TestAnUnreadCatalogHalfLetsItsOwnReadsThrough(t *testing.T) { t.Errorf("%s: refused with %v, want the marks not read yet", address, err) } } - if waited != 20 { - t.Errorf("the other calls waited for the catalog half %d times, want 20 (the start reads wait for nothing)", waited) + if waited != 19 { + t.Errorf("the other calls waited for the catalog half %d times, want 19 (the start reads wait for nothing)", waited) } want := []string{ "[approval] mesh-delivery-indexer.bridge_merged_message called by n2.mesh-delivery-forge-bridge: run unmarked before the catalog half is read", "[approval] mesh-delivery-indexer.read_modules called by n1.mesh-delivery-runner: run unmarked before the catalog half is read", + "[approval] git.merge-pull called by n1.mesh-delivery-runner: run unmarked before the catalog half is read", } if strings.Join(logged, "\n") != strings.Join(want, "\n") { t.Errorf("logged %q, want each module tool run unmarked once with its caller %q", logged, want) } + // A-433: a module's runtime of its own (its runner the module itself) runs its own account's seat call while unread, as the + // indexer's runtime asks its own mesh-catalog.revision for the first view it waits on; a seat the definition does not class + // read, so no start read. + own := New(Deps{Node: "n1", Runner: "mesh-delivery-indexer", Catalog: unread{defs: map[string]seatdef.Definition{}}, + Wait: func(time.Duration) error { return errors.New("still unread") }, Logf: func(string, ...any) {}}) + ran := false + if _, err := own.Run(Call{Address: "mesh-catalog.revision", Module: "mesh-delivery-indexer", Seat: "mesh-catalog", Name: "revision", + Fingerprint: "fp1", Caller: "n1.mesh-delivery-indexer"}, func() (any, error) { ran = true; return "ok", nil }); err != nil || !ran { + t.Errorf("the module's own seat call in its own runtime: ran %v (%v), want it run", ran, err) + } } diff --git a/go/approval/run.go b/go/approval/run.go index e97dd6cb..afaacf4f 100644 --- a/go/approval/run.go +++ b/go/approval/run.go @@ -90,17 +90,19 @@ func (g *Gate) startRead(c Call) bool { return i >= 0 && def.Verbs[i].Class == seatdef.ClassRead && !def.Verbs[i].NeedsApproval } -// calledByModule says a module tool runs unmarked while the catalog half is unread (design 47 G lead answers A-389): one -// whose proven caller is another module's account, `.` naming neither the tool's module nor the runner's -// own, which is the account the console and the sessions through it call as; a person's, the controller's or an unproven -// caller is none. The runner's own tools served under a module's name are no module tool. Each such tool is logged once, -// with its caller. +// calledByModule says a call runs unmarked while the catalog half is unread (design 47 G lead answers A-389, A-433): one +// whose proven caller is a module's account, `.`, a seat verb or a module tool alike, and the module itself +// in a runtime of its own; never the runner's own account where the runner serves other modules (the console's, which the +// sessions and agents call as), a person's, the controller's or an unproven caller. Approval marks are for agent calls; a +// module's account may do everything (principle 6), and a runtime of its own asks its own seat for the very first view it +// waits on (novox 2026-11-16: the indexer's runtime refused its own mesh-catalog.revision for ever). The runner's own tools +// are none. Each such call is logged once, with its caller. func (g *Gate) calledByModule(c Call) bool { - if c.Seat != "" || c.Own || strings.HasPrefix(c.Caller, "person.") { + if c.Own || strings.HasPrefix(c.Caller, "person.") { return false } node, module, ok := strings.Cut(c.Caller, ".") - if !ok || node == "" || module == "" || strings.Contains(module, ".") || module == c.Module || module == g.d.Runner { + if !ok || node == "" || module == "" || strings.Contains(module, ".") || (module == g.d.Runner && g.d.Runner != c.Module) { return false } g.mu.Lock()