fix(grpc-data): stop sending stable_source_id (#916); export alarm-bearing raw tags as UnsupportedVariable (#917)

#916: Metadata.stable_source_id carried the internal acquisition key
(<len>:<driverInstanceId><RawPath>) on every export, so a UNS-only peer learned
driver ids and RawPaths. No consumer uses the field beyond byte accounting; it is
optional on the wire and absent decodes as null. It is now never sent; the
internal BackingSourceKey is unchanged.

#917: alarm-bearing raw tags never get a value but were exported as Variables.
They are now the existing explicit UnsupportedVariable kind (browsable,
Unsupported on every value op). The node is kept so exports rooted at it still
compile and A1 condition placements are unaffected.

The real-origin v1 goldens are not re-recorded: GrpcDataV1RealOriginCorrections
applies exactly these two edits to the parsed goldens, pinned by a test.
Evidence: docs/plans/evidence/grpc-data-ext/V1-916-917.md
This commit is contained in:
Joseph Doherty
2026-11-28 09:23:34 -05:00
parent 05f431f5d8
commit b7ca71f188
10 changed files with 325 additions and 12 deletions
@@ -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"/>
@@ -96,7 +96,11 @@ public sealed partial class LocalExportCatalog
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 +135,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 exported as the explicit v1 UnsupportedVariable kind — browsable, Unsupported on
// every value operation — rather than a Variable a consumer would wait on forever. The node is KEPT (an export
// may be rooted at it, and its group folder still parents the A1 condition placement); its alarm is forwarded
// as a condition (A1–A4), never as a value.
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),