fix(notifications): SMS adapter short-circuits on first transient — kills duplicate amplification and bounds the dispatch sweep

Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
This commit is contained in:
Joseph Doherty
2026-07-10 03:49:18 -04:00
parent aa1c1093e4
commit 839baa7880
3 changed files with 41 additions and 11 deletions
@@ -299,6 +299,24 @@ public class SmsNotificationDeliveryAdapterTests
Assert.Equal(DeliveryResult.TransientFailure, outcome.Result);
}
[Fact]
public async Task MidListTransient_ShortCircuits_RemainingRecipientsNotAttempted()
{
// Three recipients; the FIRST one comes back transient (500). Every recipient
// accepted after a transient is a guaranteed duplicate on retry (the whole
// notification re-sends), so the adapter must stop at the first transient
// instead of attempting the remaining two.
SetupList(phones: new[] { "+15551112222", "+15553334444", "+15555556666" });
var handler = ScriptedHttpMessageHandler.ForStatuses(
HttpStatusCode.InternalServerError, HttpStatusCode.Created, HttpStatusCode.Created);
var adapter = CreateAdapter(handler);
var outcome = await adapter.DeliverAsync(MakeNotification());
Assert.Equal(DeliveryResult.TransientFailure, outcome.Result);
Assert.Single(handler.Requests);
}
[Fact]
public async Task Deliver_ListNotFound_ReturnsPermanent()
{