fix(hosts): driver health is per (driver, node) — ReportingNodeId on DriverHealthChanged + telemetry proto (#847)

This commit is contained in:
Joseph Doherty
2026-11-11 03:41:59 -05:00
parent 3b1b32f0c1
commit 038aa007ac
11 changed files with 150 additions and 21 deletions
@@ -356,4 +356,35 @@ public sealed class HostsDriverViewTests
row.HasSkippedTags.ShouldBeFalse();
row.SkippedTagsTitle().ShouldBeEmpty();
}
[Fact]
public void A_driver_reported_by_two_nodes_yields_one_row_per_node_847()
{
// lmxopcua#847: both nodes of a redundant pair run the same driver; keyed by driver id alone the row
// flipped between central-1's Faulted and central-2's Healthy on every publish.
var snaps = new[]
{
new DriverHealthChanged("c", "drv", "Healthy", null, null, 0, When, ReportingNodeId: "central-2"),
new DriverHealthChanged("c", "drv", "Faulted", null, "boom", 1, When, ReportingNodeId: "central-1"),
};
var rows = HostsDriverView.Build(snaps, null, [Instance("drv", "c", "Line 1", "Modbus")])
.ShouldHaveSingleItem().Drivers;
rows.Count.ShouldBe(2);
rows.Select(r => r.NodeId).ShouldBe(["central-1", "central-2"]);
rows.Select(r => r.State).ShouldBe(["Faulted", "Healthy"]);
rows.Select(r => r.RowKey).Distinct().Count().ShouldBe(2);
rows.ShouldAllBe(r => r.Name == "Line 1");
}
[Fact]
public void Hosts_page_renders_a_node_column_and_keys_rows_by_driver_and_node_847()
{
var src = AdminUiSource.Read("Components", "Pages", "Hosts.razor");
src.ShouldContain("@key=\"@($\"row-{d.RowKey}\")\"");
src.ShouldNotContain("@key=\"@($\"row-{d.DriverInstanceId}\")\"");
src.ShouldContain(">Node</th>");
src.ShouldContain("@d.NodeId");
}
}