From 126053388e4b2f65bbd71c4be72c2a9b8af6fcb9 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 10 Nov 2026 16:41:13 +0100 Subject: [PATCH] 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) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: design 47 G §61, §62 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ --- go/packages_list_test.go | 9 +++++++ go/stateobjects/values_integration_test.go | 28 ++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/go/packages_list_test.go b/go/packages_list_test.go index 109974d4..c2823dc7 100644 --- a/go/packages_list_test.go +++ b/go/packages_list_test.go @@ -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 { diff --git a/go/stateobjects/values_integration_test.go b/go/stateobjects/values_integration_test.go index 4bd349cd..b744836b 100644 --- a/go/stateobjects/values_integration_test.go +++ b/go/stateobjects/values_integration_test.go @@ -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 }