From ea8d9c5f5674f948ec4865ffb7cff009fbec8b3f Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 12 Nov 2026 05:26:24 +0100 Subject: [PATCH] Test budget: the approval mark's two tables replace two tests folded into their neighbours MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tool runner ends milestone G with no more tests than it started with: the no-responders test takes the 503 case, and the stated-capabilities test takes the sent-object row. Builds: design 46 7-approval-mark §22; design 47 G §626 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h --- node-tools/internal/console/noresponders_test.go | 8 +++----- node-tools/internal/runtime/announce_test.go | 14 -------------- node-tools/internal/runtime/ledgers_test.go | 5 +++++ 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/node-tools/internal/console/noresponders_test.go b/node-tools/internal/console/noresponders_test.go index fd008c8..51f0c0a 100644 --- a/node-tools/internal/console/noresponders_test.go +++ b/node-tools/internal/console/noresponders_test.go @@ -11,15 +11,13 @@ import ( "github.com/novox/mesh-tools/node-tools/internal/bus" ) -// A tool's own error that mentions 503 is the tool's answer, not a routing fault (issue 1529). -func TestAToolsOwn503IsNotNothingServes(t *testing.T) { +// A tool's own error that mentions 503 is the tool's answer, not a routing fault (issue 1529); a real no-responders still says +// nothing serves. +func TestARealNoRespondersStillSaysNothingServes(t *testing.T) { got := whyItFailed("scanner.scan", errors.New("the scanner refused the scan job: 503 Service Unavailable")) if strings.Contains(got, "nothing serves") || !strings.HasPrefix(got, "scanner.scan failed: ") || !strings.Contains(got, "503") { t.Fatalf("got %q", got) } -} - -func TestARealNoRespondersStillSaysNothingServes(t *testing.T) { for _, err := range []error{bus.ErrNoResponders, fmt.Errorf("ask: %w", bus.ErrNoResponders), nats.ErrNoResponders} { if got := whyItFailed("a.b", err); !strings.HasPrefix(got, "nothing serves a.b") { t.Fatalf("%v: got %q", err, got) diff --git a/node-tools/internal/runtime/announce_test.go b/node-tools/internal/runtime/announce_test.go index 53de9c5..dd58ba0 100644 --- a/node-tools/internal/runtime/announce_test.go +++ b/node-tools/internal/runtime/announce_test.go @@ -2,7 +2,6 @@ package runtime import ( "encoding/json" - "git.novox.be/novox/mesh-sdk/go/buscalls" "sort" "strings" "testing" @@ -144,16 +143,3 @@ func TestTheRunnerStatesTheCapabilitiesOfItsCallsInItsPing(t *testing.T) { t.Errorf("the runner states %q (%v), want its bus-state and ledger calls", ping.Metadata[announce.Capabilities], err) } } - -// Design 47 G §462: the call that reads a sent object is listed under the bus state capability, and the ledger calls keep theirs. -func TestTheSentObjectCallBelongsToTheBusStateCapability(t *testing.T) { - for c, method := range map[string]string{CapBusStateCalls: buscalls.ObjectsSentGet} { - found := false - for _, m := range callFamilies[c] { - found = found || m == method - } - if !found { - t.Errorf("%s does not list %s", c, method) - } - } -} diff --git a/node-tools/internal/runtime/ledgers_test.go b/node-tools/internal/runtime/ledgers_test.go index 3d50b3a..798c85b 100644 --- a/node-tools/internal/runtime/ledgers_test.go +++ b/node-tools/internal/runtime/ledgers_test.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "errors" + "slices" "sort" "strings" "testing" @@ -207,6 +208,10 @@ func TestEveryCallOfAStatedCapabilityIsAnswered(t *testing.T) { if got := strings.Join(CallCapabilities(), ","); got != "approval-mark/1,bus-state-calls,ledger-calls,put-sessions,seat-settle-delay" { t.Fatalf("the runner states %s", got) } + // Design 47 G §462: the call that reads a sent object is listed under the bus state capability. + if !slices.Contains(callFamilies[CapBusStateCalls], buscalls.ObjectsSentGet) { + t.Errorf("%s does not list %s", CapBusStateCalls, buscalls.ObjectsSentGet) + } for capability, methods := range callFamilies { for _, method := range methods { t.Run(capability+" "+method, func(t *testing.T) {