fix(historian): #691.4 review — Null reports SupportsReverseEvents = true, like raw

The null source has no history in either direction; reporting false
made the server walk an empty reverse events read back through three
empty forward reads. It now answers the reverse overload with the empty
result itself (guard test unchanged: it still declares both members).
This commit is contained in:
Joseph Doherty
2026-10-12 17:37:32 -04:00
parent d28e3e64f1
commit 574c3aa1b0
5 changed files with 16 additions and 17 deletions
@@ -68,17 +68,19 @@ public sealed class NullHistorianDataSourceTests
}
/// <summary>
/// #675: the direction-aware overload's default — forward is the five-argument read, reverse is refused
/// (the server answers <c>BadHistoryOperationUnsupported</c>).
/// #691.4 review: like raw, the null source reads events in either direction (empty) and says so — the server sends
/// it the reverse read directly instead of walking back through empty forward reads (it refused reverse under #675).
/// </summary>
[Fact]
public async Task Direction_aware_ReadEventsAsync_forwards_forward_and_refuses_reverse()
public async Task Direction_aware_ReadEventsAsync_is_empty_in_both_directions()
{
IHistorianDataSource source = Source;
source.SupportsReverseEvents.ShouldBeTrue();
(await source.ReadEventsAsync(null, DateTime.UtcNow.AddHours(-1), DateTime.UtcNow, 0, reverse: false, Ct))
.Events.ShouldBeEmpty();
await Should.ThrowAsync<NotSupportedException>(() =>
source.ReadEventsAsync(null, DateTime.UtcNow, DateTime.UtcNow.AddHours(-1), 0, reverse: true, Ct));
var reverse = await source.ReadEventsAsync(null, DateTime.UtcNow, DateTime.UtcNow.AddHours(-1), 0, reverse: true, Ct);
reverse.Events.ShouldBeEmpty();
reverse.ContinuationPoint.ShouldBeNull();
}
/// <summary>GetHealthSnapshot reports a fully-disabled (zeroed, disconnected, no-node) shape.</summary>