Files
mesh-catalog/modules/distribution/cmd/distribution/builds_test.go
T
jschoubben 8d73b5ba1b C3d REG2: distribution keeps no caller list; the build modules are the catalog half's claimants of node-build-* seats
The config `callers`, the tool registry_callers and its invokes, the caller-list code and the holder's per-verb
Allowed checks go. The windows' driver counts as build modules the modules claiming a `node-build-*` seat in the
catalog half, followed by the seat mesh-catalog's branch follower on the program's views reader (one shared events
hub); it wakes again when a build module's entry moves. The retention check of remove finds the artifact sweep's
holder through the seat mesh-module-assigner's holders (seatlist.HolderOf), not a name.

Builds: design 47 G §610, §7, §428, A-156, A-82
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:30:54 +01:00

38 lines
1.3 KiB
Go

package main
import (
"encoding/json"
"reflect"
"testing"
catalog "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
)
func entry(claims ...string) catalog.CatalogEntry {
var cs []any
for _, c := range claims {
cs = append(cs, map[string]any{"name": c, "scope": "node"})
}
return catalog.CatalogEntry{Manifest: map[string]any{"claims": cs}}
}
// Design 47 G §610, A-156: the build modules the driver counts are the modules claiming a `node-build-*` seat in the
// catalog half, whatever their names; no list of names is kept.
func TestBuildModulesAreTheClaimantsOfBuildSeats(t *testing.T) {
entries := map[string]catalog.CatalogEntry{
"a-compiler": entry("node-build-go"), "an-imager": entry("node-build-image", "something"),
"gitea": entry("git"), "mesh-build-go": entry("not-a-build-seat"), "no-claims": {Manifest: map[string]any{}},
}
if got, want := buildModulesOf(entries), []string{"a-compiler", "an-imager"}; !reflect.DeepEqual(got, want) {
t.Errorf("build modules = %v, want %v", got, want)
}
raw, _ := json.Marshal(entry("node-build-node"))
if !claimsBuildSeat("m", raw) {
t.Error("an entry claiming a build seat is not told as one")
}
raw, _ = json.Marshal(entry("git"))
if claimsBuildSeat("m", raw) {
t.Error("an entry claiming no build seat wakes the driver")
}
}