fix(dashboard): keep the '-' placeholder on failed /browse reads instead of '[redacted]'

This commit is contained in:
Joseph Doherty
2026-08-18 05:18:47 -04:00
parent bf7b44c2d7
commit 1ea6f60ea2
2 changed files with 64 additions and 4 deletions
@@ -53,9 +53,12 @@ public sealed class DashboardLiveDataService : IDashboardLiveDataService, IAsync
/// <summary>
/// <c>MxGateway:Dashboard:ShowTagValues</c>. False (the default)
/// substitutes <see cref="DashboardTagValue.RedactedValueText"/> for every
/// value this service hands the Browse panel; quality, data type, source
/// timestamp, and any error still describe the real read, so the panel
/// remains a diagnostic surface without being a value-disclosure one.
/// successfully read value this service hands the Browse panel; quality,
/// data type, source timestamp, and any error still describe the real
/// read, so the panel remains a diagnostic surface without being a
/// value-disclosure one. Failed reads keep their existing "-" placeholder:
/// there was no value to suppress, so claiming one was withheld would
/// misreport the failure.
/// </summary>
private readonly bool _showTagValues;
@@ -124,9 +127,17 @@ public sealed class DashboardLiveDataService : IDashboardLiveDataService, IAsync
// The only place the /browse live-value gate is evaluated: the page
// renders whatever ValueText it is handed, so a second check in the
// view could only ever disagree with this one.
//
// A failed read is left alone: it has no value to suppress, and its
// ValueText is already the "-" placeholder. Substituting "[redacted]"
// there would tell the operator a value was withheld when the read
// never produced one — the Error column says why it failed, and the
// two must not contradict each other.
DashboardTagValue[] values = results
.Select(DashboardTagValue.FromBulkReadResult)
.Select(value => _showTagValues ? value : value with { ValueText = DashboardTagValue.RedactedValueText })
.Select(value => _showTagValues || !value.Ok
? value
: value with { ValueText = DashboardTagValue.RedactedValueText })
.ToArray();
return new DashboardLiveReadResult(values, null, session.SessionId, session.WorkerProcessId);
}