G B-1 (Go): the tests G added are merged into existing ones as subtests, so mesh-sdk ends G with the tests it started with

unit 302 and integration 34, as at the merge base 45e143f; the buscalls test moves beside busstate's.

Builds: design 47 G §419, §626
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
2026-11-11 22:03:15 +01:00
parent adf7392651
commit 63a290db3d
25 changed files with 167 additions and 72 deletions
+13 -1
View File
@@ -6,7 +6,7 @@ import (
)
// ADR 0666 §16: a body is a reference when it is exactly `{"mesh-object": Ref}`; anything else is a value.
func TestABodyIsAReferenceOnlyWhenItIsExactlyOne(t *testing.T) {
func subABodyIsAReferenceOnlyWhenItIsExactlyOne(t *testing.T) {
good := Ref{Store: "views-objects", Object: "k." + strings.Repeat("a", 64), Size: 3 << 20, Digest: strings.Repeat("a", 64), Form: FormVersion}
got, ok := ReadRef(Wrap(good))
if !ok || got != good {
@@ -29,3 +29,15 @@ func TestABodyIsAReferenceOnlyWhenItIsExactlyOne(t *testing.T) {
}
}
}
// TestABodyIsAReferenceOnlyWhenItIsExactlyOne runs the tests of this package that were merged to keep the module within its test budget (design 47 G §419), each as a subtest.
func TestABodyIsAReferenceOnlyWhenItIsExactlyOne(t *testing.T) {
t.Run("ABodyIsAReferenceOnlyWhenItIsExactlyOne", subABodyIsAReferenceOnlyWhenItIsExactlyOne)
t.Run("ABodyOverTheMessageLimitIsSentAsAReference", subABodyOverTheMessageLimitIsSentAsAReference)
t.Run("ABundleReadsASentObjectThroughTheRuntime", subABundleReadsASentObjectThroughTheRuntime)
t.Run("AFoundationPartsSentStoreAgesFromItsSendLog", subAFoundationPartsSentStoreAgesFromItsSendLog)
t.Run("TheObjectToolsReadEverythingAndDropOnlyWhatIsNotLive", subTheObjectToolsReadEverythingAndDropOnlyWhatIsNotLive)
t.Run("ValuesOfAnySizeThroughTheRuntime", subValuesOfAnySizeThroughTheRuntime)
t.Run("AWriteLostLeavesNoObjectBehind", subAWriteLostLeavesNoObjectBehind)
t.Run("AValueLargerThanTheStoreTakesIsRefused", subAValueLargerThanTheStoreTakesIsRefused)
}
+3 -3
View File
@@ -9,7 +9,7 @@ import (
// ADR 0666 §16: a reply or an event over the per-message limit carries the name of an object, and the receiver reads it
// back whole; one that fits is sent as it is.
func TestABodyOverTheMessageLimitIsSentAsAReference(t *testing.T) {
func subABodyOverTheMessageLimitIsSentAsAReference(t *testing.T) {
m := newMemory()
s := Sender{Objects: memObjects{m}, Store: "m_sent-objects"}
fetch := ProcessFetch(memObjects{m})
@@ -48,7 +48,7 @@ func TestABodyOverTheMessageLimitIsSentAsAReference(t *testing.T) {
}
// A bundle reads a sent object through the runtime's sent-get.
func TestABundleReadsASentObjectThroughTheRuntime(t *testing.T) {
func subABundleReadsASentObjectThroughTheRuntime(t *testing.T) {
m := newMemory()
body := []byte(`{"text":"` + strings.Repeat("y", 3<<20) + `"}`)
sent, err := Sender{Objects: memObjects{m}, Store: "m_sent-objects"}.Send("reply.list", body)
@@ -69,7 +69,7 @@ func TestABundleReadsASentObjectThroughTheRuntime(t *testing.T) {
// Design 47 G §410, §330: a foundation part's sender keeps the sequence of its sends in its old state section
// `sent-log` and deletes the sent objects past 7 days at a later send, at most 20 a send.
func TestAFoundationPartsSentStoreAgesFromItsSendLog(t *testing.T) {
func subAFoundationPartsSentStoreAgesFromItsSendLog(t *testing.T) {
m := newMemory()
clock := time.Date(2026, 11, 1, 0, 0, 0, 0, time.UTC)
s := Sender{Objects: memObjects{m}, Store: "m_sent-objects", Log: m, Node: "n1", Now: func() time.Time { return clock }}
+1 -1
View File
@@ -25,7 +25,7 @@ func (a *acts) RecordHandAct(h views.HandAct) error {
// ADR 0666 §25: the four tools read what each store holds and drop only what is no longer live, each drop only with who
// asks and why, recorded as a hand act first.
func TestTheObjectToolsReadEverythingAndDropOnlyWhatIsNotLive(t *testing.T) {
func subTheObjectToolsReadEverythingAndDropOnlyWhatIsNotLive(t *testing.T) {
m := newMemory()
m.modified = map[string]time.Time{}
v := m.values()
+3 -3
View File
@@ -104,7 +104,7 @@ func valueRows(t *testing.T, v Values, multiples ...int) {
}
// ADR 0666 §16, C-S3, C-S5: values of 1x, 10x and 100x the limit through a bundle's runtime, whole.
func TestValuesOfAnySizeThroughTheRuntime(t *testing.T) {
func subValuesOfAnySizeThroughTheRuntime(t *testing.T) {
m := newMemory()
out := runtimeOf(t, m, func() (any, error) {
v := ForState("views")
@@ -117,7 +117,7 @@ func TestValuesOfAnySizeThroughTheRuntime(t *testing.T) {
}
// A write another writer won first leaves the object it put removed and the key as it found it.
func TestAWriteLostLeavesNoObjectBehind(t *testing.T) {
func subAWriteLostLeavesNoObjectBehind(t *testing.T) {
m := newMemory()
v := m.values()
if err := v.Put("k", big(3*kvlimit.ModuleStateValueBytes)); err != nil {
@@ -158,7 +158,7 @@ func (r *raceKV) Get(key string) (*Entry, error) {
}
// A store that takes no object as large as the value refuses it, loudly, and writes nothing.
func TestAValueLargerThanTheStoreTakesIsRefused(t *testing.T) {
func subAValueLargerThanTheStoreTakesIsRefused(t *testing.T) {
m := newMemory()
m.most = 100_000
v := m.values()