fix(grpc-data): A4 review r1 — AdminUI helpers null-safe + doc comments restored; metric descriptions name both sides; docs: S1/S2/S3 behaviour, RefreshRequired only on a changed incomplete set, SourceName vs runtime status (S4), scripted Good = applied, A4-docs citations

This commit is contained in:
Joseph Doherty
2026-11-25 00:22:54 -05:00
parent c93290d0a0
commit 0cac09cee3
8 changed files with 60 additions and 19 deletions
@@ -62,7 +62,6 @@ public static class DataConnectionDiagnostics
{ } b => Bits((uint)(int)b, bit => Enum.IsDefined((DataOperations)(int)bit) ? DataOperationAuthoring.Label((DataOperations)(int)bit) : null),
};
/// <summary>#919: true when the drop deserves the "node build is older than the authored feature" hint.</summary>
/// <summary>A4 §6: a count against its limit is a warning at or above 80 % (the budget the plan sizes defaults by).</summary>
public static bool NearLimit(long observed, long limit) => limit > 0 && observed * 10 >= limit * 8;
@@ -84,10 +83,12 @@ public static class DataConnectionDiagnostics
/// <summary>A4: whether any part of the connection's condition evidence warrants the notice style.</summary>
public static bool ConditionsNeedAttention(ConsumerConditionDiagnostics? c) => c is not null
&& (NearLimit(c.ChargedConditions, c.HostConditionLimit)
|| c.Mappings.Any(m => NearLimit(m.Observed, m.Limit) || m.Status is "Unavailable" or "ConditionCapacity"));
|| (c.Mappings?.Any(m => m is not null && (NearLimit(m.Observed, m.Limit) || m.Status is "Unavailable" or "ConditionCapacity")) ?? false));
public static string MethodCounts(ConditionMethodCounts m) =>
$"succeeded {m.Succeeded} · rejected {m.Rejected} · failed {m.Failed} · unknown {m.Unknown}";
/// <summary>A4: method outcome classes; "unavailable" when a (partial) payload carries none (review r1 NIT: never throws).</summary>
public static string MethodCounts(ConditionMethodCounts? m) => m is null
? "unavailable"
: $"succeeded {m.Succeeded} · rejected {m.Rejected} · failed {m.Failed} · unknown {m.Unknown}";
/// <summary>A4: the origin's served-conditions line.</summary>
public static string OriginConditions(OriginConditionDiagnostics? o) => o is null
@@ -99,6 +100,7 @@ public static class DataConnectionDiagnostics
+ $" · state unknown (unsignalled) {(o.UnsignalledConditions is { } u ? u.ToString() : "unavailable")}"
+ $" · methods served {MethodCounts(o.Methods)}";
/// <summary>#919: true when the drop deserves the "node build is older than the authored feature" hint.</summary>
public static bool HasDrops(DataOperations? bits, int? mappings = null) => bits is { } b && b != DataOperations.None || mappings is > 0;
public static string Endpoint(string? value) => Uri.TryCreate(value, UriKind.Absolute, out var uri)
@@ -19,7 +19,7 @@ namespace ZB.MOM.WW.OtOpcUa.Runtime.DataConnections;
/// <item><c>otopcua.dataconn.conditions.items{side}</c> — open condition items: origin = root-scoped items served to peers;
/// consumer = the items its condition streams hold open (one per acked mapping).</item>
/// <item><c>otopcua.dataconn.conditions.resyncs{side}</c> — origin: an item re-snapshotted after a hub reader reset;
/// consumer: a condition stream that ended (it re-snapshots on the next).</item>
/// consumer: a condition stream that opened and ended (it re-snapshots on the next; a failed connect attempt is not counted).</item>
/// <item><see cref="RefreshRequiredCounterName"/><c>{side=consumer}</c> — RefreshRequired requests the consumer runtime
/// made (an incomplete barrier with a changed incomplete set, a capacity reset that removed nothing, each removal batch).</item>
/// <item><c>otopcua.dataconn.conditions.capacity_rejections{side}</c> — origin: an item snapshot over its limit; consumer: a