S12 class: a manifest says whether its module is core or a leaf
The gate reads a mover's class from its catalog entry; a module that names none is a leaf. Builds: design 47 H2 §810, §814; H-A-394 (1)
This commit is contained in:
@@ -25,3 +25,13 @@ func TestAManifestSaysEachKeptStoreThatNamesNoCap(t *testing.T) {
|
||||
t.Fatalf("the uncapped stores are %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
// Design 47 H2 §810 (H-A-394): a manifest says its class, core or leaf; one that names none is a leaf.
|
||||
func TestAManifestSaysItsClassAndNoneIsALeaf(t *testing.T) {
|
||||
for raw, leaf := range map[string]bool{`"class":"core",`: false, `"class":"leaf",`: true, ``: true} {
|
||||
m, err := decodeForTest([]byte(`{` + raw + `"module":"x","version":"1"}`))
|
||||
if err != nil || m.Leaf() != leaf || m.UnknownField() != "" {
|
||||
t.Errorf("%s read as class %q, leaf %v (%v, unknown %q), want leaf %v", raw, m.Class, m.Leaf(), err, m.UnknownField(), leaf)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,6 +452,15 @@ func (m Manifest) AnsweredByHelperFor(provision string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// The classes a module is (Manifest.Class; design 47 H2 §810, H-A-394).
|
||||
const (
|
||||
ClassCore = "core"
|
||||
ClassLeaf = "leaf"
|
||||
)
|
||||
|
||||
// Leaf is whether m is a leaf: its class says so, or it names none.
|
||||
func (m Manifest) Leaf() bool { return m.Class == "" || m.Class == ClassLeaf }
|
||||
|
||||
// Manifest is everything a module says about itself.
|
||||
type Manifest struct {
|
||||
Module string `json:"module"`
|
||||
@@ -830,6 +839,11 @@ type Manifest struct {
|
||||
DeclarationReads int `json:"declaration-reads,omitempty"`
|
||||
DeclarationWrites int `json:"declaration-writes,omitempty"`
|
||||
|
||||
// Class is ClassCore for a module whose delivery carries a contract of the mesh (one that claims a seat) and
|
||||
// ClassLeaf for one that claims none (design 47 H2 §810, H-A-394): the gate reads it from the module's catalog
|
||||
// entry. Absent is a leaf (Leaf); which manifest must name it is the manifest check's.
|
||||
Class string `json:"class,omitempty"`
|
||||
|
||||
// SecretsOwner is who the files holding this module's secrets belong to on the machine —
|
||||
// `uid:gid`, or a name — when its process is not root.
|
||||
//
|
||||
|
||||
@@ -69,7 +69,9 @@ func TestOwnManifestUsesNoWordTheRunningControllerRefuses(t *testing.T) {
|
||||
// The reference form a registry seat answers (ADR 0605 §9), and the seats the registry milestone adds.
|
||||
ReadForm + ReferenceFormSeat, ReadForm + ReferenceFormSeatReach, "seat:go-package-registry", "seat:container-image-registry", "seat:oci-artifact-registry",
|
||||
// H-A-388: the declaration Version a node-engine reads and a composer writes, the delivery plan's edge.
|
||||
"word:declaration-reads", "word:declaration-writes"} {
|
||||
"word:declaration-reads", "word:declaration-writes",
|
||||
// H-A-394: a module's class, core or leaf.
|
||||
"word:class"} {
|
||||
if !slices.Contains(added, want) {
|
||||
t.Errorf("%s is in the baseline, or not read: added since it are %v", want, added)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user