catalogue's compiled set is read from git.novox.be/novox/mesh-contracts/go/seats; the hand-written seat literal and its
verb builders go. The bar's block keeps its checks as code beside the data. A case of the seat set's test holds the
generated set equal, entry for entry, to the list compiled at 5a38a12 (testdata), but for the whole seats' additions
and the vault's two verbs; the three new registry seats are the only new entries. A holder of mesh-broker now serves its
eight verbs.
SDK-12: the vault's seat no longer promises accept and move-asks, which no holder served and nothing called; retire is
optional (design 32). The intake and move rows join one table; the move's own test goes with the two verbs.
Requires mesh-contracts (no version on the forge yet: a go.work, uncommitted, uses the sibling worktree until the
group pins it).
Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
62 lines
2.1 KiB
Go
62 lines
2.1 KiB
Go
package catalogue
|
|
|
|
import (
|
|
"encoding/json"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
// Defends novox/hq ADR 0208: the graphical session is one module per piece, on the mesh's seats.
|
|
|
|
// §2: the eleven roles are the mesh's own node seats, each with the verbs it starts with.
|
|
func TestTheGraphicalSessionsSeatsAreTheMeshsOwnWithTheirVerbs(t *testing.T) {
|
|
want := map[string][]string{
|
|
LoginManagerSeat: {"sessions"},
|
|
DisplayServerSeat: {"displays", "layout"},
|
|
DisplaySessionSeat: {"reload", "workspaces", "windows"},
|
|
TerminalEmulatorSeat: {"open"},
|
|
LauncherSeat: {"menu", "secret"},
|
|
NotifierSeat: {"send", "history"},
|
|
LockScreenSeat: {"lock"},
|
|
ClipboardSeat: {"history", "copy"},
|
|
BarSeat: nil,
|
|
CompositorSeat: nil,
|
|
SecretServiceSeat: nil,
|
|
}
|
|
for name, verbs := range want {
|
|
s, ok := SeatNamed(name)
|
|
if !ok {
|
|
t.Errorf("%s is not in the mesh's set", name)
|
|
continue
|
|
}
|
|
if s.Scope != ScopeNode || s.Decision != "novox/hq ADR 0208" {
|
|
t.Errorf("%s is %s-scoped under %q", name, s.Scope, s.Decision)
|
|
}
|
|
var got []string
|
|
for _, v := range s.Serves {
|
|
got = append(got, v.Name)
|
|
if v.Description == "" || v.Input["type"] != "object" {
|
|
t.Errorf("%s.%s has no description or no object schema", name, v.Name)
|
|
}
|
|
}
|
|
if !reflect.DeepEqual(got, verbs) {
|
|
t.Errorf("%s serves %v, want %v", name, got, verbs)
|
|
}
|
|
}
|
|
// The launcher's menu takes a list, and the layout verb says its actions.
|
|
menu, _ := SeatNamed(LauncherSeat)
|
|
choices := menu.Serves[0].Input["properties"].(map[string]any)["choices"].(map[string]any)
|
|
if choices["type"] != "array" {
|
|
t.Errorf("menu's choices are %v, not a list", choices["type"])
|
|
}
|
|
display, _ := SeatNamed(DisplayServerSeat)
|
|
action := display.Serves[1].Input["properties"].(map[string]any)["action"].(map[string]any)
|
|
if !reflect.DeepEqual(action["enum"], []string{"list", "save", "apply"}) {
|
|
t.Errorf("layout's actions are %v", action["enum"])
|
|
}
|
|
// And they survive the store's JSON, which is where the live set comes from.
|
|
if _, err := json.Marshal(DefaultSeats()); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|