T2b first-view tool by name form: the gate env test names no MESH_VIEW_CALLERS word
The runner sets no MESH_VIEW_CALLERS env; the gate knows a first-view tool by its name forms (mesh-sdk 77a7b187). Builds: design 47 H §752, H-A-69 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -6,16 +6,16 @@ import (
|
||||
mt "github.com/novox/mesh-tools/node-tools/internal/meshtest"
|
||||
)
|
||||
|
||||
// Design 47 G lead answers A-377: the call a module's tool reaches the gate by carries the module's composed
|
||||
// environment, so the gate tells a first-view tool (the one whose MESH_VIEW_CALLERS_<TOOL> the bundle holds) from an
|
||||
// ordinary one while its catalog half is unread.
|
||||
// The call a module's tool reaches the gate by carries the module's composed environment. The gate no longer tells a first-view tool
|
||||
// by an environment word: it knows one by its name forms <module>_first_views and <module>_first_view_again (H-A-69), and the runner
|
||||
// sets no view-callers word.
|
||||
func TestAModuleToolsCallCarriesItsBundlesComposedEnvironment(t *testing.T) {
|
||||
for name, tc := range map[string]struct {
|
||||
envs map[string]map[string]string
|
||||
want bool
|
||||
}{
|
||||
"a first-view tool": {map[string]map[string]string{"ledger": {"MESH_VIEW_CALLERS_WHO": "grants"}}, true},
|
||||
"an ordinary tool": {nil, false},
|
||||
"a module with an environment": {map[string]map[string]string{"ledger": {"LEDGER_WORD": "x"}}, true},
|
||||
"a module with none": {nil, false},
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
mesh := mt.New(t)
|
||||
@@ -32,11 +32,11 @@ func TestAModuleToolsCallCarriesItsBundlesComposedEnvironment(t *testing.T) {
|
||||
var found bool
|
||||
for _, c := range gate.calls {
|
||||
if c.Seat == "" && c.Name == "who" {
|
||||
_, found = c.Env["MESH_VIEW_CALLERS_WHO"]
|
||||
_, found = c.Env["LEDGER_WORD"]
|
||||
}
|
||||
}
|
||||
if found != tc.want {
|
||||
t.Errorf("the gate saw the first-view word: %v, want %v (calls %+v)", found, tc.want, gate.calls)
|
||||
t.Errorf("the gate saw the composed word: %v, want %v (calls %+v)", found, tc.want, gate.calls)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user