H-A-495 indexer test: the release re-pins the importer, a reservation moves no pin

TestASourceRevisionMovingMeshSDKNamesItAndItsImporters still expected the
twenty reservations' pipeline-started to keep a re-pin revision pinning
importer to the reserved version, which H-A-495 ended (repin_test.go was
brought in line, this bed was not), so it failed on every pipeline with
"main.5 is not kept after 20s". The bed now waits for the indexer's
acknowledgement of each pipeline-started (its settle moves nothing), then
releases the version: the Go package registry seat's published and every
artifact's package-published. The next revision must be the release's
re-pin, importer its mover at that version. The harness's events durable
now also hears the registry's published, as the manifest's consumes names it,
and this bed keeps package-published on its stream and the state versions.
Fails with the pre-H-A-495 pin rule (main.5 is the reservations' re-pin).

Builds: design 47 H2 H-A-495 and its addendum, §805
This commit is contained in:
2026-11-22 23:18:17 +01:00
parent 29c4673ad1
commit 7bacccf562
2 changed files with 81 additions and 14 deletions
@@ -31,6 +31,7 @@ import (
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/gopackageregistry"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshbuilds"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdelivery"
@@ -800,8 +801,10 @@ func serveAssignerAssignments(t *testing.T, ctx context.Context, js jetstream.Je
}
if _, err := js.CreateOrUpdateConsumer(ctx, "EVENTS", jetstream.ConsumerConfig{Durable: "n1_mesh-delivery-indexer", AckPolicy: jetstream.AckExplicitPolicy,
// and the build seat's step-ended the manifest's consumes names (design 47 G §713: the end of a validation ask), and the
// builder's version-reserved, which no stream of its own keeps (design 47 H2 §805).
FilterSubjects: []string{"mesh.mod." + assignerHolderModule + ".event.views.>", meshcatalog.SubjectRoom, nodebuildgo.SubjectStepEndedAll, meshbuilds.SubjectVersionReserved}}); err != nil {
// builder's version-reserved, which no stream of its own keeps (design 47 H2 §805), and the Go package registry seat's
// published, a series' newest a pin names (H-A-495 addendum).
FilterSubjects: []string{"mesh.mod." + assignerHolderModule + ".event.views.>", meshcatalog.SubjectRoom, nodebuildgo.SubjectStepEndedAll, meshbuilds.SubjectVersionReserved,
gopackageregistry.SubjectPublished}}); err != nil {
t.Fatal(err)
}
em := views.Emitter{Owner: assignerHolderModule, Subject: process.Account{Node: "n1", Module: assignerHolderModule}.EventSubject,
@@ -19,9 +19,11 @@ import (
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/gopackageregistry"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshbuilds"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdelivery"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildgo"
"mesh-delivery-indexer/internal/index"
@@ -76,10 +78,11 @@ func untilModule(t *testing.T, ctx context.Context, js jetstream.JetStream, name
// of lib-a and one of lib-b, and so their trees alone, moves lib-a, lib-b and their importers alone, never the other 32
// modules whose repository's commit moved too.
//
// Design 47 H2 §805 (H-A-453 (3)): the builder's twenty version-reserved of mesh-sdk in that revision's pipeline (twenty
// artifacts of its Go package, as repin_test.go reads them) are kept in heard and gathered, and its pipeline-started keeps one
// re-pin revision of main, importer its mover pinned to the reserved version; the next pipeline's reservation keeps the
// revision after it, so none came between.
// Design 47 H2 §805 (H-A-453 (3)) and H-A-495 with its addendum: the builder's twenty version-reserved of mesh-sdk in that
// revision's pipeline (twenty artifacts of its Go package, as repin_test.go reads them) are kept in heard and gathered, and
// they and its pipeline-started move no pin: a pin names only a published version. The release of the reserved version (the
// Go package registry seat's published and every artifact's package-published) keeps one re-pin revision of main, importer
// its mover pinned to it; the next pipeline's reservation keeps none, so the revision after it is the next release's.
func TestASourceRevisionMovingMeshSDKNamesItAndItsImporters(t *testing.T) {
const (
sdkGo = "git.novox.be/novox/mesh-sdk/go"
@@ -143,6 +146,24 @@ func TestASourceRevisionMovingMeshSDKNamesItAndItsImporters(t *testing.T) {
if heardKV, err = js.CreateKeyValue(ctx, jetstream.KeyValueConfig{Bucket: index.Bucket(testIndexer, index.HeardState), History: 64, LimitMarkerTTL: time.Minute}); err != nil {
t.Fatal(err)
}
// package-published on its kept stream with the indexer's durable, as the grants part makes them, and the state versions
// a release is recorded in (H-A-495: the release re-pins).
if _, err := js.CreateKeyValue(ctx, jetstream.KeyValueConfig{Bucket: index.Bucket(testIndexer, index.VersionsState), History: 1}); err != nil {
t.Fatal(err)
}
if _, err := js.CreateStream(ctx, jetstream.StreamConfig{Name: meshbuilds.StreamPackagePublished, Subjects: []string{meshbuilds.SubjectPackagePublished}}); err != nil {
t.Fatal(err)
}
if _, err := js.CreateOrUpdateConsumer(ctx, meshbuilds.StreamPackagePublished, jetstream.ConsumerConfig{Durable: "n1_mesh-delivery-indexer", AckPolicy: jetstream.AckExplicitPolicy,
MaxDeliver: EventDeliveries}); err != nil {
t.Fatal(err)
}
// The indexer's durable on pipeline-started samples every acknowledgement, so the bed hears that the settle a
// pipeline-started makes (H-A-424 (1)) has ended before it releases, never by sleeping.
if _, err := js.CreateOrUpdateConsumer(ctx, meshpipelinerunner.StreamPipelineStarted, jetstream.ConsumerConfig{Durable: "n1_mesh-delivery-indexer",
AckPolicy: jetstream.AckExplicitPolicy, FilterSubjects: []string{meshpipelinerunner.SubjectPipelineStartedAll}, SampleFrequency: "100%"}); err != nil {
t.Fatal(err)
}
// A dry run's key left by an indexer that stopped mid-run (§804).
if dryRuns, err = js.KeyValue(ctx, index.Bucket(testIndexer, index.DryRunsState)); err != nil {
t.Fatal(err)
@@ -260,8 +281,9 @@ func TestASourceRevisionMovingMeshSDKNamesItAndItsImporters(t *testing.T) {
t.Errorf("the catalogue's commit changing lib-a's and lib-b's tests moves %v of its 36 modules, want lib-a, lib-b and their importers alone", movers)
}
// §805: twenty reservations of mesh-sdk's packages in main's revision of source 12, kept and gathered; its pipeline-started
// keeps one re-pin revision of main, and the next pipeline's reservation the one after it.
// §805, H-A-495: twenty reservations of mesh-sdk's packages in main's revision of source 12, kept and gathered, and its
// pipeline-started move no pin; the release of the reserved version keeps one re-pin revision of main, and the next
// pipeline's reservation none, so the revision after it is the next release's.
objects := newBusObjects(js, testAccount, index.CatalogRevisionsObjects)
untilRevision := func(n int64) meshcatalog.CatalogRevision {
t.Helper()
@@ -299,19 +321,61 @@ func TestASourceRevisionMovingMeshSDKNamesItAndItsImporters(t *testing.T) {
return v != nil && json.Unmarshal(v, &r) == nil && len(r.Reservations) == artifacts
})
}
// release publishes mesh-sdk's Go package at version, as the registry seat says it (the series' newest a pin names,
// H-A-495 addendum), and every artifact of mesh-sdk's entry in main's revision n, as the builder says them.
release := func(n int64, version string) {
t.Helper()
raw, _ := json.Marshal(gopackageregistry.PublishedEvent{Kind: "package", Name: sdkGo, Module: sdkGo, Version: version, Commit: m2, Digest: "sha256:" + version})
if _, err := js.Publish(ctx, gopackageregistry.SubjectPublished, raw); err != nil {
t.Fatal(err)
}
_, entries, err := index.ReadRevision(ctx, objects, index.BranchObject("main", n))
if err != nil {
t.Fatal(err)
}
i := slices.IndexFunc(entries, func(e meshcatalog.CatalogEntry) bool { return e.Module == "mesh-sdk" })
if i < 0 {
t.Fatalf("main.%d holds no entry of mesh-sdk", n)
}
for _, a := range entries[i].Artifacts {
raw, _ := json.Marshal(meshbuilds.PackagePublished{Module: "mesh-sdk", Artifact: a.Ref, Digest: "sha256:" + a.Ref + version, Version: version, Source: 12, Branch: "main"})
if _, err := js.Publish(ctx, meshbuilds.SubjectPackagePublished, raw); err != nil {
t.Fatal(err)
}
}
}
// started says pipeline-started of main's revision n and waits for the indexer's acknowledgement of it, which follows its settle.
started := func(n int64) {
t.Helper()
acks, err := js.Conn().SubscribeSync("$JS.EVENT.METRIC.CONSUMER.ACK." + meshpipelinerunner.StreamPipelineStarted + ".n1_mesh-delivery-indexer")
if err != nil {
t.Fatal(err)
}
defer func() { _ = acks.Unsubscribe() }()
if err := js.Conn().Flush(); err != nil {
t.Fatal(err)
}
sayPipeline(t, ctx, js, false, "main", n)
if _, err := acks.NextMsg(waitBound); err != nil {
t.Fatalf("the pipeline-started of main.%d is not acknowledged after %s: %v", n, waitBound, err)
}
}
r := taken.Revision
reserve(r, "0.1.28", 20)
sayPipeline(t, ctx, js, false, "main", r)
if rev := untilRevision(r + 1); rev.CallKind != meshcatalog.CatalogRevisionCallKindRelease || !strings.Contains(rev.Call, index.BranchObject("main", r)+"'s") ||
started(r)
release(r, "0.1.28")
if rev := untilRevision(r + 1); rev.CallKind != meshcatalog.CatalogRevisionCallKindRelease || rev.Call != index.ReleaseCall("mesh-sdk", "0.1.28") ||
len(rev.Movers) != 1 || rev.Movers[0].Module != "importer" {
t.Errorf("main.%d = %+v, want one re-pin revision of the twenty reservations, importer its mover", r+1, rev)
t.Errorf("main.%d = %+v, want the re-pin revision of the release of mesh-sdk 0.1.28, importer its mover: twenty reservations move no pin", r+1, rev)
}
untilModule(t, ctx, js, "importer", func(m meshcatalog.ModulesByModuleValue) bool { return m.Packages[sdkGo] == "v0.1.28" })
reserve(r+1, "0.1.29", 1)
sayPipeline(t, ctx, js, false, "main", r+1)
if rev := untilRevision(r + 2); !strings.Contains(rev.Call, index.BranchObject("main", r+1)+"'s") {
t.Errorf("main.%d = %+v, want the next pipeline's re-pin: the twenty reservations kept more than one revision", r+2, rev)
started(r + 1)
release(r+1, "0.1.29")
if rev := untilRevision(r + 2); rev.Call != index.ReleaseCall("mesh-sdk", "0.1.29") {
t.Errorf("main.%d = %+v, want the re-pin of the release of mesh-sdk 0.1.29: the reservation of 0.1.29 keeps no revision", r+2, rev)
}
untilModule(t, ctx, js, "importer", func(m meshcatalog.ModulesByModuleValue) bool { return m.Packages[sdkGo] == "v0.1.29" })
// A branch's take-in moving mesh-sdk to m3 is a dry run: its packages stay in dry-runs while it runs, the trunk's are
// untouched, and its keys go once it answered (§804).