G §57, §345: a replace leaves the object it replaced, and a value over a bundle's object limit is refused, never split

Builds: design 47 G §57, §345

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
2026-11-11 14:07:26 +01:00
parent 0f23429666
commit ca59b685b0
6 changed files with 45 additions and 130 deletions
+2 -5
View File
@@ -109,7 +109,7 @@ func (s Sender) Send(label string, body []byte) ([]byte, error) {
return nil, fmt.Errorf("%s: a bundle sends at most %d bytes of body, the runtime's channel carrying a message of 16 MiB; this one is %d", label, most, len(body))
}
ref := Ref{Store: s.Store, Object: objectName(label, digestOf(body)), Size: int64(len(body)), Digest: digestOf(body), Form: FormVersion}
if _, err := putObject(s.Objects, ref.Object, body); err != nil {
if err := s.Objects.Put(ref.Object, body); err != nil {
return nil, fmt.Errorf("the object for %s: %w", label, err)
}
if s.Log != nil {
@@ -143,9 +143,6 @@ func Receive(body []byte, fetch Fetch) ([]byte, error) {
// BundleFetch reads a sent object through the runtime, which serves it under the standing grant the grants part derives
// from the manifests (buscalls.ObjectsSentGet).
func BundleFetch(ref Ref) ([]byte, error) {
if ref.Parts > 1 {
return nil, fmt.Errorf("the object %s is split over %d objects, which a bundle does not read: a sender in a bundle never splits one", ref.Object, ref.Parts)
}
raw, err := stdio.BusState(buscalls.ObjectsSentGet, buscalls.ObjectsSentGetRequest{Store: ref.Store, Object: ref.Object, Size: ref.Size, Digest: ref.Digest})
if err != nil {
return nil, err
@@ -159,5 +156,5 @@ func BundleFetch(ref Ref) ([]byte, error) {
// ProcessFetch reads a sent object through the reader's own object store.
func ProcessFetch(o Objects) Fetch {
return func(ref Ref) ([]byte, error) { return getObject(o, ref) }
return func(ref Ref) ([]byte, error) { return o.Get(ref.Object) }
}