Files
mesh-tools/node-tools/internal/console/manifest_waits_test.go
T
jschoubben 64bb49209c node-tools: a session may wait on the gate's approval and on every asker's asks opening and decided
The operator, 2026-10-30: an Approve must be acted on and known at once, and a session should hear approval requests. Adds mesh-delivery-gate.approval (approved, or approved and not handed past 60 s) and, one family per asker that uses the operator-channel seat, operator-channel.asked.<asker> and operator-channel.decided.<asker>. Named one by one (ADR 0367 §2). Needs mesh-catalog fix/turn-handed-on-approve first: the gate's approval event and the seat's asked event are declared there.
2026-10-30 11:45:00 +01:00

51 lines
2.1 KiB
Go

package console
import (
"encoding/json"
"os"
"reflect"
"strings"
"testing"
)
// novox/hq ADR 0367 §5: the tool runner's manifest names the families a session waits on today, one by one,
// and the asker's `decided` for the claude-code module alone. Adding one is a reviewed change to this file
// (§6), so this list changes with it. The delivery's transitions are waited on under the gate's name alone (ADR 0450 §8, issues 1350
// and 1406): today's module is forgotten.
func TestTheManifestNamesTheFirstFamiliesOneByOne(t *testing.T) {
raw, err := os.ReadFile("../../module.json")
if err != nil {
t.Fatal(err)
}
var m struct {
Module string `json:"module"`
Waits []string `json:"waits"`
Consumes []string `json:"consumes"`
}
if err := json.Unmarshal(raw, &m); err != nil {
t.Fatal(err)
}
// 2026-10-30, the operator: "an approval given by me must get handled accordingly and you should know about it
// immediately" and "you should be able to hook into approval requests": the gate's approval (approved, not handed),
// and every asker's asks opening and decided, one family per asker.
want := []string{"mesh-knowledge.reviewed", "mesh-delivery-gate.transition", "gitea.forge.status",
"mesh-controller.checked", "operator-channel.decided.claude-code", "mesh-delivery-gate.approval"}
for _, asker := range []string{"mesh-config", "mesh-delivery-assigner", "mesh-delivery-teller", "mesh-grants", "mesh-knowledge", "mesh-mail", "pacman"} {
want = append(want, "operator-channel.decided."+asker)
}
for _, asker := range []string{"claude-code", "mesh-config", "mesh-delivery-assigner", "mesh-delivery-teller", "mesh-grants", "mesh-knowledge", "mesh-mail", "pacman"} {
want = append(want, "operator-channel.asked."+asker)
}
if m.Module != "node-tools" || !reflect.DeepEqual(m.Waits, want) {
t.Errorf("%s waits on %v, want %v", m.Module, m.Waits, want)
}
for _, w := range m.Waits {
if strings.ContainsAny(w, "*>") {
t.Errorf("a family named by a wildcard: %s", w)
}
}
if len(m.Consumes) > 0 {
t.Errorf("the tool runner consumes %v: a wait is no consumer (ADR 0367 §2)", m.Consumes)
}
}