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:
@@ -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;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace ZB.MOM.WW.OtOpcUa.Runtime.DataConnections;
|
||||
/// failover and re-deploys, identical on both pair members (the secret is a per-cluster <c>${secret:}</c>), and
|
||||
/// equal across every listing and principal (m-T6), so a consumer dedupes a condition's Raw and UNS placements.
|
||||
/// Being keyed, it cannot be dictionary-reversed from guessable RawPaths, and it carries no RawPath or driver id
|
||||
/// (unlike <c>Metadata.stable_source_id</c>, #916).
|
||||
/// (the v1 <c>Metadata.stable_source_id</c> did, and is no longer sent, #916).
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Without a secret the origin advertises no <c>conditions</c> capability (fail closed): <see cref="IsAvailable"/>
|
||||
|
||||
@@ -394,11 +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). 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);
|
||||
|
||||
+13
-2
@@ -92,11 +92,16 @@ 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,
|
||||
array && supported ? Array.AsReadOnly(new[] { length is { } n ? checked((int)n) : 0 }) : [],
|
||||
writable, operations, serving.CatalogEpoch, source?.StableSourceId, null, false,
|
||||
// #916: Metadata.stable_source_id is never sent. The internal key of a driver source is
|
||||
// "<len>:<driverInstanceId><RawPath>" (SourceKey.ForDriver), which told a UNS-only peer the origin's driver ids
|
||||
// and RawPaths; no consumer uses the field (it is optional on the wire and old consumers decode its absence as
|
||||
// null). Acquisition keys on the LocalDataNode.Source BackingSourceKey, which is unchanged.
|
||||
writable, operations, serving.CatalogEpoch, null, null, false,
|
||||
array && supported ? valueKind : null);
|
||||
nodes.Add(new(kind, id, metadata, scope, parent, source, supported, enabled));
|
||||
views.Add((view.Realm, kind, id.ToUpperInvariant()), view);
|
||||
@@ -131,7 +136,13 @@ public sealed partial class LocalExportCatalog
|
||||
var enabled = deviceById[tagById[plan.TagId].DeviceId].Enabled && driverById[plan.DriverInstanceId].Enabled;
|
||||
rawSources.Add(plan.NodeId, (source, enabled));
|
||||
var kind = ValueKind(plan.DataType);
|
||||
var supported = kind != DataValueKind.Unspecified && (!plan.IsArray || DataValue.IsSupportedArrayElementKind(kind));
|
||||
// #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 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);
|
||||
Add("RawTag", plan.TagId, plan.Name, rawView, scope, RawParent(scope), source,
|
||||
supported ? kind : DataValueKind.Null, plan.Writable && (!plan.IsArray || plan.ArrayWritable),
|
||||
|
||||
Reference in New Issue
Block a user