Fill the gate's Call.Env from the bundle's composed environment (A-377)

Builds: design 47 G A-377

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-13 23:17:54 +01:00
parent 27a45d414d
commit faa1064214
2 changed files with 49 additions and 1 deletions
+6 -1
View File
@@ -241,6 +241,9 @@ type runner struct {
// §424, §618), never the runner's own.
fingerprintOf func(module string) string
// envOf is a module's composed environment, the words the gate tells a first-view tool by (lead answers A-377).
envOf func(module string) map[string]string
seatsAgain func()
stops []func() // the watch, the announcement and the seats, in the order they began
}
@@ -275,6 +278,7 @@ func Run(conn *bus.Conn, served []Served, envs map[string]map[string]string, log
base := os.Environ()
r.envFor = func(module string) []string { return BundleEnv(base, envs[module], module, node) }
r.fingerprintOf = func(module string) string { return envs[module][FingerprintWord] }
r.envOf = func(module string) map[string]string { return envs[module] }
// The module's events, for every child of it that subscribes (ADR 0198): one consumer per module,
// bound the first time any of its children subscribes, each event handed to every child that did.
@@ -479,7 +483,8 @@ func (r *runner) serve(l *loadedModule) {
module, own := reg.module, reg.repairs
stop, err := r.conn.HandleCalled(reg.module+"."+t.Name, func(caller string, body json.RawMessage) (any, error) {
return r.events.gated(approval.Call{Address: module + "." + t.Name, Module: module, Name: t.Name, Own: own,
Fingerprint: r.fingerprintOf(module), Caller: caller, Args: argsOf(body), Description: t.Description}, t, caller)
Fingerprint: r.fingerprintOf(module), Env: r.envOf(module), Caller: caller, Args: argsOf(body),
Description: t.Description}, t, caller)
})
if err != nil {
r.logf("[mesh-tools] cannot serve %s.%s: %v", reg.module, t.Name, err)