M-class (enrolment): class core, the finding stream at 8 MiB

It claims the seat mesh-node-enroller, so its class is core; its finding
stream keeps 7 days at 8 MiB, not 16, as every module's does (live fill of
its findings state: 0 bytes).

Builds: design 47 H2 §810, §814, §820; H-A-394 (1)
This commit is contained in:
2026-11-22 02:47:46 +01:00
parent 8c50d77b04
commit 6545469a2b
2 changed files with 8 additions and 5 deletions
@@ -76,6 +76,7 @@ func theManifestSaysWhatTheCodeDoes(t *testing.T) {
}
var m struct {
Module string `json:"module"`
Class string `json:"class"`
Runs string `json:"runs-as"`
Consumes []string `json:"consumes"`
Claims []struct {
@@ -98,9 +99,10 @@ func theManifestSaysWhatTheCodeDoes(t *testing.T) {
if err := json.Unmarshal(raw, &m); err != nil {
t.Fatal(err)
}
// It claims a seat, so its class is core (design 47 H2 §810, §814; H-A-394 (1)).
if m.Runs != m.Module || len(m.Claims) != 1 || m.Claims[0].Name != Seat || m.Claims[0].Scope != "mesh" ||
!slices.Equal(m.Claims[0].Serves, Verbs) || len(m.Emits) != 0 {
t.Errorf("module %q runs as %q, claims %+v, emits %v", m.Module, m.Runs, m.Claims, m.Emits)
!slices.Equal(m.Claims[0].Serves, Verbs) || len(m.Emits) != 0 || m.Class != "core" {
t.Errorf("module %q runs as %q, class %q, claims %+v, emits %v", m.Module, m.Runs, m.Class, m.Claims, m.Emits)
}
if slices.Contains(m.Reads, "mesh-controller.lease") {
t.Error("the manifest reads the controller's lease, which the code no longer reads (issue 1126)")
@@ -149,10 +151,10 @@ func theManifestSaysWhatTheCodeDoes(t *testing.T) {
t.Errorf("state %s: enrolments must allow a time to live per key", m.State)
}
// Design 47 G §383, §387 (A-30): its findings are the requires findings (state) and finding-events (the three finding
// events, 7 days, 16 MiB), not a state or a stream of its own.
// events, 7 days, 8 MiB: design 47 H2 §820), not a state or a stream of its own.
if len(m.Requires) != 2 || m.Requires[0].Name != "findings" || m.Requires[0].Storage != "key-value" || m.Requires[0].Template != "state" ||
m.Requires[1].Name != "finding-events" || m.Requires[1].Storage != "stream" || m.Requires[1].Template != "events" ||
m.Requires[1].Options["max-age-days"] != float64(7) || m.Requires[1].Options["max-mib"] != float64(16) ||
m.Requires[1].Options["max-age-days"] != float64(7) || m.Requires[1].Options["max-mib"] != float64(8) ||
!reflect.DeepEqual(m.Requires[1].Options["events"], []any{"finding-written.*", "finding-cleared.*", "findings-stated.*"}) {
t.Errorf("requires %+v: want the findings state and the finding stream", m.Requires)
}
+2 -1
View File
@@ -1,6 +1,7 @@
{
"module": "mesh-enrolment",
"version": "0.1",
"class": "core",
"runs-as": "mesh-enrolment",
"claims": [
{
@@ -109,7 +110,7 @@
"findings-stated.*"
],
"max-age-days": 7,
"max-mib": 16
"max-mib": 8
}
}
]