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
67 lines
2.2 KiB
Go
67 lines
2.2 KiB
Go
package main
|
|
|
|
// The build modules the windows' driver counts (design 47 G §610, A-156, A-82): the modules that claim a build seat
|
|
// (`node-build-*`) in the catalog half, followed per watched branch by the seat mesh-catalog's client on the program's
|
|
// one views reader. No list of names is kept here, and none is configured.
|
|
|
|
import (
|
|
"encoding/json"
|
|
"slices"
|
|
"strings"
|
|
|
|
"git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient"
|
|
catalog "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
|
|
)
|
|
|
|
// buildSeatPrefix starts the name of every seat a build module claims.
|
|
const buildSeatPrefix = "node-build-"
|
|
|
|
// buildModulesOf are the modules among entries whose manifest claims a build seat, sorted.
|
|
func buildModulesOf(entries map[string]catalog.CatalogEntry) []string {
|
|
var out []string
|
|
for module, e := range entries {
|
|
claims, _ := e.Manifest["claims"].([]any)
|
|
for _, c := range claims {
|
|
if name, _ := c.(map[string]any)["name"].(string); strings.HasPrefix(name, buildSeatPrefix) {
|
|
out = append(out, module)
|
|
break
|
|
}
|
|
}
|
|
}
|
|
slices.Sort(out)
|
|
return out
|
|
}
|
|
|
|
// claimsBuildSeat says whether a module's entry, as the branch follower tells it, claims a build seat.
|
|
func claimsBuildSeat(module string, raw json.RawMessage) bool {
|
|
var e catalog.CatalogEntry
|
|
if json.Unmarshal(raw, &e) != nil {
|
|
return true // an entry not read may be one: the driver judges again
|
|
}
|
|
return len(buildModulesOf(map[string]catalog.CatalogEntry{module: e})) == 1
|
|
}
|
|
|
|
// branchesBuilds answers the driver's build modules from the catalog half of every followed branch; with a branch that has
|
|
// no first view yet it is an error naming it, never no build module.
|
|
type branchesBuilds struct{ b *meshcatalogclient.Branches }
|
|
|
|
func (h branchesBuilds) Modules() ([]string, error) {
|
|
if err := h.b.Ready(); err != nil {
|
|
return nil, err
|
|
}
|
|
all := map[string]catalog.CatalogEntry{}
|
|
for _, branch := range h.b.Followed() {
|
|
c, ok := h.b.Catalog(branch)
|
|
if !ok {
|
|
continue
|
|
}
|
|
half, _ := c.View() // a branch at none-yet is ready and empty (§614)
|
|
for m, e := range half.Entries {
|
|
if _, ok := all[m]; !ok {
|
|
all[m] = e
|
|
}
|
|
}
|
|
}
|
|
return buildModulesOf(all), nil
|
|
}
|