O-9: C-S9, C-S10: the any-size package tested whole against the bus, and never imported by the process package (milestone 47/G, issue 1966, ADR 0666 section 16, ADR 0595 section 9)

Builds: design 47 G §61, §62

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
2026-11-11 10:51:06 +01:00
parent 8cb13d1033
commit 126053388e
2 changed files with 37 additions and 0 deletions
+9
View File
@@ -186,6 +186,15 @@ func TestMeshSDKHoldsOnlyWhatEveryModuleShares(t *testing.T) {
}
}
}
// 1966/C-S10: the any-size package is imported by the modules that use it only, never by the module library (the
// root package, about 112 importers) or the process package, so a change to it rebuilds none of theirs (ADR 0595 §9).
if dir == "." || dir == "process" {
for _, imp := range file.Imports {
if p, _ := strconv.Unquote(imp.Path.Value); p == sdkModule+"/stateobjects" {
t.Errorf("%s imports %s: the module library and the process package never import the any-size package (ADR 0595 §9)", path, p)
}
}
}
for _, decl := range file.Decls {
fn, ok := decl.(*ast.FuncDecl)
if !ok {
@@ -13,6 +13,7 @@ import (
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-sdk/go/testbus"
"git.novox.be/novox/mesh-sdk/go/views"
)
// ADR 0666 §16, §25 against the real bus: a process's values of 1x, 10x and 100x the limit, replaced and deleted, and a
@@ -56,4 +57,31 @@ func TestStateObjectsWholeAgainstTheBus(t *testing.T) {
}
})
t.Run("values of 1x, 10x and 100x the limit", func(t *testing.T) { valueRows(t, OverBus(kv, store, "m_views-objects")) })
t.Run("the tools read and drop what a deleted key left", func(t *testing.T) {
v := OverBus(kv, store, "m_views-objects")
if err := v.Put("tool-key", big(2*256*1024)); err != nil {
t.Fatal(err)
}
if err := v.Delete("tool-key"); err != nil {
t.Fatal(err)
}
tools := Tools("m", []State{{Name: "views", Values: v}}, nil, handActs{}, time.Now)
read, err := tools[0].Run(map[string]any{})
if err != nil || read.(map[string]any)["key-gone"].(int) < 1 {
t.Fatalf("the reading tool: %v, %v", read, err)
}
if _, err := tools[1].Run(map[string]any{"by": "a@b", "why": "test"}); err != nil {
t.Fatal(err)
}
kept, _ := v.Kept()
for _, k := range kept {
if k.KeyGone {
t.Fatalf("%s is still key-gone after the drop", k.Name)
}
}
})
}
type handActs struct{}
func (handActs) RecordHandAct(views.HandAct) error { return nil }