fix(grpc-data): #916/#917 review r1 — mapper never encodes/decodes stable_source_id (proto field deprecated); browse skip does not consume the scan bound (no empty incomplete pages); unsupported nodes never writable; comment fixes
This commit is contained in:
@@ -194,7 +194,7 @@ Neither change alters the wire shape: one drops an optional field, the other dro
|
||||
- **Browse does not list it**, and the same holds for any unsupported value node, such as a data type v1 cannot carry.
|
||||
Every consumer build applies a browse page all or nothing and cannot materialise an `UnsupportedVariable`. Listing one
|
||||
made the whole folder unbrowsable on the consumer (`BadNoCommunication`); the live gate found this.
|
||||
- The node stays in the catalog, so an export rooted at it still compiles.
|
||||
- The node stays in the catalog, so an export rooted at it still compiles. Such a root grants nothing: the values are unsupported, and the condition sits under the tag's folder, not under the tag.
|
||||
- The alarm itself is forwarded as a **condition** (A1–A4, see "Condition forwarding end to end"). Condition placements
|
||||
do not depend on the value node.
|
||||
|
||||
|
||||
@@ -157,3 +157,24 @@ A Client.CLI browse of consumer-1 then showed `remote-opc` → `FastUInt1` only,
|
||||
|
||||
The live run does not separately probe `stable_source_id` over gRPC. #916 is pinned by the wire-level real-origin gate and
|
||||
the 60-seed property test above.
|
||||
|
||||
## Review round 1 (2026-11-28)
|
||||
|
||||
| Finding | Fix | Red/green |
|
||||
|---|---|---|
|
||||
| #916 defence in depth: the mapper still encoded field 10 if anything set it | `DataProtoMapper.EncodeMetadata` never writes field 10. `DecodeMetadata` drops it, so a consumer of a pre-fix origin never retains it in `OriginMetadata`. The proto marks field 10 deprecated in a comment (not renumbered or removed) | `GrpcDataCodecTests.Stable_source_id_is_never_encoded_and_is_dropped_on_decode_916`: red with master's mapper, green with the fix. Engineering units (field 11) are the positive control |
|
||||
| The fake-origin gate's goldens carry field 10 from its fake metadata, so the mapper change moves them | `GrpcDataV1Corrections.Expected` clears field 10 on the parsed Browse/GetMetadata goldens. That is the only edit, and the goldens are not re-recorded | `V1_correction_916_clears_only_stable_source_id`: the recording really carried field 10, an unedited golden re-serialises identically, and the other RPCs compare raw |
|
||||
| Browse page boundaries | A skipped unsupported node no longer counts against the page's scan bound. The budget timeout still bounds the call. The skip therefore never yields an empty `Complete=false` page | `GrpcDataLocalConnectionTests.Browse_skips_unsupported_value_nodes_across_page_boundaries_917`, page size 2 over `[Speed, u, u, u, v, u, v]`. Red before the fix (an empty first-continuation page). Green after: `Speed, c3, c5` each exactly once, 2 non-empty pages, completes. Positive control: the skipped nodes are addressable (`Unsupported`) |
|
||||
| Internal metadata still said an unsupported node was writable | `Add` compiles `writable &= supported` (raw tags, UNS references, virtual tags) | The #917 test fixture's alarm tag is now `ReadWrite`. `alarm.Metadata.Writable.ShouldBeFalse()` was red before the change and green after. Positive control: the same tag without its alarm is writable |
|
||||
| Stale "browsable" test doc; "an export may still be rooted at it" | Both reworded. Such a root compiles, but grants nothing: the values are unsupported, and the condition placement sits under the tag's folder, not under the tag | — |
|
||||
|
||||
A consumer receiving an empty `Complete=false` page is no longer produced by this change. It can still come from the
|
||||
pre-existing name filter. Whether the consumer resolver tolerates one was not tested end to end; it is suggested as a
|
||||
follow-up.
|
||||
|
||||
Gates after the review, Release:
|
||||
|
||||
- Commons.Tests: 513/513.
|
||||
- Runtime.Tests `Feature=GrpcData`: 1024/1024.
|
||||
- Host.Tests `Feature=GrpcData`: 211/211. This includes both v1 gates.
|
||||
- `dotnet build -c Release`: 0 warnings, 0 errors.
|
||||
|
||||
@@ -258,8 +258,8 @@ public static class DataProtoMapper
|
||||
v.Dimensions.AddRange(x.Dimensions);
|
||||
if (x.ArrayElementKind is { } elementKind)
|
||||
v.ArrayElementKind = (W.ValueKind)elementKind;
|
||||
if (x.StableSourceId is not null)
|
||||
v.StableSourceId = x.StableSourceId;
|
||||
// #916: field 10 (stable_source_id) is never encoded, whatever the caller set. It carried the origin's internal
|
||||
// acquisition key (driver instance id + RawPath), and no consumer needs it.
|
||||
if (x.EngineeringUnits is not null)
|
||||
v.EngineeringUnits = x.EngineeringUnits;
|
||||
// H2: the service strips this (and the HistoryRead bit) from every response of a call that did not negotiate history.
|
||||
@@ -288,7 +288,8 @@ public static class DataProtoMapper
|
||||
// A2b method bits are condition grants, never node operations, so a metadata item carrying them is masked too.
|
||||
(DataOperations)(x.AllowedOperations & (uint)DataOperationSets.Understood & ~(uint)DataOperationSets.ConditionGrants),
|
||||
x.CatalogRevision,
|
||||
x.HasStableSourceId ? x.StableSourceId : null,
|
||||
// #916: dropped on decode too, so a consumer of a pre-fix origin never retains it in OriginMetadata.
|
||||
null,
|
||||
x.HasEngineeringUnits ? x.EngineeringUnits : null,
|
||||
x.IsStale,
|
||||
x.HasArrayElementKind ? (DataValueKind)x.ArrayElementKind : null,
|
||||
|
||||
@@ -161,6 +161,8 @@ message Metadata {
|
||||
bool writable = 7;
|
||||
uint32 allowed_operations = 8;
|
||||
int64 catalog_revision = 9;
|
||||
// DEPRECATED (#916): never sent and ignored on receipt. It carried the origin's internal acquisition key (driver
|
||||
// instance id + RawPath). Kept so the field number is never reused.
|
||||
optional string stable_source_id = 10;
|
||||
optional string engineering_units = 11;
|
||||
bool is_stale = 12;
|
||||
|
||||
@@ -394,16 +394,19 @@ public sealed partial class LocalDataServices : IDataConnectionFactory
|
||||
long bytes = 256;
|
||||
var maximum = Math.Min(request.Budget.MaxItems, limits.MaxPageItems);
|
||||
var scanned = 0;
|
||||
while (offset < children.Count && page.Count < maximum && scanned++ < maximum)
|
||||
while (offset < children.Count && page.Count < maximum && scanned < maximum)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
if (Expired(start, request.Budget)) return Task.FromResult(Empty(DataItemStatus.Unavailable));
|
||||
var child = children[offset++];
|
||||
// #917: an unsupported value node (an alarm-bearing tag, or a data type v1 cannot carry) is never listed. Every
|
||||
// consumer build applies a browse page all-or-nothing and cannot materialise one, so listing it made the whole
|
||||
// folder unbrowsable on the consumer (BadNoCommunication). It stays addressable: GetMetadata/Read/Subscribe on
|
||||
// it answer Unsupported, and an export may still be rooted at it.
|
||||
// folder unbrowsable on the consumer (BadNoCommunication). It stays addressable (GetMetadata/Read/Subscribe on it
|
||||
// answer Unsupported). An export rooted at it still compiles but grants nothing. A skipped node is not counted
|
||||
// against the scan bound (it costs one check; the budget timeout above still bounds the call), so the skip never
|
||||
// yields an empty Complete=false page.
|
||||
if (child.Source is not null && !child.Supported) continue;
|
||||
scanned++;
|
||||
if ((request.Filter is { Length: > 0 } filter && !child.Metadata.BrowseName.Contains(filter, StringComparison.Ordinal))
|
||||
|| !Allowed(catalog, context, child, DataOperations.Browse)) continue;
|
||||
var metadata = Metadata(catalog, context, target, child);
|
||||
|
||||
+4
-2
@@ -92,6 +92,7 @@ public sealed partial class LocalExportCatalog
|
||||
BackingSourceKey? source = null, DataValueKind valueKind = DataValueKind.Null, bool writable = false,
|
||||
bool array = false, uint? length = null, bool supported = true, bool enabled = true)
|
||||
{
|
||||
writable &= supported; // #917 review: an unsupported value node is never writable, not even in internal metadata
|
||||
var operations = source is null ? navigation : data | (writable ? DataOperations.Write : DataOperations.None);
|
||||
var metadata = new DataMetadata(view, name, source is null ? "Folder" : supported ? "Variable" : "UnsupportedVariable",
|
||||
array && supported ? DataValueKind.Array : valueKind, array && supported ? 1 : -1,
|
||||
@@ -137,8 +138,9 @@ public sealed partial class LocalExportCatalog
|
||||
var kind = ValueKind(plan.DataType);
|
||||
// #917: an alarm-bearing tag never gets a value (DriverHostActor keeps it out of the value fan-out; #896 gives it
|
||||
// no UNS variable), so it is an unsupported value node: Browse does not list it (LocalDataServices) and every
|
||||
// value operation answers Unsupported, instead of a Variable a consumer would wait on forever. The node is KEPT
|
||||
// (an export may be rooted at it); its alarm is forwarded as a condition (A1–A4), never as a value.
|
||||
// value operation answers Unsupported, instead of a Variable a consumer would wait on forever. The node is KEPT so
|
||||
// an export rooted at it still compiles, but such a root grants nothing: its values are unsupported and its
|
||||
// condition placement sits under its folder, not under the tag. The alarm is forwarded as a condition (A1–A4).
|
||||
var supported = plan.Alarm is null && kind != DataValueKind.Unspecified
|
||||
&& (!plan.IsArray || DataValue.IsSupportedArrayElementKind(kind));
|
||||
var rawView = View(DataRealm.Raw, plan.NodeId, scope);
|
||||
|
||||
@@ -148,6 +148,31 @@ public sealed class GrpcDataCodecTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// #916 defence in depth: the mapper never encodes <c>stable_source_id</c> (field 10), whatever a caller sets, and
|
||||
/// drops it on decode so a consumer of a pre-fix origin never retains it. Engineering units (field 11) are the
|
||||
/// positive control: an optional string in the same message still round-trips.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Stable_source_id_is_never_encoded_and_is_dropped_on_decode_916()
|
||||
{
|
||||
var view = new DataView(new DataAddress("c", "urn:test", "string", "x"), DataRealm.Uns, null, 0, "subject");
|
||||
var metadata = new DataMetadata(view, "x", "Variable", DataValueKind.Int32, -1, [], false, DataOperations.Read, 1,
|
||||
"8:driver-1Plant/Modbus/dev1/Speed", "rpm", false);
|
||||
|
||||
var wire = DataProtoMapper.EncodeMetadata(metadata);
|
||||
wire.HasStableSourceId.ShouldBeFalse();
|
||||
ZB.MOM.WW.OtOpcUa.Commons.Protos.DataConnection.V1.Metadata.Parser.ParseFrom(wire.ToByteArray()).HasStableSourceId.ShouldBeFalse();
|
||||
wire.EngineeringUnits.ShouldBe("rpm");
|
||||
|
||||
// A pre-fix origin's bytes: field 10 present on the wire.
|
||||
var legacy = wire.Clone();
|
||||
legacy.StableSourceId = "8:driver-1Plant/Modbus/dev1/Speed";
|
||||
var decoded = DataProtoMapper.DecodeMetadata(legacy);
|
||||
decoded.StableSourceId.ShouldBeNull();
|
||||
decoded.EngineeringUnits.ShouldBe("rpm");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Array_metadata_rejects_missing_and_invalid_element_kind()
|
||||
{
|
||||
|
||||
+54
-3
@@ -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
|
||||
{
|
||||
|
||||
+6
-4
@@ -46,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" }],
|
||||
@@ -345,9 +345,10 @@ public sealed class GrpcDataConditionPlacementTests
|
||||
|
||||
/// <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 exports it as the pre-existing explicit <c>UnsupportedVariable</c> kind: browsable, with
|
||||
/// no Read/Subscribe/Write/HistoryRead bit, and Unsupported on every value operation — never a Variable that waits
|
||||
/// forever. Its condition placements (A1) are untouched, and an export rooted at it still compiles.
|
||||
/// 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()
|
||||
@@ -370,6 +371,7 @@ public sealed class GrpcDataConditionPlacementTests
|
||||
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);
|
||||
|
||||
+50
-1
@@ -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 }]);
|
||||
|
||||
Reference in New Issue
Block a user