From c7b137863e94ed1a7925c239b844f162aee3c844 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 25 Nov 2026 18:51:49 +0100 Subject: [PATCH] I9 dropped-subjects-acked: TestIndexerWhole reads that the events of the dropped subjects raise no finding event-unhandled Builds: design 47 H2 H-A-578 (2), H-A-651 (AC-I9; review round 1) --- .../takein_integration_test.go | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/takein_integration_test.go b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/takein_integration_test.go index 0d7fe2319..f799d1c58 100644 --- a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/takein_integration_test.go +++ b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/takein_integration_test.go @@ -432,6 +432,10 @@ func TestIndexerWhole(t *testing.T) { t.Fatal(err) } } + // The indexer's findings, which the grants part makes from its manifest's state findings (AC-I9 reads them). + if _, err = js.CreateKeyValue(ctx, jetstream.KeyValueConfig{Bucket: findingsBucket, History: 1}); err != nil { + t.Fatal(err) + } regs = registerAvahi(t, ctx, js, "main", "beta") tc, err := js.CreateKeyValue(ctx, jetstream.KeyValueConfig{Bucket: index.ToolchainsBucket("mesh-build-go"), History: 1}) if err != nil { @@ -452,13 +456,17 @@ func TestIndexerWhole(t *testing.T) { // Design 47 H2 H-A-578 (2), H-A-651 (AC-I9): an event of a subject the manifest no longer consumes, which the durable's // filter still holds, is acknowledged with no work (the unit test of ackDropped holds that it says the subject once). + // Two rounds: the hub hands one message at a time and says an unhandled one's finding after its acknowledgement, so the + // second round's acknowledgements come after the first round's findings were written, if any. var last uint64 - for _, subject := range droppedSubjects { - ack, err := js.Publish(ctx, subject, []byte(`{}`)) - if err != nil { - t.Fatal(err) + for range 2 { + for _, subject := range droppedSubjects { + ack, err := js.Publish(ctx, subject, []byte(`{}`)) + if err != nil { + t.Fatal(err) + } + last = ack.Sequence } - last = ack.Sequence } cons, err := testAccount.EventConsumer(ctx, js, views0Stream) if err != nil { @@ -476,6 +484,17 @@ func TestIndexerWhole(t *testing.T) { t.Fatalf("the dropped subjects events are not acknowledged: ack floor %d, want %d", info.AckFloor.Stream, last) } } + // AC-I9: the hub says no finding event-unhandled of them, since the subjects have a handler (without it the hub + // acknowledges them just the same, so the acknowledgement above does not hold it). + findings, err := js.KeyValue(ctx, findingsBucket) + if err != nil { + t.Fatal(err) + } + if e, err := findings.Get(ctx, views.FindingKey(views.FindingScope, keys.EscapeName(testIndexer), views.EventUnhandledKind)); err == nil { + t.Errorf("the dropped subjects' events raised the finding %s: %s", e.Key(), e.Value()) + } else if !errors.Is(err, jetstream.ErrKeyNotFound) { + t.Fatal(err) + } // The first revision: no mover, no pin; its entries are the base. sayMoved(t, ctx, js, "main", 10, c10, true) // A revision's number is the indexer's own count, the branch's newest + 1 (design 47 H-A-213 (1)): the later take-ins of