feat(hosts): driver diagnostics channel on /hosts, S7 negotiated PDU size first (#640)

Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
Joseph Doherty
2026-10-08 16:57:38 -04:00
parent a8b07ae12d
commit c2bdb7d5de
23 changed files with 469 additions and 20 deletions
@@ -248,6 +248,33 @@ public sealed class TelemetryStreamGrpcServiceTests
.DriverHealth.HasHostStatuses.ShouldBeFalse();
}
/// <summary>
/// Node side of the #640 diagnostics carry: presence flag + entries written; a capability-less driver
/// (null) leaves the flag clear, and an empty bag still sets it.
/// </summary>
[Fact]
public void ToProto_health_writes_the_diagnostics_presence_flag_and_entries()
{
var withDiag = new DriverHealthChanged(
"cluster-a", "drv-1", "Healthy", null, null, 0, DateTime.UtcNow,
Diagnostics: new Dictionary<string, string> { ["S7.NegotiatedPduSize"] = "480" });
var evt = TelemetryProtoMapNode.ToProto(new TelemetryItem.Health(withDiag), "c");
evt.DriverHealth.HasDiagnostics.ShouldBeTrue();
evt.DriverHealth.Diagnostics["S7.NegotiatedPduSize"].ShouldBe("480");
var empty = new DriverHealthChanged(
"cluster-a", "drv-1", "Healthy", null, null, 0, DateTime.UtcNow,
Diagnostics: new Dictionary<string, string>());
var emptyEvt = TelemetryProtoMapNode.ToProto(new TelemetryItem.Health(empty), "c");
emptyEvt.DriverHealth.HasDiagnostics.ShouldBeTrue();
emptyEvt.DriverHealth.Diagnostics.ShouldBeEmpty();
var none = new DriverHealthChanged("cluster-a", "drv-1", "Healthy", null, null, 0, DateTime.UtcNow);
var noneEvt = TelemetryProtoMapNode.ToProto(new TelemetryItem.Health(none), "c");
noneEvt.DriverHealth.HasDiagnostics.ShouldBeFalse();
noneEvt.DriverHealth.Diagnostics.ShouldBeEmpty();
}
[Fact]
public async Task Client_disconnect_mid_stream_ends_cleanly_without_leaking_a_slot()
{