fix(grpc-data): A3a review r1 — buffered in-stream re-snapshots, late completion + stale-on-incomplete + bounded retry, Primary-pinned condition streams, node-wide host-cap ledger, runner hand-over after stop, metadata failure Unavailable; NM: revalidation through the imported gate, demand released first, rebuild unwires, instance-keyed promotion, incremental folder index, verdict TTL + expiry, removal RefreshRequired, chunked refresh/replay, folder-only demand

Runtime tests: B1 multi-frame + capacity re-snapshot, B2 late completion / stale-on-incomplete / refused retry, B4 cross-connection / reverse order / records>total / delta growth, S3/S4 hand-over, S6, deviation 9, S2 IsActive generation; absence assertions now follow must-arrive controls.
This commit is contained in:
Joseph Doherty
2026-11-24 18:38:07 -05:00
parent 3c941458f5
commit 69aeeb770b
11 changed files with 1242 additions and 529 deletions
@@ -524,7 +524,7 @@ public sealed class DataConnectionDeploymentRuntime : IAsyncDisposable
}
/// <summary>A non-owning handle with the deployed operation and resource policy.</summary>
public sealed class DataConnectionDeploymentLease : IDataConnection, IDataHistoryService, IHistoryBatchLimit, IDataConditionMethodService, IDisposable
public sealed class DataConnectionDeploymentLease : IDataConnection, IDataHistoryService, IHistoryBatchLimit, IDataConditionMethodService, IDataPrimarySubscriptionSource, IDisposable
{
/// <summary>
/// A3b: a remote condition method through the deployed connection — needs the row's AlarmAcknowledge / AlarmConfirm
@@ -679,9 +679,17 @@ public sealed class DataConnectionDeploymentLease : IDataConnection, IDataHistor
catch (Exception ex) when (ex is OperationCanceledException or InvalidOperationException or UnauthorizedAccessException)
{ return request.Items.Select(x => new WriteItemResult(x.CorrelationId, new(DataWriteState.OutcomeUnknown, 0x800A0000u, "Write outcome unknown after scope change."))).ToArray(); }
}
public async Task<IDataSubscription> SubscribeAsync(CancellationToken cancellationToken)
public Task<IDataSubscription> SubscribeAsync(CancellationToken cancellationToken) => SubscribeCoreAsync(primaryOnly: false, cancellationToken);
/// <inheritdoc />
public Task<IDataSubscription> SubscribePrimaryAsync(CancellationToken cancellationToken) => SubscribeCoreAsync(primaryOnly: true, cancellationToken);
private async Task<IDataSubscription> SubscribeCoreAsync(bool primaryOnly, CancellationToken cancellationToken)
{
Check(DataOperations.Subscribe); var stream = await _inner.SubscribeAsync(cancellationToken).ConfigureAwait(false);
Check(DataOperations.Subscribe);
var stream = primaryOnly && _inner is IDataPrimarySubscriptionSource primary
? await primary.SubscribePrimaryAsync(cancellationToken).ConfigureAwait(false)
: await _inner.SubscribeAsync(cancellationToken).ConfigureAwait(false);
try { Check(DataOperations.Subscribe); return stream is IDataSubscriptionProvenance provenance
? new ProvenancedScopedSubscription(this, stream, provenance.Serving)
: new ScopedSubscription(this, stream); }