diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryReadPort.cs b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryReadPort.cs
index 5037a76b6..784c5013c 100644
--- a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryReadPort.cs
+++ b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryReadPort.cs
@@ -113,8 +113,19 @@ internal sealed class HistoryReadNodeOutcome
/// The per-node result, or null when untouched.
public SdkHistoryReadResult? Result { get; set; }
- /// The effective operation status a non-SDK caller (H2) reports.
- public StatusCode Status => Error?.StatusCode ?? StatusCodes.BadHistoryOperationUnsupported;
+ ///
+ /// The effective per-node status a non-SDK caller (H2) reports: a non-Good operation status wins; otherwise the
+ /// result's own status, so GoodNoData passes through verbatim (plan §3.3). An untouched operation slot is the
+ /// SDK's pre-seeded BadHistoryOperationUnsupported.
+ ///
+ public StatusCode Status
+ {
+ get
+ {
+ var operation = Error?.StatusCode ?? StatusCodes.BadHistoryOperationUnsupported;
+ return StatusCode.IsGood(operation) ? Result?.StatusCode ?? StatusCodes.Good : operation;
+ }
+ }
/// The returned samples (HistoryData or HistoryModifiedData values), empty when none.
public IReadOnlyList Values =>
diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortPagingFuzzTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortPagingFuzzTests.cs
index b872e7839..f084e34fb 100644
--- a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortPagingFuzzTests.cs
+++ b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortPagingFuzzTests.cs
@@ -166,7 +166,9 @@ public sealed class HistoryReadPortPagingFuzzTests(HistoryReadPortServerFixture
{
var outcome = fx.Nm.ReadHistory(details, [new HistoryReadPortItem(realm, id, cp)],
fx.Nm.SessionHistoryContinuationScope(session: null), CancellationToken.None)[0];
- return (outcome.Status.Code, outcome.Values.Select(Render).ToList(), outcome.ContinuationPoint);
+ // The operation slot, as the override's errors[i] (Status folds GoodNoData in; pinned by the parity tests).
+ return (outcome.Error?.StatusCode.Code ?? StatusCodes.BadHistoryOperationUnsupported.Code,
+ outcome.Values.Select(Render).ToList(), outcome.ContinuationPoint);
}
private (uint Status, List Values, byte[]? Cp) OverrideRead(ReadRawModifiedDetails details, NodeId nodeId, byte[]? cp)
diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortParityTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortParityTests.cs
index 6c33f8a2e..2524b625c 100644
--- a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortParityTests.cs
+++ b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortParityTests.cs
@@ -404,6 +404,28 @@ public sealed class HistoryReadPortParityTests(HistoryReadPortServerFixture fx)
});
}
+ [Fact]
+ public async Task The_outcome_status_carries_GoodNoData_and_Bad_operation_statuses_verbatim()
+ {
+ await RunAsync(async () =>
+ {
+ fx.Nm.HistorianDataSource = new ParitySource();
+ HistoryReadNodeOutcome Read(HistoryReadVariant d, string key) =>
+ fx.Nm.ReadHistory(d, [new HistoryReadPortItem(fx.Nodes[key].Realm, fx.Nodes[key].Id)],
+ fx.Nm.SessionHistoryContinuationScope(session: null), CancellationToken.None)[0];
+
+ // §3.3: an empty window is GoodNoData (the result slot), not the Good operation status.
+ Read(new HistoryReadRawVariant(T(0), T(10), 5, ReturnBounds: false), "dbl").Status.Code.ShouldBe(StatusCodes.GoodNoData.Code);
+ Read(new HistoryReadAtTimeVariant([]), "dbl").Status.Code.ShouldBe(StatusCodes.GoodNoData.Code);
+ // A Bad operation status wins, with or without a result slot.
+ Read(new HistoryReadRawVariant(T(0), T(10), 5, ReturnBounds: true, IsReadModified: true), "dbl")
+ .Status.Code.ShouldBe(StatusCodes.BadInvalidArgument.Code);
+ Read(new HistoryReadRawVariant(T(0), T(10), 5, ReturnBounds: false), "plain")
+ .Status.Code.ShouldBe(StatusCodes.BadHistoryOperationUnsupported.Code);
+ await Task.CompletedTask;
+ });
+ }
+
[Fact]
public async Task A_node_with_no_historian_tagname_is_unsupported_on_both_paths()
{