From 56ca9a9791f2dfe0fc55a82022e352bd300a82f0 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 02:48:54 +0100 Subject: [PATCH] M-class (view): class core, every state capped, the finding stream at 8 MiB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The view claims the seat mesh-delivery-view, so its class is core and every store it keeps names its cap. Fills read on novox (nats_buckets, 2026-11-22 02:50), all under a quarter of 8 MiB, so 8 MiB each: reach 280,654 bytes, waits 39,678, first-views 7,521, findings 3,400, view-marks 237, answers 0. Its finding stream keeps 7 days at 8 MiB, not 16. Builds: design 47 H2 §810, §812, §814, §820; H-A-394 (1), H-A-437 --- modules/mesh-delivery-view/manifest_test.go | 15 +++++++++++---- modules/mesh-delivery-view/module.json | 21 ++++++++++++++------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/modules/mesh-delivery-view/manifest_test.go b/modules/mesh-delivery-view/manifest_test.go index 17e3f7a24..e43b476c7 100644 --- a/modules/mesh-delivery-view/manifest_test.go +++ b/modules/mesh-delivery-view/manifest_test.go @@ -53,6 +53,7 @@ type item struct { type state struct { Name string `json:"name"` History int `json:"history,omitempty"` + MaxMiB int `json:"max-mib,omitempty"` } type stream struct { @@ -72,6 +73,7 @@ type claim struct { type manifest struct { Packages map[string]string `json:"packages"` Claims []claim `json:"claims"` + Class string `json:"class"` State []state `json:"state"` Module string `json:"module"` Moved bool `json:"moved"` @@ -191,6 +193,10 @@ func TestManifestIsTakenAndReadsOnly(t *testing.T) { // 1134/AC7 if len(m.Streams) != 0 { t.Errorf("streams = %+v: the finding stream is a require now", m.Streams) } + // design 47 H2 §810, §814; H-A-394 (1): it claims a seat, so its class is core. + if m.Class != "core" { + t.Errorf("class = %q, want core", m.Class) + } if want := findingRequires(1); !reflect.DeepEqual(m.Requires, want) { t.Errorf("requires = %+v, want %+v", m.Requires, want) } @@ -215,7 +221,8 @@ func TestManifestIsTakenAndReadsOnly(t *testing.T) { // 1134/AC7 // The states the view writes: the operator's answers to the asks that need no proof (ADR 0528 clause 6, 1297/B9), which the // teller reads, and how far each repository reached (ADR 0556 clause 2, issue 1280), which the gate reads. // Its first views of the owners' states and the finding of one unanswered past its bound (ADR 0615 §6). - if want := []state{{Name: "answers", History: 5}, {Name: "reach", History: 1}, {Name: "waits", History: 1}, {Name: "first-views", History: 1}, {Name: "view-marks", History: 1}}; !reflect.DeepEqual(m.State, want) { + // design 47 H2 §812, §814; H-A-437: each names its cap, 8 MiB, every live fill under 2 MiB (reach 280,654 bytes on 2026-11-22). + if want := []state{{Name: "answers", History: 5, MaxMiB: 8}, {Name: "reach", History: 1, MaxMiB: 8}, {Name: "waits", History: 1, MaxMiB: 8}, {Name: "first-views", History: 1, MaxMiB: 8}, {Name: "view-marks", History: 1, MaxMiB: 8}}; !reflect.DeepEqual(m.State, want) { t.Errorf("state = %+v, want %+v", m.State, want) } if _, ok := m.OwnSecrets["broker"]; !ok || len(m.OwnSecrets) != 1 { @@ -527,11 +534,11 @@ type require struct { } // findingRequires is the findings state and the finding stream a module asks for by their templates (design 47 G -// §383, §387; A-30): 7 days and 16 MiB, the findings state keeping the given history. +// §383, §387; A-30): 7 days and 8 MiB (design 47 H2 §820), the findings state keeping the given history at 8 MiB (§812). func findingRequires(history float64) []require { return []require{ - {Name: "findings", Storage: "key-value", Template: "state", Options: map[string]any{"history": history}}, + {Name: "findings", Storage: "key-value", Template: "state", Options: map[string]any{"history": history, "max-mib": float64(8)}}, {Name: "finding-events", Storage: "stream", Template: "events", Options: map[string]any{ - "events": []any{"finding-written.*", "finding-cleared.*", "findings-stated.*"}, "max-age-days": float64(7), "max-mib": float64(16)}}, + "events": []any{"finding-written.*", "finding-cleared.*", "findings-stated.*"}, "max-age-days": float64(7), "max-mib": float64(8)}}, } } diff --git a/modules/mesh-delivery-view/module.json b/modules/mesh-delivery-view/module.json index c8b859e87..6b5ded663 100644 --- a/modules/mesh-delivery-view/module.json +++ b/modules/mesh-delivery-view/module.json @@ -1,6 +1,7 @@ { "module": "mesh-delivery-view", "version": "0.1", + "class": "core", "packages": { "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks": "0.3" }, @@ -52,23 +53,28 @@ "state": [ { "name": "answers", - "history": 5 + "history": 5, + "max-mib": 8 }, { "name": "reach", - "history": 1 + "history": 1, + "max-mib": 8 }, { "name": "waits", - "history": 1 + "history": 1, + "max-mib": 8 }, { "name": "first-views", - "history": 1 + "history": 1, + "max-mib": 8 }, { "name": "view-marks", - "history": 1 + "history": 1, + "max-mib": 8 } ], "consumes": [ @@ -258,7 +264,8 @@ "storage": "key-value", "template": "state", "options": { - "history": 1 + "history": 1, + "max-mib": 8 } }, { @@ -272,7 +279,7 @@ "findings-stated.*" ], "max-age-days": 7, - "max-mib": 16 + "max-mib": 8 } } ]