The kept stream of the runner's pipeline-ended was made at G's definition, sourced by a three-part subject; H1 moved the event to <branch>.<source>, so the stream took nothing in since 08:13 and the assigner, which hears a kept event from its kept stream, heard no end. createKept left every held kept stream as it was. It now brings a held one's source filter from the events stream to the definition's in place (a stream update, its messages and other settings kept, never made again) and says the held and the composed filter in the journal and the pass; the same holds for pipeline-started and wait-held. Builds: design 47 H H-A-145 (hq design/47-H1-answers-59 0787704b), §746
48 lines
1.9 KiB
Go
48 lines
1.9 KiB
Go
package grants
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
|
|
"github.com/nats-io/nats.go/jetstream"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/seatdef"
|
|
|
|
"mesh-grants/internal/buscompose"
|
|
)
|
|
|
|
type askCreator struct{ made []string }
|
|
|
|
func (c *askCreator) CreateDeclared(cfg jetstream.StreamConfig) error {
|
|
c.made = append(c.made, cfg.Name+" "+cfg.Subjects[0])
|
|
return nil
|
|
}
|
|
func (c *askCreator) AddSubjects(string, []string) error { return nil }
|
|
func (c *askCreator) RaiseMaxBytes(string, int64) (int64, bool, error) {
|
|
return 0, false, nil
|
|
}
|
|
func (c *askCreator) SourceFilter(string, string, string) (string, bool, error) {
|
|
return "", false, nil
|
|
}
|
|
|
|
// A seat whose queues came with G (mesh-builds) gets its work-queue ask stream from the seat list, as the controller made one for
|
|
// every seat before G; a seat that accepts nothing gets none, and a stream the bus holds is never made again (lead-47, 2026-11-15).
|
|
func TestEachSeatThatAcceptsWorkHasItsAskStream(t *testing.T) {
|
|
defs := map[string]seatdef.Definition{
|
|
"mesh-builds": {Seat: "mesh-builds", Accepts: []seatdef.Message{{Name: "step"}}},
|
|
"mesh-wants": {Seat: "mesh-wants", Accepts: []seatdef.Message{{Name: "step"}}},
|
|
"git": {Seat: "git"},
|
|
}
|
|
asks := buscompose.AskStreamsOf(defs)
|
|
if len(asks) != 2 || asks[0].Name != "SEAT_MESH_BUILDS" || asks[0].Retention != jetstream.WorkQueuePolicy ||
|
|
!slices.Equal(asks[0].Subjects, []string{"mesh.seat.mesh-builds.accept.>"}) || asks[0].MaxAge == 0 {
|
|
t.Fatalf("ask streams = %+v", asks)
|
|
}
|
|
c := &askCreator{}
|
|
made, notMade := createAskStreams(c, &creations{}, asks, map[string]Limits{"SEAT_MESH_WANTS": {}}, false)
|
|
if !slices.Equal(made, []string{"SEAT_MESH_BUILDS"}) || len(notMade) != 0 ||
|
|
!slices.Equal(c.made, []string{"SEAT_MESH_BUILDS mesh.seat.mesh-builds.accept.>"}) {
|
|
t.Errorf("made %v (not %v), created %v: want only the builds seat's, the wants seat's being held", made, notMade, c.made)
|
|
}
|
|
}
|