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:
Joseph Doherty
2026-11-28 10:43:32 -05:00
parent 4a481cca1c
commit 053c69f1c8
10 changed files with 173 additions and 17 deletions
@@ -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);
@@ -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);