fix(grpc-data): Browse does not list unsupported value nodes (#917)

Live gate fu916-1 found that listing an alarm-bearing tag as
UnsupportedVariable made the consumer's whole remote-opc folder unbrowsable
(BadNoCommunication): ProjectedNamespaceApplier applies a page all-or-nothing
and TryEnsureProjectedVariable rejects any kind but Folder/Variable/Tag, on
every consumer build. The origin now skips unsupported value nodes in Browse;
they stay addressable (Unsupported) and exportable.
This commit is contained in:
Joseph Doherty
2026-11-28 09:49:12 -05:00
parent b7ca71f188
commit 70539999f9
7 changed files with 60 additions and 39 deletions
@@ -98,6 +98,12 @@ public sealed class GrpcDataV1RealOriginCompatibilityTests
var metadata = W.MetadataResponse.Parser.ParseFrom(Convert.FromHexString(GrpcDataV1RealOriginCorrections.Expected("GetMetadata")));
metadata.Items.Count(x => x.Status == (int)DataItemStatus.Unsupported).ShouldBe(1);
metadata.Items.ShouldNotContain(x => x.Value != null && x.Value.View.Address.Identifier == RealOriginRequests.HighTemp.Address.Identifier);
// HighTemp was in the recorded device page and is the only item the correction drops (positive control).
var recorded = W.BrowseResponse.Parser.ParseFrom(Convert.FromHexString(GrpcDataV1RealOriginGoldens.Responses["Browse"]));
var corrected = W.BrowseResponse.Parser.ParseFrom(Convert.FromHexString(GrpcDataV1RealOriginCorrections.Expected("Browse")));
recorded.Items.Select(x => x.View.Address.Identifier).Except(corrected.Items.Select(x => x.View.Address.Identifier))
.ShouldBe([RealOriginRequests.HighTemp.Address.Identifier]);
corrected.Items.Count.ShouldBe(recorded.Items.Count - 1);
}
[Theory]
@@ -258,14 +264,14 @@ public sealed class GrpcDataV1RealOriginCompatibilityTests
/// <see cref="GrpcDataV1RealOriginGoldens"/> are NOT re-recorded: the expected bytes are the recorded golden with exactly
/// these edits applied to its parsed message, and every other byte must still match. Re-serialising an unedited golden is
/// byte-identical (asserted), so the edit is the only difference. Nothing here changes the wire SHAPE — both corrections
/// use fields and values a v1 client already handles (an absent optional field; the existing UnsupportedVariable kind and
/// Unsupported status, which the consumer already treats as "not a value node").
/// use fields and values a v1 client already handles (an absent optional field; one item fewer in a page; the existing
/// per-item Unsupported status).
/// <list type="bullet">
/// <item><b>#916</b> — <c>Metadata.stable_source_id</c> is never sent (it was <c>&lt;len&gt;:&lt;driverInstanceId&gt;&lt;RawPath&gt;</c>, even on
/// UNS exports). Cleared on every Metadata of every Browse/GetMetadata response.</item>
/// <item><b>#917</b> — the alarm-bearing raw tag (HighTemp) is exported as <c>UnsupportedVariable</c>: in a Browse page it is
/// <c>node_kind = "UnsupportedVariable"</c>, <c>value_kind = NULL</c>, <c>allowed_operations = Browse</c> (the existing
/// unsupported-node masking); a GetMetadata item for it is <c>status = Unsupported</c> with no value and no lease.</item>
/// <item><b>#917</b> — the alarm-bearing raw tag (HighTemp) is an unsupported value node: a Browse page no longer lists it
/// (every consumer build applies a page all-or-nothing and cannot materialise one), and a GetMetadata item for it is
/// <c>status = Unsupported</c> with no value and no lease.</item>
/// </list>
/// </summary>
internal static class GrpcDataV1RealOriginCorrections
@@ -294,12 +300,9 @@ internal static class GrpcDataV1RealOriginCorrections
else
{
var response = W.BrowseResponse.Parser.ParseFrom(bytes);
foreach (var item in response.Items)
{
item.ClearStableSourceId();
if (item.View.Address.Identifier == alarm && item.View.Realm == (int)DataRealm.Raw)
{ item.NodeKind = "UnsupportedVariable"; item.ValueKind = W.ValueKind.Null; item.AllowedOperations = (uint)DataOperations.Browse; }
}
var hidden = response.Items.Where(item => item.View.Address.Identifier == alarm && item.View.Realm == (int)DataRealm.Raw).ToArray();
foreach (var item in hidden) response.Items.Remove(item);
foreach (var item in response.Items) item.ClearStableSourceId();
corrected = response;
}
return GrpcDataV1RealOriginCompatibilityTests.Hex(corrected.ToByteArray());