fix(cli): alarms prints ConditionNodeId + EventId so ack/confirm are usable

The ack command requires both and nothing in the CLI surfaced them (found in the hw2 FOCAS live gate).

Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
Joseph Doherty
2026-10-08 21:25:56 -04:00
parent e7dd742541
commit c6ab783cb4
2 changed files with 29 additions and 0 deletions
@@ -82,6 +82,30 @@ public class AlarmsCommandTests
output.ShouldContain("Condition refresh requested.");
}
/// <summary>The printed alarm carries the ConditionNodeId and EventId that `ack` requires (hex round-trips).</summary>
[Fact]
public async Task Execute_PrintsConditionNodeIdAndEventId_ForAck()
{
var fakeService = new FakeOpcUaClientService();
var factory = new FakeOpcUaClientServiceFactory(fakeService);
var command = new AlarmsCommand(factory) { Url = "opc.tcp://localhost:4840" };
using var console = TestConsoleHelper.CreateConsole();
var task = Task.Run(async () => { await command.ExecuteAsync(console); });
await fakeService.SubscribeAlarmsInvoked.WaitAsync(TimeSpan.FromSeconds(10));
fakeService.RaiseAlarmEvent(new Client.Shared.Models.AlarmEventArgs(
"src", "cond", 500, "msg", true, true, false, DateTime.UtcNow,
eventId: [0xAB, 0x01, 0xFF], conditionNodeId: "ns=2;s=Plant/cond"));
await Task.Delay(500);
console.RequestCancellation();
await task;
var output = TestConsoleHelper.GetOutput(console);
output.ShouldContain("ConditionNodeId: ns=2;s=Plant/cond");
output.ShouldContain("EventId: AB01FF");
}
/// <summary>Verifies that refresh failure prints error.</summary>
[Fact]
public async Task Execute_RefreshFailure_PrintsError()