T-8: the 8 MiB cap holds on a bundle's runtime call only; the console reads a larger sent object whole (af0ba22, taken)
Builds: design 47 G §69, §62, §407 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"git.novox.be/novox/mesh-sdk/go/buscalls"
|
||||
"git.novox.be/novox/mesh-sdk/go/stateobjects"
|
||||
)
|
||||
|
||||
// The capabilities the tool runner states of the calls it answers (novox/hq ADR 0595 §9, ADR 0597; design 25 § 12.4): each is
|
||||
@@ -69,7 +70,10 @@ func (b *moduleBus) BusState(method string, params json.RawMessage) (json.RawMes
|
||||
var r buscalls.ObjectsSentGetRequest
|
||||
if err = decode(method, params, &r); err == nil {
|
||||
var got *buscalls.ObjectData
|
||||
if got, err = conn.SentGet(r); err == nil {
|
||||
if r.Size > stateobjects.BundleObjectMost {
|
||||
// Only the bundle's channel is limited (design 47 "Any size"): the console reads a larger one whole.
|
||||
err = fmt.Errorf("the sent object %s is %d bytes and a bundle's runtime channel carries at most %d: it is not read through a bundle", r.Object, r.Size, stateobjects.BundleObjectMost)
|
||||
} else if got, err = conn.SentGet(r); err == nil {
|
||||
answer = got
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/buscalls"
|
||||
"git.novox.be/novox/mesh-sdk/go/stateobjects"
|
||||
)
|
||||
|
||||
// Design 47 G §69, §62, §407: only a bundle's runtime channel holds the cap, so the runtime call refuses a sent object over
|
||||
// it before the bus is asked, where the console (which reads through the bus) reads it whole.
|
||||
func TestARuntimeCallRefusesASentObjectOverTheBundleChannel(t *testing.T) {
|
||||
params, _ := json.Marshal(buscalls.ObjectsSentGetRequest{Store: "m_sent-objects", Object: "o",
|
||||
Size: int64(stateobjects.BundleObjectMost) + 1, Digest: strings.Repeat("a", 64)})
|
||||
_, err := (&moduleBus{all: &consumers{}}).BusState(buscalls.ObjectsSentGet, params)
|
||||
if err == nil || !strings.Contains(err.Error(), "not read through a bundle") {
|
||||
t.Fatalf("a sent object over the channel was answered %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user