M3 R3.2 SHIPPED: AddHistoricalValuesAsync — historical backfill writes over gRPC (live-validated)

Public HistorianClient.AddHistoricalValuesAsync(tag, values) inserts non-streamed original
(backfill) values for an existing tag over the 2023 R2 gRPC front door. The pure-managed SDK
wrote a value and read it back live (gated test AddHistoricalValuesAsync_OverGrpc_WritesAndReadsBack
PASSED against the real server).

- HistorianGrpcHistoricalWriteOrchestrator: write-enabled (0x401) session ->
  RetrievalService.GetTagInfosFromName (resolves the per-tag GUID = the tag-info TypeId, and
  registers the tag on the session) -> HistoryService.AddStreamValues("ON" buffer) per sample.
- HistorianHistoricalValue (public record: TimestampUtc, Value, OpcQuality=192).
- gRPC-only: non-RemoteGrpc transports throw ProtocolEvidenceMissingException (the 2020 WCF
  non-streamed write is architecturally blocked, D2).
- Float value encoding only (the captured type); other types rejected by the serializer.

275 unit tests pass; the new gated live write/read-back test is green against the 2023 R2 server.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B6mcaT2PjRFKcogzp9UkfC
This commit is contained in:
Joseph Doherty
2026-06-21 21:23:08 -04:00
parent 85f0c2f0fa
commit aa36e58d58
4 changed files with 183 additions and 0 deletions
@@ -128,6 +128,34 @@ public sealed class HistorianClient : IAsyncDisposable
return new HistorianWcfEventOrchestrator(_options).SendEventAsync(historianEvent, cancellationToken);
}
/// <summary>
/// Inserts historical (non-streamed original / backfill) values for an existing tag. Captured
/// live from the native 2023 R2 client: the write rides <c>HistoryService.AddStreamValues</c>
/// (an "ON" storage-sample buffer) over the gRPC front door — see
/// <c>docs/plans/revision-write-path.md</c> §"R3.1 CAPTURED". Only the
/// <see cref="HistorianTransport.RemoteGrpc"/> transport is supported (the 2020 WCF path is
/// architecturally blocked — D2); other transports throw
/// <see cref="ProtocolEvidenceMissingException"/>. The tag must already exist
/// (create it with <see cref="EnsureTagAsync"/>). Value encoding is captured for Float tags.
/// </summary>
public Task<bool> AddHistoricalValuesAsync(
string tag,
IReadOnlyList<HistorianHistoricalValue> values,
CancellationToken cancellationToken = default)
{
ArgumentException.ThrowIfNullOrWhiteSpace(tag);
ArgumentNullException.ThrowIfNull(values);
if (_options.Transport != HistorianTransport.RemoteGrpc)
{
throw new ProtocolEvidenceMissingException(
"AddHistoricalValuesAsync is only supported over the 2023 R2 RemoteGrpc transport; the 2020 WCF " +
"non-streamed write is architecturally blocked (see docs/plans/revision-write-path.md, D2).");
}
return new Grpc.HistorianGrpcHistoricalWriteOrchestrator(_options).AddHistoricalValuesAsync(tag, values, cancellationToken);
}
public IAsyncEnumerable<string> BrowseTagNamesAsync(string filter = "*", CancellationToken cancellationToken = default)
{
ArgumentException.ThrowIfNullOrWhiteSpace(filter);