Merge branch 'review/wp5' into review/integration

This commit is contained in:
Joseph Doherty
2026-12-03 10:41:19 -05:00
29 changed files with 1093 additions and 112 deletions
@@ -221,6 +221,56 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>
/// Code review 2026-12-02 UI-11: a parked cached call whose source site no longer resolves
/// (site deleted or renamed) stays visible; a system-wide user can Retry it, while a
/// site-scoped user is still refused.
/// </summary>
/// <param name="siteScoped">Whether the caller carries a SiteId claim (site-scoped Deployer).</param>
[Theory]
[InlineData(false)]
[InlineData(true)]
public void Retry_OnRowFromADeletedSite_AllowedSystemWide_DeniedScoped(bool siteScoped)
{
var orphanId = Guid.Parse("33333333-3333-3333-3333-333333333333");
_queryReply = _queryReply with
{
SiteCalls = new List<SiteCallSummary>
{
new(orphanId, "deleted-site", "ApiOutbound", "ERP.Orphan", "Parked",
RetryCount: 5, LastError: "HTTP 503", HttpStatus: 503,
CreatedAtUtc: DateTime.UtcNow.AddMinutes(-30), UpdatedAtUtc: DateTime.UtcNow.AddMinutes(-5),
TerminalAtUtc: null, IsStuck: false),
},
};
if (siteScoped)
{
var claims = new[]
{
new Claim(JwtTokenService.UsernameClaimType, "tester"),
new Claim(JwtTokenService.RoleClaimType, "Deployer"),
new Claim(JwtTokenService.SiteIdClaimType, "1"),
};
Services.AddSingleton<AuthenticationStateProvider>(
new TestAuthStateProvider(new ClaimsPrincipal(new ClaimsIdentity(claims, "TestAuth"))));
}
var cut = Render<SiteCallsReportPage>();
cut.WaitForState(() => cut.Markup.Contains("ERP.Orphan"));
cut.FindAll("tbody tr").First(r => r.TextContent.Contains("ERP.Orphan"))
.QuerySelectorAll("button").First(b => b.TextContent.Contains("Retry")).Click();
if (siteScoped)
{
cut.WaitForAssertion(() => Assert.Contains("not permitted to act on cached calls", cut.Markup));
Assert.Empty(_retryRequests);
}
else
{
cut.WaitForAssertion(() => Assert.Equal(orphanId, Assert.Single(_retryRequests).TrackedOperationId));
}
}
/// <summary>Verifies that clicking Discard on a parked row relays the discard to the owning site.</summary>
[Fact]
public void ClickDiscard_OnParkedRow_RelaysDiscardToOwningSite()