fix(grpc-data): H4 review 5+6 — AdminUI display: 'unavailable' without handshake evidence; every bit rendered

HistoryServed reads 'unavailable' when neither features nor variants were reported. Features()
and DroppedBits() render every set bit across all 32 (bit 31 included), named when known and hex
otherwise, so an unknown bit is never hidden beside a known one (#919).
This commit is contained in:
Joseph Doherty
2026-11-24 08:39:46 -05:00
parent 79cf50d50e
commit 2fba036176
2 changed files with 18 additions and 7 deletions
@@ -20,13 +20,17 @@ public sealed class GrpcDataHistoryDiagnosticsDisplayTests
DataConnectionDiagnostics.Features(DataFeatures.None).ShouldBe("none (v1 behaviour)");
DataConnectionDiagnostics.Features(DataFeatures.History).ShouldBe("History");
DataConnectionDiagnostics.Features(DataFeatures.History | DataFeatures.Conditions).ShouldBe("History, Conditions");
// H4 review 6: an unknown bit is never hidden by a known one.
DataConnectionDiagnostics.Features(DataFeatures.History | (DataFeatures)8).ShouldBe("History, 0x8");
DataConnectionDiagnostics.Features((DataFeatures)int.MinValue).ShouldBe("0x80000000");
}
[Fact]
public void Origin_history_shows_the_advertised_variants_and_aggregate_count()
{
DataConnectionDiagnostics.HistoryServed(Row()).ShouldBe("not advertised");
DataConnectionDiagnostics.HistoryServed(Row() with { HistoryVariants = [] }).ShouldBe("advertised, no variant granted");
DataConnectionDiagnostics.HistoryServed(Row()).ShouldBe("unavailable", "no handshake evidence at all (H4 review 5)");
DataConnectionDiagnostics.HistoryServed(Row() with { NegotiatedFeatures = DataFeatures.None }).ShouldBe("not advertised");
DataConnectionDiagnostics.HistoryServed(Row() with { NegotiatedFeatures = DataFeatures.History, HistoryVariants = [] }).ShouldBe("advertised, no variant granted");
DataConnectionDiagnostics.HistoryServed(Row() with { HistoryVariants = ["raw", "processed", "attime"], HistoryAggregateCount = 12 })
.ShouldBe("raw, processed, attime (12 aggregates)");
}
@@ -45,6 +49,8 @@ public sealed class GrpcDataHistoryDiagnosticsDisplayTests
DataConnectionDiagnostics.DroppedBits(DataOperations.None).ShouldBe("none");
DataConnectionDiagnostics.DroppedBits(DataOperations.HistoryRead | DataOperations.AlarmSubscribe).ShouldBe("HistoryRead, AlarmSubscribe");
DataConnectionDiagnostics.DroppedBits((DataOperations)(1 << 20)).ShouldBe("0x100000");
// H4 review 6: the full width, bit 31 included, beside a known bit.
DataConnectionDiagnostics.DroppedBits(DataOperations.HistoryRead | (DataOperations)int.MinValue).ShouldBe("HistoryRead, 0x80000000");
}
[Fact]