Put the served test's registrations on the bus's chain, and keep the seat-row test on a verb release 6 keeps (issue 1945)

Assignments and builds live on the bus (ADR 0408), so a fixture written before the chain was attached was not what
the serving controller read; and push, which the row test used, went with the plans.
This commit is contained in:
2026-10-24 19:04:55 +02:00
parent 3ad12f8ec7
commit 370673195c
2 changed files with 51 additions and 35 deletions
@@ -22,6 +22,7 @@ import (
"github.com/novox/mesh-controller/internal/broker"
"github.com/novox/mesh-controller/internal/builderkeys"
"github.com/novox/mesh-controller/internal/chain"
"github.com/novox/mesh-controller/internal/identity"
"github.com/novox/mesh-controller/internal/inventory"
)
@@ -61,37 +62,6 @@ func aServedMesh(t *testing.T) *servedMesh {
t.Fatal(err)
}
// A provider and its consumer (bindings_test.go's store and board), registered from done keys of the catalogue's
// repository, so each has a fingerprint of the new form; the store holds the mesh's seat on anchor, the board on
// laptop is bound to it.
shelf := map[string]catalogue.Manifest{}
for _, m := range storeManifests() {
shelf[m.Module] = m
}
for i, module := range []string{"store", "board"} {
raw, k, trunk := keyOfManifest(t, shelf[module], fpOf(byte('a'+i)), "c0ffee0123456789")
keys := trunkKeys{keyBuckets: keyBuckets{keys: map[string]builderkeys.Key{module: aBuilderKey(module, trunk.FP2, k)},
manifests: map[string]string{trunk.Manifest: string(raw)}}, trunk: trunk}
if _, _, err := takeInKey(ctx, inv, keys, keyTake{Module: module, Trunk: trunk, Ask: registrationAsk{Merge: trunk.Commit}}); err != nil {
t.Fatalf("%s is not registered from its key: %v", module, err)
}
}
if _, err := inv.SeedSeats(ctx, catalogue.DefaultSeats()); err != nil {
t.Fatal(err)
}
if _, err := inv.Assign(ctx, "anchor", "store"); err != nil {
t.Fatal(err)
}
if err := inv.HoldSeat(ctx, "mesh-store", catalogue.ScopeMesh, "anchor", "store"); err != nil {
t.Fatal(err)
}
if _, err := inv.Assign(ctx, "laptop", "board"); err != nil {
t.Fatal(err)
}
if err := inv.PinProvision(ctx, "laptop", "postgres-database", "anchor", "store"); err != nil {
t.Fatal(err)
}
// The bus, running the user list the controller composes from the store, with the builder and the indexer as the
// accounts their own manifests make (each writes its own state).
records, err := inv.BusRecords(ctx)
@@ -170,6 +140,51 @@ func aServedMesh(t *testing.T) *servedMesh {
m := &servedMesh{open: open, controller: connect(controller.Username(), password),
builder: connect(builder.Username(), "pw"), indexer: connect(indexer.Username(), "pw")}
// The test's own inventory on the bus's chain, as the serving controller's will be: what is registered and assigned
// below is in the chain it reads (assignments and builds live on the bus, ADR 0408).
chainConn, err := nats.Connect(s.ClientURL(), nats.UserInfo(controller.Username(), password),
nats.CustomInboxPrefix("_INBOX."+controller.Username()))
if err != nil {
t.Fatal(err)
}
t.Cleanup(chainConn.Close)
c, err := chain.OnTheBus(ctx, chainConn, func(context.Context) error { return nil })
if err != nil {
t.Fatal(err)
}
inv.UseChain(c)
// A provider and its consumer (bindings_test.go's store and board), registered from done keys of the catalogue's
// repository, so each has a fingerprint of the new form; the store holds the mesh's seat on anchor, the board on
// laptop is bound to it.
shelf := map[string]catalogue.Manifest{}
for _, m := range storeManifests() {
shelf[m.Module] = m
}
for i, module := range []string{"store", "board"} {
raw, k, trunk := keyOfManifest(t, shelf[module], fpOf(byte('a'+i)), "c0ffee0123456789")
keys := trunkKeys{keyBuckets: keyBuckets{keys: map[string]builderkeys.Key{module: aBuilderKey(module, trunk.FP2, k)},
manifests: map[string]string{trunk.Manifest: string(raw)}}, trunk: trunk}
if _, _, err := takeInKey(ctx, inv, keys, keyTake{Module: module, Trunk: trunk, Ask: registrationAsk{Merge: trunk.Commit}}); err != nil {
t.Fatalf("%s is not registered from its key: %v", module, err)
}
}
if _, err := inv.SeedSeats(ctx, catalogue.DefaultSeats()); err != nil {
t.Fatal(err)
}
if _, err := inv.Assign(ctx, "anchor", "store"); err != nil {
t.Fatal(err)
}
if err := inv.HoldSeat(ctx, "mesh-store", catalogue.ScopeMesh, "anchor", "store"); err != nil {
t.Fatal(err)
}
if _, err := inv.Assign(ctx, "laptop", "board"); err != nil {
t.Fatal(err)
}
if err := inv.PinProvision(ctx, "laptop", "postgres-database", "anchor", "store"); err != nil {
t.Fatal(err)
}
// The builder's and the indexer's buckets as their own parts make them, there before the controller starts (its
// watch of their keys begins at its start); and the plans' buckets a controller of release 5 left.
for _, b := range []string{sdkdelivery.BuilderBuildsBucket, sdkdelivery.ModulesBucket, sdkdelivery.ManifestsBucket} {