feat(health): oldest-parked-message age on the site health report (parked-retention aging signal)

This commit is contained in:
Joseph Doherty
2026-07-08 21:49:29 -04:00
parent 0321ad0c20
commit 11c72ecf0f
6 changed files with 88 additions and 2 deletions
@@ -790,4 +790,22 @@ public class StoreAndForwardStorageTests : IAsyncLifetime, IDisposable
Assert.NotNull(await _storage.GetMessageByIdAsync("fresh-1"));
Assert.NotNull(await _storage.GetMessageByIdAsync("fresh-2"));
}
// ── Task 23: oldest-parked-age health signal ──
[Fact]
public async Task GetOldestParkedCreatedAt_ReturnsOldestParkedRow_OrNull()
{
Assert.Null(await _storage.GetOldestParkedCreatedAtAsync());
var old = NewMsg("old-parked", StoreAndForwardMessageStatus.Parked, DateTimeOffset.UtcNow.AddDays(-3));
var recent = NewMsg("new-parked", StoreAndForwardMessageStatus.Parked, DateTimeOffset.UtcNow.AddHours(-1));
var pending = NewMsg("pending", StoreAndForwardMessageStatus.Pending, DateTimeOffset.UtcNow.AddDays(-9)); // must not count
await _storage.EnqueueAsync(old);
await _storage.EnqueueAsync(recent);
await _storage.EnqueueAsync(pending);
var oldest = await _storage.GetOldestParkedCreatedAtAsync();
Assert.Equal(old.CreatedAt, oldest!.Value, TimeSpan.FromSeconds(1));
}
}