From 98ed28c1d1860874f253658762a227d457da3a9c Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 00:21:38 +0100 Subject: [PATCH] S12 class: a manifest says whether its module is core or a leaf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- go/catalogue/caps_test.go | 10 ++++++++++ go/catalogue/manifest.go | 14 ++++++++++++++ go/catalogue/own_manifest_test.go | 4 +++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/go/catalogue/caps_test.go b/go/catalogue/caps_test.go index 92d051f4..1bbb42fc 100644 --- a/go/catalogue/caps_test.go +++ b/go/catalogue/caps_test.go @@ -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) + } + } +} diff --git a/go/catalogue/manifest.go b/go/catalogue/manifest.go index 56154d6f..61065464 100644 --- a/go/catalogue/manifest.go +++ b/go/catalogue/manifest.go @@ -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. // diff --git a/go/catalogue/own_manifest_test.go b/go/catalogue/own_manifest_test.go index 1a1131a3..b08babff 100644 --- a/go/catalogue/own_manifest_test.go +++ b/go/catalogue/own_manifest_test.go @@ -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) }