fix(grpc-data): A1 review S3 + S4 + nits — snapshot start cursor, readiness cut with the snapshot, failed applies

- S3a: SnapshotConditions reads a start cursor under Lock before enumerating keys; every slice carries it, so a
  condition materialised and activated between the enumeration and slice 1's hold is covered by deltas after it.
- S3b: each hold captures the apply generation (bumped when a rebuild begins) and the complete flag; slices carry
  them and ConditionSnapshotSlice.IsCompleteSnapshot / ConditionStateHub.IsSnapshotCompleteFor detect a rebuild
  that straddles a multi-slice snapshot. An empty scope still takes one hold.
- S3c: maxConditionsPerHold is clamped to MaxConditionsPerHoldLimit (5,000).
- S4: CompleteAddressSpaceApply(bool succeeded) (new default sink member, forwarded by the deferred and SDK sinks);
  the publish actor passes !Degraded. A failed/degraded rebuild keeps readiness false and its pending removals,
  emitting no removal records; the next successful apply completes it.
- Nits: ConditionStateRecord.UnshelveTimeUtc (timed-shelve expiry); ConditionStateHub.Read has a bounded default.
This commit is contained in:
Joseph Doherty
2026-11-24 10:43:04 -05:00
parent 6c94a2ec0e
commit 16166c21e5
10 changed files with 274 additions and 14 deletions
@@ -88,6 +88,9 @@ public sealed class DeferredAddressSpaceSink : IOpcUaAddressSpaceSink, ISurgical
/// <inheritdoc />
public void CompleteAddressSpaceApply() => _inner.CompleteAddressSpaceApply();
/// <inheritdoc />
public void CompleteAddressSpaceApply(bool succeeded) => _inner.CompleteAddressSpaceApply(succeeded);
/// <inheritdoc />
public void MarkConditionsKnown(string source, IReadOnlyList<string> conditionIds, AddressSpaceRealm realm)
=> _inner.MarkConditionsKnown(source, conditionIds, realm);
@@ -213,6 +213,15 @@ public interface IOpcUaAddressSpaceSink
{
}
/// <summary>
/// <see cref="CompleteAddressSpaceApply()"/> with the apply's outcome (A1 review S4): <paramref name="succeeded"/>
/// is false for a throwing or degraded apply, and an SDK-backed sink then keeps a rebuild's condition-set
/// readiness withheld and emits no removal records for conditions the failed pass did not re-materialise. The
/// default forwards to the parameterless overload.
/// </summary>
/// <param name="succeeded">Whether the apply completed cleanly.</param>
void CompleteAddressSpaceApply(bool succeeded) => CompleteAddressSpaceApply();
/// <summary>
/// A1 (plan §5.1 T1/T2): the state of <paramref name="conditionIds"/> has been ESTABLISHED by
/// <paramref name="source"/> (a driver's <c>InitialAlarmStateDelivered</c>, its backstop timer, or a scripted