fix(centralui): pending-updates rail refreshes as soon as a deployment finishes — cache drops its snapshot on Success/Failed and signals the indicator, instead of serving the pre-deploy count for up to TTL + one poll

This commit is contained in:
Joseph Doherty
2026-10-22 17:11:18 -04:00
parent 3e1435dfac
commit 0e5402915b
8 changed files with 305 additions and 12 deletions
@@ -126,6 +126,26 @@ public class PendingUpdatesIndicatorTests : BunitContext
return host.FindComponent<PendingUpdatesIndicator>();
}
/// <summary>
/// Verifies that the rail re-reads as soon as the cache reports it was invalidated (a
/// deployment finished), rather than waiting out its 30 s poll: after a successful Deploy
/// all the old count used to linger for up to the cache TTL plus one poll interval.
/// </summary>
[Fact]
public void CacheInvalidated_RereadsWithoutWaitingForThePoll()
{
var cache = Substitute.For<IPendingUpdatesCache>();
cache.GetAsync(Arg.Any<bool>(), Arg.Any<CancellationToken>()).Returns(
Task.FromResult(Snapshot(SiteRow(1, staleInstances: 9))),
Task.FromResult(Snapshot(SiteRow(1, staleInstances: 0))));
var cut = RenderFor(cache, Role(Roles.Deployer));
cut.WaitForAssertion(() => Assert.Contains("9 instances", cut.Markup));
cache.Invalidated += Raise.Event<Action>();
cut.WaitForAssertion(() => Assert.Contains("Up to date", cut.Markup), TimeSpan.FromSeconds(5));
}
/// <summary>Verifies that a user with only the Viewer role sees no pending-updates indicator.</summary>
[Fact]
public void Viewer_RendersNothing()