The tests G added fold into existing ones as subtests (design 47 G §626, A-306: 171 tests down to 154, integration 9 down to 7). TestMeshWaitRefusesLoudlyAndNeverLoops runs its groups of one-second rows as parallel subtests, each on a runtime of its own, 15 s down to 5 s (A-311: the one-second floor of a wait's timeout stands, no clock is injected). The go.mod no longer requires meshconditionsclient, which no package loads (T4). Node names in the lines G adds are role names (T5). Builds: design 47 G §626, design 34 every-event §19, A-306, A-311; review round 2 findings T2, T3, T4, T5 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
27 lines
922 B
Go
27 lines
922 B
Go
package runtime
|
|
|
|
import (
|
|
"git.novox.be/novox/mesh-sdk/go/approval"
|
|
)
|
|
|
|
// gateHolding is the runner's gate as far as the runtime reaches it: it records the calls it is run for and answers
|
|
// `approvals` from them.
|
|
type gateHolding struct{ calls []approval.Call }
|
|
|
|
func (g *gateHolding) Unserved(string, string, []string) []string { return nil }
|
|
func (g *gateHolding) Run(c approval.Call, run func() (any, error)) (any, error) {
|
|
g.calls = append(g.calls, c)
|
|
return run()
|
|
}
|
|
func (g *gateHolding) Approvals(caller string) (approval.Approvals, error) {
|
|
out := approval.Approvals{Calls: []approval.ListedCall{}, Acts: []approval.ListedAct{}, Claims: []string{}}
|
|
for i, c := range g.calls {
|
|
l := approval.ListedCall{Call: string(rune('a' + i)), Caller: c.Caller, Verb: c.Seat + "." + c.Name, State: "waiting"}
|
|
if caller == c.Caller {
|
|
l.Arguments = c.Args
|
|
}
|
|
out.Calls = append(out.Calls, l)
|
|
}
|
|
return out, nil
|
|
}
|