Merge #916/#917: stop sending stable_source_id (field 10 deprecated, never encoded/decoded); alarm-bearing raw tags are unsupported value nodes hidden from browse; review fixes

This commit is contained in:
Joseph Doherty
2026-11-28 10:43:51 -05:00
16 changed files with 548 additions and 21 deletions
@@ -69,7 +69,7 @@ public sealed class GrpcDataHistoryWireTests
byId["Plant/Modbus/dev1/Speed"].History.Historizing.ShouldBeFalse();
(byId["Plant/Modbus/dev1/Speed"].AllowedOperations & 32u).ShouldBe(0u);
// Header-less: the golden (no Metadata.history, no bit 32).
(await origin.DriveAsync("GetMetadata", new Metadata())).ShouldBe(GrpcDataV1RealOriginGoldens.Responses["GetMetadata"]);
(await origin.DriveAsync("GetMetadata", new Metadata())).ShouldBe(GrpcDataV1RealOriginCorrections.Expected("GetMetadata"));
// A caller whose ACL lacks HistoryRead sees historizing=false on Flow: the same as an unhistorized node.
await using var denied = new RealOrigin(permissions: NodePermissions.Operator & ~NodePermissions.HistoryRead);
var deniedMeta = W.MetadataResponse.Parser.ParseFrom(Convert.FromHexString(await denied.DriveAsync("GetMetadata", History)));
@@ -64,12 +64,30 @@ public sealed class GrpcDataV1CompatibilityTests
Hex(V1Requests.Bytes(rpc)).ShouldBe(GrpcDataV1Goldens.Requests[rpc], $"recorded {rpc} request");
}
/// <summary>#916: the only correction of the fake-origin goldens is field 10, and the recording really carried it.</summary>
[Fact]
public void V1_correction_916_clears_only_stable_source_id()
{
foreach (var rpc in RpcNames.Where(r => r != "Subscribe"))
{
var golden = GrpcDataV1Goldens.Responses[rpc];
if (GrpcDataV1Corrections.Corrected.Contains(rpc))
{
GrpcDataV1Corrections.Expected(rpc).ShouldNotBe(golden, $"{rpc}: the recorded fake metadata carried field 10");
IMessage parsed = rpc == "Browse" ? W.BrowseResponse.Parser.ParseFrom(Convert.FromHexString(golden))
: W.MetadataResponse.Parser.ParseFrom(Convert.FromHexString(golden));
Hex(parsed.ToByteArray()).ShouldBe(golden, $"{rpc}: re-serialising a golden is byte-identical");
}
else GrpcDataV1Corrections.Expected(rpc).ShouldBe(golden);
}
}
[Theory]
[MemberData(nameof(Rpcs))]
public async Task V1_client_without_feature_header_gets_the_recorded_v1_response_bytes(string rpc)
{
var actual = await V1CompatibilityHarness.DriveAsync(rpc, new Metadata());
actual.ShouldBe(GrpcDataV1Goldens.Responses[rpc], $"{rpc} response diverged from the recorded v1 bytes");
actual.ShouldBe(GrpcDataV1Corrections.Expected(rpc), $"{rpc} response diverged from the recorded v1 bytes");
}
[Theory]
@@ -79,9 +97,9 @@ public sealed class GrpcDataV1CompatibilityTests
// H2 supports history, but this origin advertises none (and conditions are A2): the effective set is empty.
var headers = new Metadata { { "x-otopcua-data-features", "history,conditions" } };
var actual = await V1CompatibilityHarness.DriveAsync(rpc, headers, history: false, conditions: false);
actual.ShouldBe(GrpcDataV1Goldens.Responses[rpc], $"{rpc} response must not change when nothing requested is servable");
actual.ShouldBe(GrpcDataV1Corrections.Expected(rpc), $"{rpc} response must not change when nothing requested is servable");
(await V1CompatibilityHarness.DriveAsync(rpc, new Metadata { { "x-otopcua-data-features", "conditions" } }, conditions: false))
.ShouldBe(GrpcDataV1Goldens.Responses[rpc], $"{rpc}: conditions on an origin that cannot serve them change nothing");
.ShouldBe(GrpcDataV1Corrections.Expected(rpc), $"{rpc}: conditions on an origin that cannot serve them change nothing");
}
[Fact]
@@ -254,6 +272,39 @@ public sealed class GrpcDataV1CompatibilityTests
internal static IMessage Normalise(IMessage message) => message;
}
/// <summary>
/// #916 (pre-deploy, never re-recorded): <c>DataProtoMapper</c> no longer encodes <c>Metadata.stable_source_id</c>
/// (field 10), so the fake origin's metadata loses it on the wire. The expected bytes are the recorded golden with field 10
/// cleared on every Metadata of Browse and GetMetadata. That is the only edit. The real-origin variant has its own corrections
/// (<see cref="GrpcDataV1RealOriginCorrections"/>).
/// </summary>
internal static class GrpcDataV1Corrections
{
internal static readonly string[] Corrected = ["Browse", "GetMetadata"];
internal static string Expected(string rpc)
{
var golden = GrpcDataV1Goldens.Responses[rpc];
if (!Corrected.Contains(rpc)) return golden;
var bytes = Convert.FromHexString(golden);
IMessage corrected;
if (rpc == "Browse")
{
var response = W.BrowseResponse.Parser.ParseFrom(bytes);
foreach (var item in response.Items) item.ClearStableSourceId();
corrected = response;
}
else
{
var response = W.MetadataResponse.Parser.ParseFrom(bytes);
foreach (var item in response.Items) item.Value?.ClearStableSourceId();
corrected = response;
}
return Convert.ToHexString(corrected.ToByteArray());
}
}
/// <summary>The recorded v1 client requests. Changing any value here invalidates the goldens.</summary>
internal static class V1Requests
{
@@ -66,13 +66,53 @@ public sealed class GrpcDataV1RealOriginCompatibilityTests
Hex(RealOriginRequests.Bytes(scenario)).ShouldBe(GrpcDataV1RealOriginGoldens.Requests[scenario], $"recorded {scenario} request");
}
/// <summary>
/// #916/#917: the corrections are exact and not vacuous — an unedited golden re-serialises byte-identically, the
/// uncorrected scenarios are the raw goldens, the recorded UNS browse really leaked the driver id + RawPath, and the
/// corrected bytes carry neither the leak nor a value-bearing HighTemp.
/// </summary>
[Fact]
public void V1_corrections_916_917_are_exact_and_the_recorded_leak_was_real()
{
foreach (var scenario in RealOriginRequests.Scenarios.Where(s => s != "Subscribe"))
{
var golden = GrpcDataV1RealOriginGoldens.Responses[scenario];
IMessage parsed = scenario.Split('/')[0] switch
{
"GetCapabilities" => W.CapabilitiesResponse.Parser.ParseFrom(Convert.FromHexString(golden)),
"Browse" => W.BrowseResponse.Parser.ParseFrom(Convert.FromHexString(golden)),
"GetMetadata" => W.MetadataResponse.Parser.ParseFrom(Convert.FromHexString(golden)),
"Read" => W.ReadResponse.Parser.ParseFrom(Convert.FromHexString(golden)),
_ => W.WriteResponse.Parser.ParseFrom(Convert.FromHexString(golden)),
};
Hex(parsed.ToByteArray()).ShouldBe(golden, $"{scenario}: re-serialising a golden is byte-identical");
if (GrpcDataV1RealOriginCorrections.Corrected.Contains(scenario))
GrpcDataV1RealOriginCorrections.Expected(scenario).ShouldNotBe(golden, $"{scenario} carries a corrected field");
else
GrpcDataV1RealOriginCorrections.Expected(scenario).ShouldBe(golden);
}
var leak = Hex(System.Text.Encoding.UTF8.GetBytes("driver-1Plant/Modbus/dev1/"));
GrpcDataV1RealOriginGoldens.Responses["Browse/uns"].ShouldContain(leak, Case.Sensitive, "the recorded v1 UNS browse leaked it (#916)");
foreach (var scenario in GrpcDataV1RealOriginCorrections.Corrected)
GrpcDataV1RealOriginCorrections.Expected(scenario).ShouldNotContain(leak, Case.Sensitive);
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]
[MemberData(nameof(Scenarios))]
public async Task V1_client_without_feature_header_gets_the_recorded_v1_response_bytes(string scenario)
{
await using var origin = new RealOrigin();
var actual = await origin.DriveAsync(scenario, new Metadata());
actual.ShouldBe(GrpcDataV1RealOriginGoldens.Responses[scenario], $"{scenario} response diverged from the recorded v1 bytes");
actual.ShouldBe(GrpcDataV1RealOriginCorrections.Expected(scenario), $"{scenario} response diverged from the recorded v1 bytes");
}
[Theory]
@@ -83,10 +123,10 @@ public sealed class GrpcDataV1RealOriginCompatibilityTests
// effective set is empty and the bytes are v1.
await using var origin = new RealOrigin(historian: false, conditions: false);
var actual = await origin.DriveAsync(scenario, new Metadata { { "x-otopcua-data-features", "history,conditions" } });
actual.ShouldBe(GrpcDataV1RealOriginGoldens.Responses[scenario], $"{scenario} response must not change when nothing requested is servable");
actual.ShouldBe(GrpcDataV1RealOriginCorrections.Expected(scenario), $"{scenario} response must not change when nothing requested is servable");
await using var conditionsOnly = new RealOrigin(conditions: false);
(await conditionsOnly.DriveAsync(scenario, new Metadata { { "x-otopcua-data-features", "conditions" } }))
.ShouldBe(GrpcDataV1RealOriginGoldens.Responses[scenario], $"{scenario}: conditions on an origin that cannot serve them change nothing");
.ShouldBe(GrpcDataV1RealOriginCorrections.Expected(scenario), $"{scenario}: conditions on an origin that cannot serve them change nothing");
}
[Fact]
@@ -219,6 +259,56 @@ public sealed class GrpcDataV1RealOriginCompatibilityTests
internal static IMessage Normalise(IMessage message) => message;
}
/// <summary>
/// The deliberate pre-deploy v1 corrections (#916, #917; v1 was merged but never deployed, #915). The goldens in
/// <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; 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 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
{
internal static readonly string[] Corrected = ["Browse", "Browse/uns", "GetMetadata"];
internal static string Expected(string scenario)
{
var golden = GrpcDataV1RealOriginGoldens.Responses[scenario];
if (!Corrected.Contains(scenario)) return golden;
var bytes = Convert.FromHexString(golden);
var alarm = RealOriginRequests.HighTemp.Address.Identifier;
IMessage corrected;
if (scenario == "GetMetadata")
{
var response = W.MetadataResponse.Parser.ParseFrom(bytes);
foreach (var item in response.Items)
{
if (item.Value is null) continue;
if (item.Value.View.Address.Identifier == alarm && item.Value.View.Realm == (int)DataRealm.Raw)
{ item.Status = (int)DataItemStatus.Unsupported; item.Value = null; item.Lease = null; continue; }
item.Value.ClearStableSourceId();
}
corrected = response;
}
else
{
var response = W.BrowseResponse.Parser.ParseFrom(bytes);
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());
}
}
/// <summary>The recorded v1 client requests against <see cref="RealOrigin"/>'s catalog. Changing any value invalidates the goldens.</summary>
internal static class RealOriginRequests
{
@@ -6,6 +6,8 @@ namespace ZB.MOM.WW.OtOpcUa.Host.Tests.DataConnections;
/// NEVER re-record these to make a later phase (H2, A2, A3, ...) pass: a difference is a v1 wire regression of the
/// real origin, not a stale golden. A later phase extends <see cref="RealOrigin"/>'s snapshot with its new-shape data
/// and must still produce these exact bytes for a headerless (and, while unsupported, a feature-requesting) v1 call.
/// The only sanctioned differences are the pre-deploy corrections #916/#917, applied to these bytes (not re-recorded) by
/// <see cref="GrpcDataV1RealOriginCorrections"/>.
/// </summary>
internal static class GrpcDataV1RealOriginGoldens
{
@@ -2,6 +2,7 @@ using System.Security.Cryptography;
using System.Text.Json;
using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.Commons.DataConnections;
using ZB.MOM.WW.OtOpcUa.Commons.OpcUa;
using ZB.MOM.WW.OtOpcUa.Configuration.Entities;
using ZB.MOM.WW.OtOpcUa.Configuration.Enums;
@@ -45,7 +46,7 @@ public sealed class GrpcDataConditionPlacementTests
Devices = [new() { DeviceId = "device", DriverInstanceId = "driver-id-7f3", Name = "Device", DeviceConfig = "{}" }],
TagGroups = [new() { TagGroupId = "group", DeviceId = "device", Name = "Group" }],
Tags = [new() { TagId = "tag", DeviceId = "device", Name = "Speed", DataType = "Int32", AccessLevel = TagAccessLevel.ReadWrite, TagConfig = "{}" },
new() { TagId = "alarm-tag", DeviceId = "device", TagGroupId = "group", Name = "OverTemp", DataType = "Boolean", AccessLevel = TagAccessLevel.Read,
new() { TagId = "alarm-tag", DeviceId = "device", TagGroupId = "group", Name = "OverTemp", DataType = "Boolean", AccessLevel = TagAccessLevel.ReadWrite,
TagConfig = withAlarms ? AlarmConfig : "{}" }],
UnsAreas = [new() { UnsAreaId = "area-id", ClusterId = "cluster", Name = "Area" }],
UnsLines = [new() { UnsLineId = "line-id", UnsAreaId = "area-id", Name = "Line" }],
@@ -306,6 +307,83 @@ public sealed class GrpcDataConditionPlacementTests
listedNative.ShouldBeGreaterThan(20); // the generator really exercised native UNS placements
}
/// <summary>
/// #916: no exported metadata carries <c>stable_source_id</c> — a driver source's internal key is
/// <c>&lt;len&gt;:&lt;driverInstanceId&gt;&lt;RawPath&gt;</c>, so sending it told a UNS-only peer the origin's driver ids and
/// RawPaths. The internal <see cref="BackingSourceKey"/> is unchanged (positive control: it still holds both, so the
/// search below would see a leak). Checked on the encoded wire bytes of every node, every realm, 60 seeds.
/// </summary>
[Fact]
public void No_exported_metadata_carries_the_internal_source_key_916()
{
var checkedSources = 0;
for (var seed = 1; seed <= 60; seed++)
{
var (snapshot, rawPaths, driverIds, _) = Generate(seed);
using var fixture = new LocalDataFixture();
var catalog = LocalExportCatalog.Compile(snapshot, fixture.Serving, fixture.Activation.CaptureAuthority());
foreach (var node in catalog.Nodes)
{
node.Metadata.StableSourceId.ShouldBeNull($"seed {seed} {node.EntityKind} {node.EntityId}");
var wire = DataProtoMapper.EncodeMetadata(node.Metadata);
wire.HasStableSourceId.ShouldBeFalse();
if (node.Metadata.View.Realm != DataRealm.Uns) continue;
var text = wire.ToString();
foreach (var rawPath in rawPaths) text.ShouldNotContain(rawPath, Case.Sensitive, $"seed {seed}");
foreach (var driverId in driverIds) text.ShouldNotContain(driverId, Case.Sensitive, $"seed {seed}");
// Positive control: the internal key of a driver-backed UNS reference still names its driver and RawPath.
if (node.Source is { SourceKind: "driver" } source)
{
driverIds.ShouldContain(d => source.StableSourceId.Contains(d, StringComparison.Ordinal));
rawPaths.ShouldContain(r => source.StableSourceId.EndsWith(r, StringComparison.Ordinal));
checkedSources++;
}
}
}
checkedSources.ShouldBeGreaterThan(20); // the generator really produced driver-backed UNS references
}
/// <summary>
/// #917: an alarm-bearing raw tag gets no value (DriverHostActor keeps it out of the value fan-out, and #896 gives it
/// no UNS variable), so v1 compiles it as an unsupported value node: kind <c>UnsupportedVariable</c>, never writable
/// (the fixture tag is ReadWrite), Unsupported on every value operation, and NOT listed by Browse — never a Variable
/// that waits forever. Its condition placements (A1) are untouched. An export rooted at it still compiles (the
/// deploy is not broken) but grants nothing: its values are unsupported and its condition is not under the root.
/// </summary>
[Fact]
public void An_alarm_bearing_raw_tag_is_an_UnsupportedVariable_and_keeps_its_condition_placements_917()
{
using var fixture = new LocalDataFixture();
var catalog = LocalExportCatalog.Compile(Fixed(), fixture.Serving, fixture.Activation.CaptureAuthority());
var alarm = catalog.Nodes.Single(n => n.EntityKind == "RawTag" && n.EntityId == "alarm-tag");
alarm.Supported.ShouldBeFalse();
alarm.Metadata.NodeKind.ShouldBe("UnsupportedVariable");
alarm.Metadata.ValueKind.ShouldBe(DataValueKind.Null);
alarm.Metadata.Writable.ShouldBeFalse();
// (Every value gate keys on Supported; the operations a caller sees are masked to Browse by LocalDataServices —
// pinned on the wire by GrpcDataV1RealOriginCompatibilityTests.)
// Positive controls: a plain tag is still a Variable, and the same tag without its alarm config is one too.
var speed = catalog.Nodes.Single(n => n.EntityKind == "RawTag" && n.EntityId == "tag");
speed.Supported.ShouldBeTrue();
speed.Metadata.NodeKind.ShouldBe("Variable");
var plain = LocalExportCatalog.Compile(Fixed(withAlarms: false), fixture.Serving, fixture.Activation.CaptureAuthority())
.Nodes.Single(n => n.EntityKind == "RawTag" && n.EntityId == "alarm-tag");
plain.Supported.ShouldBeTrue();
plain.Metadata.NodeKind.ShouldBe("Variable");
plain.Metadata.ValueKind.ShouldBe(DataValueKind.Boolean);
plain.Metadata.Writable.ShouldBeTrue(); // the same ReadWrite tag without its alarm IS writable
// Condition forwarding is unaffected: the Raw placement at its RawPath and both UNS placements remain.
catalog.PlacementsOf(new(AddressSpaceRealm.Raw, "Plant/Driver/Device/Group/OverTemp")).Count.ShouldBe(3);
catalog.ListConditions("raw-peer", LocalExportCatalog.RealmRoot("cluster", DataRealm.Raw), DataOperations.Subscribe,
ConditionKeys.FromSecret(Secret)).ShouldHaveSingleItem();
// A deployable export rooted at the alarm-bearing tag still compiles (the node is kept, not removed).
var b = Fixed();
Should.NotThrow(() => LocalExportCatalog.Compile(With(b, exports: [.. b.DataExports,
Export("tag-root", DataRealm.Raw, "tag-peer", rootKind: "RawTag", rootId: "alarm-tag")]), fixture.Serving, fixture.Activation.CaptureAuthority()));
}
private static (DraftSnapshot Snapshot, string[] RawPaths, string[] DriverIds, int ExpectedUnsNative) Generate(int seed)
{
var random = new Random(seed);
@@ -33,6 +33,43 @@ public sealed class GrpcDataLocalConnectionTests
expired.Items.ShouldBeEmpty();
}
/// <summary>
/// #917 review: Browse skips unsupported value nodes across page boundaries. With a page size of 2 and children
/// <c>[Speed, u, u, u, v, u, v]</c>, every supported child appears exactly once, no unsupported one appears, the walk
/// completes, and no page is empty: a skipped node does not count against the page's scan bound, so the skip
/// never produces an empty <c>Complete = false</c> page.
/// </summary>
[Fact]
public async Task Browse_skips_unsupported_value_nodes_across_page_boundaries_917()
{
using var fixture = new LocalDataFixture(siblingPattern: "uuuvuv");
await using var connection = fixture.Connection();
var budget = LocalDataFixture.Budget with { MaxItems = 2 };
var seen = new List<string>();
var pages = 0;
string? continuation = null;
while (true)
{
var page = await connection.BrowseAsync(new(fixture.Root, null, continuation, budget), TestContext.Current.CancellationToken);
page.Status.ShouldBe(DataItemStatus.Good);
page.Items.ShouldNotBeEmpty($"page {pages}");
page.Items.Count.ShouldBeLessThanOrEqualTo(2);
seen.AddRange(page.Items.Select(x => x.BrowseName));
pages++;
if (page.Complete) { page.Continuation.ShouldBeNull(); break; }
page.Continuation.ShouldNotBeNull();
continuation = page.Continuation;
pages.ShouldBeLessThan(10);
}
seen.ShouldBe(["Speed", "c3", "c5"]);
pages.ShouldBe(2);
// Positive control: the unsupported siblings are in the catalog and addressable (Unsupported, not NotFound).
fixture.Catalog.Nodes.Count(n => !n.Supported).ShouldBe(4);
var metadata = await connection.GetMetadataAsync(new([fixture.Root with { Address = fixture.Root.Address with { Identifier = "Plant/c0" },
Subject = "Plant/c0" }], LocalDataFixture.Budget), TestContext.Current.CancellationToken);
metadata.ShouldHaveSingleItem().Status.ShouldBe(DataItemStatus.Unsupported);
}
[Fact]
public async Task Metadata_bootstrap_resolves_address_and_never_uses_the_claimed_subject_as_authority()
{
@@ -136,7 +173,8 @@ internal sealed class LocalDataFixture : IDisposable
bool advanceAuthority = false, string role = "Primary", long servingGeneration = 0, bool nestedCatalog = false, bool nestedUnsCatalog = false,
Func<DataAuthenticatedContext, IDataWriteService>? writes = null, bool denyReadExport = false,
ManualTimeProvider? clock = null, string servingNode = "node-a", string servingIncarnation = "serving-1",
IOriginHistoryPort? history = null, DataValueKind rawValueKind = DataValueKind.Int32, int maxBatchItems = 100)
IOriginHistoryPort? history = null, DataValueKind rawValueKind = DataValueKind.Int32, int maxBatchItems = 100,
string? siblingPattern = null)
{
if (clock is not null) Clock = clock;
Serving = Serving with { NodeId = servingNode, Incarnation = servingIncarnation, Role = role, ServingGeneration = servingGeneration };
@@ -191,6 +229,17 @@ internal sealed class LocalDataFixture : IDisposable
nodes.Add(new("RawTag", "extra-" + i, rawMetadata with { View = view, BrowseName = "Speed" + i },
new() { ClusterId = "cluster", Kind = NodeHierarchyKind.Raw, Segments = ["Plant", "Driver", "Device", "Speed" + i] }, Root, Ticket.Key));
}
// #917: "u" = an unsupported value node (as an alarm-bearing tag compiles), "v" = a supported one, named c0, c1, ...
// in order (they sort after "Speed"), all under Root.
for (var i = 0; i < (siblingPattern?.Length ?? 0); i++)
{
var name = "c" + i.ToString(System.Globalization.CultureInfo.InvariantCulture);
var view = Raw with { Address = Raw.Address with { Identifier = "Plant/" + name }, Subject = "Plant/" + name };
var supported = siblingPattern![i] == 'v';
nodes.Add(new("RawTag", "sibling-" + name, supported ? rawMetadata with { View = view, BrowseName = name }
: rawMetadata with { View = view, BrowseName = name, NodeKind = "UnsupportedVariable", ValueKind = DataValueKind.Null, Writable = false },
new() { ClusterId = "cluster", Kind = NodeHierarchyKind.Raw, Segments = ["Plant", name] }, Root, Ticket.Key, Supported: supported));
}
Catalog = new LocalExportCatalog("cluster", Serving, Activation.CaptureAuthority(), nodes,
[new() { DataExportId = "raw-export", ClusterId = "cluster", Enabled = true, Realm = DataRealm.Raw, RootKind = "RawFolder", RootEntityId = "folder", PrincipalId = "peer", AllowedOperations = operations },
new() { DataExportId = "uns-export", ClusterId = "cluster", Enabled = true, Realm = DataRealm.Uns, RootKind = nestedUnsCatalog ? "UnsArea" : "UnsTagReference", RootEntityId = nestedUnsCatalog ? "area" : "reference", PrincipalId = "peer", AllowedOperations = operations }]);