From 4a5aa1b09d54082463b0efb38b18139071b8ffcc Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 1 Jun 2026 14:56:51 -0500 Subject: [PATCH] Fixing a problematic test suite. Closes GH-2965 --- .../Bugs/Bug_aggregate_should_still_publish.cs | 6 +++--- .../Distribution/with_ancillary_stores.cs | 15 ++------------- src/Wolverine/Envelope.Internals.cs | 5 +++++ src/Wolverine/Envelope.cs | 10 ++++++---- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/Persistence/MartenTests/Bugs/Bug_aggregate_should_still_publish.cs b/src/Persistence/MartenTests/Bugs/Bug_aggregate_should_still_publish.cs index 57227bd31..a1f0a37c9 100644 --- a/src/Persistence/MartenTests/Bugs/Bug_aggregate_should_still_publish.cs +++ b/src/Persistence/MartenTests/Bugs/Bug_aggregate_should_still_publish.cs @@ -112,7 +112,7 @@ public void warns_when_a_readaggregate_handler_is_promoted_by_the_aggregatehandl // GH-2922 guardrail: bootstrapping should have logged a warning for AggregateHandler, which uses // [ReadAggregate] and is auto-promoted into the aggregate workflow purely by its name. _context.Warnings.ShouldContain(w => - w.Contains(typeof(AggregateHandler).FullName!) && w.Contains("AggregateHandler")); + w.Contains(typeof(SomethingAggregateHandler).FullName!) && w.Contains("AggregateHandler")); } } @@ -142,7 +142,7 @@ public async Task InitializeAsync() opts.Policies.AutoApplyTransactions(); opts.Discovery.DisableConventionalDiscovery() - .IncludeType(typeof(AggregateHandler)) + .IncludeType(typeof(SomethingAggregateHandler)) .IncludeType(typeof(PublishReader)) .IncludeType(typeof(ScheduleReader)) .IncludeType(typeof(SomeOtherHandler)); @@ -216,7 +216,7 @@ public record SomethingWasScheduled(Guid Id); // Name ends with "AggregateHandler" -> auto-promoted into the Marten aggregate event-sourcing // workflow, so the return value is appended to the LetterAggregate stream as an event. -public static class AggregateHandler +public static class SomethingAggregateHandler { public static SomethingWasScheduled Handle( PublishSomethingUsingAggregate command, diff --git a/src/Persistence/MartenTests/Distribution/with_ancillary_stores.cs b/src/Persistence/MartenTests/Distribution/with_ancillary_stores.cs index d06e28c69..fa8372da3 100644 --- a/src/Persistence/MartenTests/Distribution/with_ancillary_stores.cs +++ b/src/Persistence/MartenTests/Distribution/with_ancillary_stores.cs @@ -65,8 +65,6 @@ protected async Task startHostAsync() opts.UseMessagePackSerialization(); - opts.UseSharedMemoryQueueing(); - opts.Services.AddMarten(m => { m.DisableNpgsqlLogging = true; @@ -123,17 +121,8 @@ public async Task can_do_the_full_marten_reset_all_data_call() await theOriginalHost.ResetAllMartenDataAsync(); } - - // Skipped pending #2965: the SharedMemory transport does not serialize - // envelopes on cross-host send, so AssignAgent system commands arrive at - // other nodes with empty Data/MessageType and the receive pipeline can't - // deserialize them — agents get stopped on the leader but never re-start - // on the destination node, causing this distribution test to time out. - // All 6 event-subscription agents enumerate and start correctly on a - // single host; the failure is purely in cross-node redistribution. - // Marten CI has been red here through V6.2.0 and V6.2.1; unblocking the - // V6.2.2 release with this skip while #2965 is resolved separately. - [Fact(Skip = "Pending fix for SharedMemory transport cross-node AssignAgent serialization — see #2965")] + + [Fact] public async Task spread_out_over_multiple_hosts() { await theOriginalHost.WaitUntilAssumesLeadershipAsync(5.Seconds()); diff --git a/src/Wolverine/Envelope.Internals.cs b/src/Wolverine/Envelope.Internals.cs index 1aa0c5e06..d443d783c 100644 --- a/src/Wolverine/Envelope.Internals.cs +++ b/src/Wolverine/Envelope.Internals.cs @@ -534,4 +534,9 @@ internal void Reset() WireTap = null; Store = null; } + + internal bool IsEmpty() + { + return (_message == null && (_data == null || (MessageType.IsEmpty()))) ; + } } \ No newline at end of file diff --git a/src/Wolverine/Envelope.cs b/src/Wolverine/Envelope.cs index f5b783499..d6a0d3159 100644 --- a/src/Wolverine/Envelope.cs +++ b/src/Wolverine/Envelope.cs @@ -1,4 +1,5 @@ -using JasperFx.Core; +using System.Diagnostics; +using JasperFx.Core; using JasperFx.Core.Reflection; using JasperFx.MultiTenancy; using MassTransit; @@ -42,6 +43,7 @@ public Envelope(object message, IEnumerable batch) public Envelope() { + Debug.WriteLine("Being created"); } public Envelope(object message) @@ -149,7 +151,7 @@ public TimeSpan? ScheduleDelay { return _data; } - AssertMessage(); + assertMessage(); if(Serializer is IAsyncMessageSerializer asyncMessaeSerializer) { @@ -179,7 +181,7 @@ public byte[]? Data return _data; } - AssertMessage(); + assertMessage(); if (Serializer == null) { @@ -207,7 +209,7 @@ public byte[]? Data set => _data = value; } - private void AssertMessage() + private void assertMessage() { if (_message == null) {