test(grpc-data): H2 smoke asserts the no-grant capabilities shape (review fix 7a)

This commit is contained in:
Joseph Doherty
2026-11-23 23:35:41 -05:00
parent 99598637d5
commit 1d3f172f83
@@ -219,8 +219,12 @@ try
catch (RpcException error) { deniedRpc = error.StatusCode.ToString(); }
var otherCaps = await client.GetCapabilitiesAsync(new() { ProtocolMajor = 1, ProtocolMinor = 3 }, With(otherKey, true), deadline());
var identical = denied is not null && Shape(unhist).AsSpan().SequenceEqual(Shape(denied));
// Review fix 7a: a peer without a HistoryRead grant sees `history` (the origin has a historian) but no aggregates,
// resolution 0 and no bit 32.
var noGrantShape = otherCaps.History is not null && otherCaps.History.Aggregates.Count == 0
&& otherCaps.History.TimestampResolutionTicks == 0 && (otherCaps.Operations & 32) == 0;
var deniedOk = deniedExpect == "permission-denied"
? deniedRpc == "PermissionDenied"
? deniedRpc == "PermissionDenied" && noGrantShape
: denied is not null && denied.StatusCode == 0x80720000u && identical;
string? precondition = null;
try { await client.HistoryReadAsync(Raw(View(historized), null), With(key, false), deadline()); precondition = "OK"; }
@@ -231,7 +235,8 @@ try
["unhistorized"] = new { statusCode = Hex(unhist.StatusCode), unhist.Samples.Count, unhist.HasContinuation, unhist.HasDiagnostic, bytes = Convert.ToHexString(Shape(unhist)) },
["deniedExpect"] = deniedExpect,
["deniedPrincipal"] = denied is null ? new { rpcStatus = deniedRpc } : (object)new { statusCode = Hex(denied.StatusCode), denied.Samples.Count, denied.HasContinuation, denied.HasDiagnostic, bytes = Convert.ToHexString(Shape(denied)) },
["deniedPrincipalCapabilities"] = new { operations = otherCaps.Operations, historyPresent = otherCaps.History is not null },
["deniedPrincipalCapabilities"] = new { operations = otherCaps.Operations, historyPresent = otherCaps.History is not null,
history = otherCaps.History?.ToString(), noGrantShape },
["byteIdentical"] = identical,
["withoutFeatureHeader"] = precondition,
}));