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:
+10
-7
@@ -177,7 +177,7 @@ advertisement and a per-call request header, `x-otopcua-data-features`, whose va
|
||||
### What an origin exports (v1 corrections #916, #917)
|
||||
|
||||
v1 was merged but not deployed (#915), so two defects were fixed in v1 itself. Header-less callers get the fix too.
|
||||
Neither change alters the wire shape. Evidence: `docs/plans/evidence/grpc-data-ext/V1-916-917.md`.
|
||||
Neither change alters the wire shape: one drops an optional field, the other drops a page item. Evidence: `docs/plans/evidence/grpc-data-ext/V1-916-917.md`.
|
||||
|
||||
- **No `Metadata.stable_source_id` (#916).** The origin never sends field 10. It used to carry the internal acquisition key,
|
||||
which for a driver tag is `<len>:<driverInstanceId><RawPath>`. That disclosed driver ids and RawPaths to peers holding
|
||||
@@ -187,13 +187,16 @@ Neither change alters the wire shape. Evidence: `docs/plans/evidence/grpc-data-e
|
||||
- The field is `optional`. Old consumers decode its absence as null, so every version mix works.
|
||||
- Conditions dedupe on the keyed `condition_key` instead.
|
||||
- Internally the origin still keys acquisition on the unchanged `BackingSourceKey`.
|
||||
- **Alarm-bearing raw tags are `UnsupportedVariable` (#917).** A tag with an alarm config never gets a value: the driver
|
||||
- **Alarm-bearing raw tags are not exported as values (#917).** A tag with an alarm config never gets a value: the driver
|
||||
host keeps it out of the value fan-out, and #896 gives it no UNS variable.
|
||||
- It is still browsable, so exports rooted at it and its folder's condition placement still work.
|
||||
- Its node kind is `UnsupportedVariable` and its value kind `NULL`, with Browse as the only operation. Read, Subscribe,
|
||||
GetMetadata and HistoryRead answer `Unsupported`, and writes are refused.
|
||||
- Consumers already skip that kind, so nothing waits on a value that never comes.
|
||||
- The alarm itself is forwarded as a **condition** (A1–A4, see "Condition forwarding end to end").
|
||||
- The origin compiles it as an unsupported value node. GetMetadata, Read, Subscribe and HistoryRead on it answer
|
||||
`Unsupported`, and writes are refused.
|
||||
- **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 alarm itself is forwarded as a **condition** (A1–A4, see "Condition forwarding end to end"). Condition placements
|
||||
do not depend on the value node.
|
||||
|
||||
G0, the v1 deploy and soak (#915), is still open; see the plan's §1.1.
|
||||
|
||||
|
||||
@@ -615,7 +615,7 @@ per-origin-cluster `${secret:}` of at least 32 UTF-8 bytes, identical on both pa
|
||||
- If the secret is absent, the origin advertises no `conditions` capability (fail closed, with a diagnostic).
|
||||
|
||||
> **Pre-existing v1 findings (not fixed here; filed as #916 and #917).** *Update 2026-11-28: both are fixed in v1 before
|
||||
> deploy. `stable_source_id` is no longer sent, and alarm-bearing raw tags are exported as `UnsupportedVariable`. See
|
||||
> deploy. `stable_source_id` is no longer sent, and alarm-bearing raw tags are no longer value nodes (not listed by Browse, `Unsupported` on every value operation). See
|
||||
> `docs/plans/evidence/grpc-data-ext/V1-916-917.md`.*
|
||||
> 1. #916 — `type:review-finding`, security: v1 already sends `stable_source_id` = driver id + RawPath on **UNS reference variables**
|
||||
> to UNS-only principals (same code path).
|
||||
|
||||
@@ -58,19 +58,30 @@ the reserved `Area/Line/Equipment/EffectiveName` id, parented at the equipment.
|
||||
condition items and keyed by `condition_key`, and the consumer materialises them in its `mapped/conditions` namespace.
|
||||
The alarm is therefore served as a condition, never as a value.
|
||||
|
||||
**Decision: export the tag as the existing explicit `UnsupportedVariable` kind** (`supported = plan.Alarm is null && …`).
|
||||
We did not remove the node, for three reasons:
|
||||
**Decision: compile the tag as an unsupported value node, and do not list it in Browse.** The rule is
|
||||
`supported = plan.Alarm is null && …` in `Compile`. In `LocalDataServices.BrowseAsync`, a child with a `Source` and
|
||||
`!Supported` is skipped.
|
||||
|
||||
- `UnsupportedVariable` is already a v1 kind (used for unmapped data types). Old consumers already treat it as "not a
|
||||
value node" (`ProjectedCatalogCache.IsValueNode`, `OtOpcUaNodeManager.cs:4988`), so no consumer materialises or waits on
|
||||
it.
|
||||
- Every value gate already keys on `LocalDataNode.Supported`. Read, Subscribe and GetMetadata answer `Unsupported`.
|
||||
History requires `Supported`. Writes are refused by `DataWriteDispatchGate`. Browse masks the operations to Browse.
|
||||
- Removing the node would turn a deployable `DataExport` rooted at that tag (`RootKind = RawTag` is valid) into a catalog
|
||||
compile failure ("Export has no valid origin root") for the whole cluster.
|
||||
- **Value operations.** Every value gate already keys on `LocalDataNode.Supported`: GetMetadata, Read and Subscribe
|
||||
answer `Unsupported`, history requires `Supported`, and `DataWriteDispatchGate` refuses writes.
|
||||
- **The node stays in the catalog.** Removing it would turn a deployable `DataExport` rooted at that tag
|
||||
(`RootKind = RawTag` is valid) into a catalog compile failure ("Export has no valid origin root") for the whole cluster.
|
||||
- **Browse hides it. The live gate forced this.** The first attempt listed the tag as the existing v1
|
||||
`UnsupportedVariable` kind, on the assumption that consumers skip that kind. They do not. `ProjectedNamespaceApplier`
|
||||
hands a whole page to `IProjectedNamespacePageSink.TryApply`, and `OtOpcUaNodeManager.TryEnsureProjectedVariable`
|
||||
rejects anything that is not a Folder, Variable or Tag (`OtOpcUaNodeManager.cs:4988`). So **one** `UnsupportedVariable`
|
||||
child failed the whole page.
|
||||
- On run `fu916-1`, browsing the consumer's `remote-opc` branch (the A4 Raw mapping of the opc-plc device, which holds
|
||||
the alarm tag `EastTankYellow`) answered `BadNoCommunication`.
|
||||
- The rig's `resolve` walk hit the same status, and `deploy` timed out on "deployed catalog and OPC UA namespace
|
||||
identity".
|
||||
- Every consumer build behaves this way, including the merged v1 consumers. Listing the node would therefore break any
|
||||
mixed-version consumer. Not listing it works for all of them, because a page simply has one item fewer.
|
||||
- **The same holds for any unsupported value node**, for example a data type v1 cannot carry. A pre-existing v1 origin
|
||||
already broke consumer browse of a folder holding one, and the browse filter fixes that too.
|
||||
|
||||
Condition placements are independent of the value node. They need only their parent folder or equipment, so condition
|
||||
forwarding is unchanged.
|
||||
forwarding is unchanged. The live gate below re-proves it on the alarm tag itself.
|
||||
|
||||
## The v1 gate: goldens not re-recorded
|
||||
|
||||
@@ -79,8 +90,8 @@ forwarding is unchanged.
|
||||
re-serialises it:
|
||||
|
||||
- it clears `stable_source_id` on every Metadata;
|
||||
- it makes HighTemp `UnsupportedVariable` / `VALUE_KIND_NULL` / `allowed_operations = 1` in Browse pages, and
|
||||
`status = Unsupported` with no value and no lease in GetMetadata.
|
||||
- it removes HighTemp from the device Browse page, and makes its GetMetadata item `status = Unsupported` with no value
|
||||
and no lease.
|
||||
|
||||
The test then compares the real origin's header-less bytes with the result. Only Browse, Browse/uns and GetMetadata are
|
||||
corrected. GetCapabilities, Read, Write, Write/no-write-grant and Subscribe are compared with the raw goldens, unchanged.
|
||||
@@ -89,7 +100,7 @@ corrected. GetCapabilities, Read, Write, Write/no-write-grant and Subscribe are
|
||||
- an unedited golden re-serialises byte-identically, so an edit is the only possible difference;
|
||||
- the corrected scenarios really differ from the goldens, and the others really do not;
|
||||
- the recorded UNS browse really contains the leaked `driver-1Plant/Modbus/dev1/`, and no corrected scenario does;
|
||||
- HighTemp is the single Unsupported item in GetMetadata.
|
||||
- HighTemp is the single Unsupported item in GetMetadata, and the only item dropped from the recorded device page.
|
||||
|
||||
The fake-origin gate `GrpcDataV1CompatibilityTests` is untouched and green.
|
||||
|
||||
@@ -101,7 +112,7 @@ value node of Browse, Browse/uns and GetMetadata, plus the HighTemp entries.
|
||||
| Test | Before the fix (master behaviour) | After |
|
||||
|---|---|---|
|
||||
| `GrpcDataConditionPlacementTests.No_exported_metadata_carries_the_internal_source_key_916` (60 generated topologies; encoded metadata of every node; UNS bytes searched for every driver id and RawPath; positive control: the internal key still contains them) | **Failed**: `node.Metadata.StableSourceId should be null` | Pass |
|
||||
| `GrpcDataConditionPlacementTests.An_alarm_bearing_raw_tag_is_an_UnsupportedVariable_and_keeps_its_condition_placements_917` (positive controls: a plain tag and the same tag without alarm config stay `Variable`; 3 placements and the Raw listing intact; an export rooted at the alarm tag compiles) | **Failed**: alarm tag `Supported` was true | Pass |
|
||||
| `GrpcDataConditionPlacementTests.An_alarm_bearing_raw_tag_is_an_UnsupportedVariable_and_keeps_its_condition_placements_917` (positive controls: a plain tag, and the same tag without its alarm config, stay supported `Variable`s; 3 placements and the Raw listing intact; an export rooted at the alarm tag compiles) | **Failed**: alarm tag `Supported` was true | Pass |
|
||||
| `GrpcDataV1RealOriginCompatibilityTests` header-less + feature-header Browse, Browse/uns, GetMetadata vs the raw goldens | Pass on master; fail with the fix | Compared with `Expected(...)`: pass |
|
||||
|
||||
## Gate runs (Release)
|
||||
|
||||
@@ -222,8 +222,8 @@ pre-H2 master `1086593a`.
|
||||
4. Never re-record.
|
||||
- **Pre-deploy corrections (#916, #917; 2026-11-28).** Two deliberate v1 fixes change real-origin Browse, Browse/uns and
|
||||
GetMetadata. `GrpcDataV1RealOriginCorrections.Expected` applies exactly those edits to the parsed, unre-recorded golden:
|
||||
it clears `stable_source_id` and makes the alarm-bearing HighTemp `UnsupportedVariable` / `Unsupported`. A test pins that
|
||||
the edits are the only difference. See `V1-916-917.md`.
|
||||
it clears `stable_source_id`, drops the alarm-bearing HighTemp from the device Browse page, and makes its GetMetadata
|
||||
item `Unsupported`. A test pins that the edits are the only difference. See `V1-916-917.md`.
|
||||
|
||||
## 3. Gate runs
|
||||
|
||||
|
||||
@@ -399,6 +399,11 @@ public sealed partial class LocalDataServices : IDataConnectionFactory
|
||||
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.
|
||||
if (child.Source is not null && !child.Supported) continue;
|
||||
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);
|
||||
|
||||
+3
-4
@@ -136,10 +136,9 @@ public sealed partial class LocalExportCatalog
|
||||
rawSources.Add(plan.NodeId, (source, enabled));
|
||||
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 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.
|
||||
// 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.
|
||||
var supported = plan.Alarm is null && kind != DataValueKind.Unspecified
|
||||
&& (!plan.IsArray || DataValue.IsSupportedArrayElementKind(kind));
|
||||
var rawView = View(DataRealm.Raw, plan.NodeId, scope);
|
||||
|
||||
+14
-11
@@ -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><len>:<driverInstanceId><RawPath></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());
|
||||
|
||||
Reference in New Issue
Block a user