Files
mesh-delivery/modules/mesh-delivery-checker/internal/check/names.go
T
jschoubben 1db4728081 B1 (checker): the checker's own buckets, events and asker are named from its credential's module
CheckerModule and the buckets built on it are gone; check.Bucket names a state of the credential's module, the examiner
takes the module as its asker, the tools take the served-as module, and the tools ask the indexer's read tools of the
holder of the seat mesh-catalog on each call (B2's tool addresses for the checker).

Builds: design 47 G A-296, A-210, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:35:14 +01:00

84 lines
3.5 KiB
Go

package check
import (
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshwatchdogs"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
checker "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdeliverychecker"
)
// The holders and buckets the checker names. No contract names a holder (novox/hq ADR 0625 §4, ADR 0634 §1), so these are its
// own constants, each a state of a seat (the seat's state name beside the holder's module name) and each declared in its
// manifest (module.json: its own states, its `reads`); a unit row checks them against the manifest (TestTheNamesAreTheManifests).
const (
// GateModule holds the seat mesh-delivery's states source and turns, which the checker reads (reads: mesh-delivery-gate.source,
// mesh-delivery-gate.turns).
GateModule = "mesh-delivery-gate"
// IndexerModule holds the seat mesh-catalog's states, which the checker follows by their views (consumes:
// mesh-delivery-indexer.views.*).
IndexerModule = "mesh-delivery-indexer"
CandidatesBucket = IndexerModule + "_" + meshcatalog.StateCandidates
ModulesBucket = IndexerModule + "_" + meshcatalog.StateModules
ManifestsBucket = IndexerModule + "_" + meshcatalog.StateManifests
IndexerPredefinedState = meshcatalog.StatePredefined
// WatchmanModule holds the seat mesh-watchdogs' presence (reads: mesh-delivery-watchman.presence).
WatchmanModule = "mesh-delivery-watchman"
PresenceBucket = WatchmanModule + "_" + meshwatchdogs.StatePresence
// HaveBucket is the node-engine's state have (reads: node-engine.have); a node's own key ends in HaveNodeWord.
HaveBucket = "node-engine_" + nodeengine.StateHave
HaveNodeWord = "node"
// compositionWaits is the state of the assigner's composition answer that waits for what it composes from.
compositionWaits = "waits"
)
// FailedFirst names what failed: a test (its package and name) or a machine, with the words of the failure. It is the shape of
// the verdict's `failed` and of each entry of its `failures` (the seat's two types of it have the same fields), so the check
// judges with one and converts at the verdict's edge (failureItems, failedList).
type FailedFirst = checker.VerdictsByGroupHeadsValueFailed
// failedOf is the first failure a verdict names: the zero value of a verdict that names none.
func failedOf(v checker.VerdictsByGroupHeadsValue) FailedFirst {
if v.Failed == nil {
return FailedFirst{}
}
return *v.Failed
}
// tookOf is the time of each part of a check a verdict names: the zero value of a verdict that names none.
func tookOf(v checker.VerdictsByGroupHeadsValue) checker.VerdictsByGroupHeadsValueTook {
if v.Took == nil {
return checker.VerdictsByGroupHeadsValueTook{}
}
return *v.Took
}
func failureItems(list []FailedFirst) []checker.VerdictsByGroupHeadsValueFailuresItem {
if list == nil {
return nil
}
out := make([]checker.VerdictsByGroupHeadsValueFailuresItem, len(list))
for i, f := range list {
out[i] = checker.VerdictsByGroupHeadsValueFailuresItem(f)
}
return out
}
func failedList(items []checker.VerdictsByGroupHeadsValueFailuresItem) []FailedFirst {
if items == nil {
return nil
}
out := make([]FailedFirst, len(items))
for i, f := range items {
out[i] = FailedFirst(f)
}
return out
}
// Bucket is the bucket of one of the checker's own states, `<module>_<state>`, module its credential's, never a constant
// (design 47 G A-296, §428).
func Bucket(module, state string) string { return module + "_" + state }