Files
mesh-delivery/modules/mesh-grants/internal/grants/statecap_test.go
T
jschoubben 11a22fdff7 X1: the checker goes: its module, its seat definition and its readers
The module mesh-delivery-checker goes whole with its manifest, and its seat's
definition leaves the seat list. The status view reads no tries: build_usage
answers no tries running and counts no step as a try. The grants part grants
main's accept subject to the builder alone. The tests name no checker as an
asker or a seat. The seat's generated packages, the indexer's readers and the
assigner's verdict constants go in the join's cleanup, once those branches
stand on this one (the lead, 2026-11-20).

Builds: design 47 H §764 (the checker (H1): mesh-delivery-checker whole); lead answer H-A-57 (hq f599b761)

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-20 04:47:16 +01:00

41 lines
1.3 KiB
Go

package grants
import (
"testing"
"git.novox.be/novox/mesh-sdk/go/catalogue"
)
// raiser is a Creator that holds one stream at a cap and records the cap it is raised to.
type raiser struct {
Creator
to int64
}
func (r *raiser) RaiseMaxBytes(_ string, to int64) (int64, bool, error) {
r.to = to
return 64 << 20, true, nil
}
// A state's declared max-mib reaches the bucket (issue 1975 note 6): the composed stream carries it, and a bucket the bus
// holds at the default 64 MiB is raised to it by the assertion.
func TestAStatesDeclaredCapReachesItsBucket(t *testing.T) {
m := catalogue.Manifest{Module: "mesh-pipeline-runner", State: []catalogue.StateDeclaration{{Name: "compositions", MaxMiB: 256}}}
var composed *Item
for _, it := range Composed(m, nil) {
if it.Stream == "KV_mesh-pipeline-runner_compositions" {
composed = &it
}
}
if composed == nil || composed.Composed.MaxBytes != 256<<20 {
t.Fatalf("the composed bucket is %+v, want a cap of 256 MiB", composed)
}
a := Assertion{Manifest: "d", Items: []Item{*composed}}
a.Items[0].Held = &Limits{MaxBytes: 64 << 20}
r := &raiser{}
_, raises := createMissing(r, &creations{}, &a, m, nil, false)
if r.to != 256<<20 || len(raises) != 1 {
t.Errorf("the held bucket was raised to %d (%v), want 256 MiB", r.to, raises)
}
}