Files
mesh-delivery/modules/mesh-delivery-sdk/graph/reads.go
T
jschoubben 71a35a6376 MV1: move contracts and sdk under modules/, importers follow
The delivery repository's contracts and SDK live under modules/ as
mesh-delivery-contracts and mesh-delivery-sdk, their Go module paths
renamed to match the folders (the TypeScript names already did), and
every importer in mesh-delivery, mesh-catalog, mesh-host, mesh-tools
and mesh-sdk follows in the same group: a design as it should be, one
path per module, checked by the group's check building every importer.

Builds: design 47 G §427, §88

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:09:56 +01:00

38 lines
1.4 KiB
Go

package graph
import (
"slices"
"strings"
"sync"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/seatlist"
)
// bootstrappedReads are the reader capabilities `seat:<seat>` of the bootstrapped seats: the embedded files' own, so
// computed once.
var bootstrappedReads = sync.OnceValue(func() []string {
var out []string
for _, d := range seatlist.Bootstrapped() {
out = append(out, catalogue.ReadSeat+d.Seat)
}
return out
})
// MissingReads is catalogue.MissingManifestReads with every need of a bootstrapped seat counted as read (novox/hq ADR 0614
// §4, ADR 0636 §2): every reader of the seat list holds the bootstrapped seats from its start, before it has read the list,
// so a manifest naming one is read by every node-engine whatever its statement names. Without it an engine whose statement
// was made before its list was in use states no seat, and the node-engine's own build naming mesh-catalog is held on the
// very engine that would state it (issue 1966). The assigner's capability hold and the indexer's hold both judge with it,
// so the rule is one.
func MissingReads(needs, stated []string) []string {
boot := bootstrappedReads()
missing := slices.DeleteFunc(catalogue.MissingManifestReads(needs, stated), func(n string) bool {
return strings.HasPrefix(n, catalogue.ReadSeat) && slices.Contains(boot, n)
})
if len(missing) == 0 {
return nil
}
return missing
}