fix(grpc-data): an unknown value/element kind or per-item metadata status from a newer origin fails one item, not the whole browse/metadata response (#956)
DataProtoMapper.DecodeMetadata decodes an undefined ValueKind / ArrayElementKind number to an unknown-kind marker (DataMetadata.HasUnknownKind, ValidateDecoded) instead of throwing; Validate/Encode still refuse it. The resolver's #941 IsMaterialisable skips the marker whatever its node kind (a Folder included); a remote root carrying it is refused. An undefined per-item metadata status decodes to Unavailable (no value, no lease). Unspecified (0), bad array shape, unknown realm and unknown branch status still fail closed.
This commit is contained in:
@@ -139,9 +139,11 @@ public sealed class ProjectedCatalogCache
|
||||
/// that is not materialisable (an <c>UnsupportedVariable</c> from a pre-#917 origin, a node kind a newer origin adds, a
|
||||
/// value type the consumer cannot represent) is SKIPPED by the resolver; it used to fail the whole page, making the
|
||||
/// folder <c>BadNoCommunication</c>. A malformed item of a supported kind (rank / dimensions / element kind that do
|
||||
/// not agree) still fails the page closed — that is a protocol violation, not an unknown kind.
|
||||
/// not agree) still fails the page closed — that is a protocol violation, not an unknown kind. #956: an item whose value
|
||||
/// or element kind is a number this build does not define (<see cref="DataMetadata.HasUnknownKind"/>, decoded as a
|
||||
/// marker rather than failing the response) is never materialisable, whatever its node kind.
|
||||
/// </summary>
|
||||
internal static bool IsMaterialisable(DataMetadata metadata) => metadata.NodeKind switch
|
||||
internal static bool IsMaterialisable(DataMetadata metadata) => !metadata.HasUnknownKind && metadata.NodeKind switch
|
||||
{
|
||||
"Folder" => true,
|
||||
"Variable" or "Tag" => HasBuiltInType(metadata.ValueKind == DataValueKind.Array ? metadata.ArrayElementKind : metadata.ValueKind),
|
||||
|
||||
@@ -207,7 +207,7 @@ public sealed class RemoteNamespaceResolver : IFederatedProjectionCatalog, IDisp
|
||||
{
|
||||
var originView = new DataView(request.Parent.Address, request.Parent.Realm, null, 0, binding.Mapping.RemoteRootEntityId);
|
||||
var metadata = await connection.Connection.GetMetadataAsync(new([originView], request.Budget with { Timeout = remaining }), route.Token).ConfigureAwait(false);
|
||||
if (metadata.Count != 1 || metadata[0].Status != DataItemStatus.Good || metadata[0].Value is not { } root || root.View.Address != originView.Address || root.View.MappingId is not null || root.Serving is null)
|
||||
if (metadata.Count != 1 || metadata[0].Status != DataItemStatus.Good || metadata[0].Value is not { } root || root.HasUnknownKind || root.View.Address != originView.Address || root.View.MappingId is not null || root.Serving is null)
|
||||
return PreparedPage.Failed(ProjectionPageStatus.Unavailable);
|
||||
originParent = root;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user