diff --git a/docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md b/docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md index 286706c39..9ec76646b 100644 --- a/docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md +++ b/docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md @@ -492,8 +492,11 @@ conditions re-report (`NM:5639-5651`). Some state changes never produce an event - So the RefreshEnd of a multi-response replay could be processed before an earlier response. A1 therefore sets **`SequentialPublishing = true` on the alarm subscription** (`OpcUaClientDriver.cs:2445`). The data subscriptions are unchanged. - - If the SDK reports a sequence gap it could not republish during a refresh, that RefreshEnd does not signal. F5 then - applies, and the next refresh signals. + - **As implemented (A1):** there is no gap-based suppression. The SDK 2.0.1 surface the driver sees (the per-item + `Notification` callback) exposes no per-message gap or republish failure. With `SequentialPublishing` the worker + waits for a missing sequence number (republish) before it delivers later ones, so an ordinary gap still orders the + RefreshEnd last. **Residual:** a gap the SDK gives up on could let a RefreshEnd signal over a lost refreshed event. + The mitigation for notification-queue overflow and abandoned gaps is tracked in #926. - **OpcUaClient upstream without ConditionRefresh** (`:2887-2893`, "conditions already active are reported only on their next transition"). This is the one case with no signal at all. The driver reports `InitialStateUnsignalable` for that subscription, and the per-driver-type **backstop timer** (`DataConnections:ConditionKnownSettle:OpcUaClient`, default @@ -534,6 +537,24 @@ conditions re-report (`NM:5639-5651`). Some state changes never produce an event engine is warm, so its scripted conditions are already known. The stream is Primary-only by default. `snapshot_complete` is withheld until the origin's current address-space apply has completed (`CompleteAddressSpaceApply` ran for the active generation) and the serving node holds its Primary verdict. Until then the stream sends a Control `NotReady`. + - **Readiness is cut with the snapshot (A1 review S3).** Each slice records the apply generation and the complete flag + under its own hold. A2 sends `snapshot_complete` only when `ConditionStateHub.IsSnapshotCompleteFor(slices)` holds: every + hold saw a completed apply of one generation, and the node is Primary. Otherwise it retakes the snapshot. + - **A degraded or throwing rebuild withholds `snapshot_complete` until the next clean apply (A1 review S4).** The node + manager keeps the rebuild's pending removals, emits no removal record, and leaves readiness false until an apply succeeds. + - **A2 consumer of a sliced snapshot (A1 review S3a).** Register for deltas, take the snapshot, then replay deltas from + `ConditionSnapshotSlice.StartCursor` (the watermark read before the keys were enumerated). Skip a delta for a condition + held in a slice when its version is at or below that slice's `Watermark`, because the slice already contains it. Apply + every other delta, including those for conditions in no slice (materialised after the enumeration). +- **Residuals (A1 review round 2).** + - **Driver-internal outages with no actor edge are marked only by quality, not withdrawn (N4).** A Galaxy alarm-stream + reopen, a single FOCAS or Heidenhain device failing while its driver stays Connected, and the MTConnect + refused-connection fast path produce no `ConnectivityChanged`. Their conditions keep `state_known` and carry a Bad or + `BadNoCommunication` quality until the source's next signal. Only an actor connectivity edge (or a respawn) withdraws + known. + - **Scripted marks after a rebuild rest on load latency (N5).** This exposure predates A1. The post-rebuild re-assert + and the held mark both follow the engine's `LoadAsync`, and the publish actor's re-materialise is queued ahead of + them only because `DriverHostActor` Tells the rebuild before the scripted apply. - **Consumer rule:** a condition is retired only when it is absent from a complete snapshot, or a removal record arrives. A record with `state_known = false` never changes the consumer's last state. It sets condition `Quality = Uncertain` (waiting for initial data) until a known record arrives. diff --git a/docs/plans/evidence/grpc-data-ext/A1-core.md b/docs/plans/evidence/grpc-data-ext/A1-core.md index 12c40fd00..33ed3f532 100644 --- a/docs/plans/evidence/grpc-data-ext/A1-core.md +++ b/docs/plans/evidence/grpc-data-ext/A1-core.md @@ -220,8 +220,8 @@ Heidenhain legs are **blocked**: Galaxy needs the VPN and mxaccessgw, and Heiden - The SDK 2.0.1 surface the driver sees (the per-item `Notification` callback) exposes no per-message gap or republish failure, so this was not implemented. - With `SequentialPublishing` the worker waits for the missing sequence number (republish) before delivering later ones. - - Residual: a gap the SDK gives up on could let a `RefreshEnd` signal over a lost refreshed event. Logged here as an open - question for the reviewer. + - Residual: a gap the SDK gives up on could let a `RefreshEnd` signal over a lost refreshed event. **Resolved in review + round 2:** the plan's G2 text now states what is implemented, and the overflow and gap mitigation is tracked in #926. - **MTConnect also signals on a mid-stream `/current` re-baseline** (OUT_OF_RANGE / Agent restart), not only on the subscribe resync and the pump's first act. A re-baseline is a complete re-read, and without the signal a restarted Agent's conditions would wait for the next reconnect. @@ -291,3 +291,34 @@ Run one at a time after the last code commit (`795ad6cc`): | `Core.ScriptedAlarms.Tests` | 125 passed | | `Commons.Tests` | 505 passed | +## Review round 2 (2026-11-24, merged branch `worktree-agent-ad44f71fa7ab46039`) + +Each item below was mutation-checked: the fix was reverted or neutralised, the named test went red, and the fix was +restored. + +| Finding | Resolution | Red on revert (mutation) | +|---|---|---| +| **F1** an ack-revert re-marked a comms-withdrawn native condition known, and the Good edge did not withdraw again (`GoodSinceUtc` null) | `AlarmStateUpdate.EstablishesState` (false for `RevertNativeAlarmAck`) is passed to a new default sink overload, `WriteAlarmCondition(..., bool establishesState)`, which the deferred and SDK sinks forward. The NM sets known only when `establishesState && native`. Every Good edge now withdraws unconditionally (`4d21ccaf`) | Revert flag `true` ⇒ red: `An_ack_revert_during_an_outage_does_not_establish_and_the_Good_edge_withdraws_again` (the exact scenario: signal, Bad edge, operator ack while Reconnecting ⇒ failed-ack revert, then reconnect). Good-edge withdraw made conditional ⇒ same test. NM flag ignored ⇒ `ConditionStateNodeManagerTests.F1_A_non_establishing_native_projection_does_not_mark_known` | +| **F2** the Bad edge kept `Unsignalable`, so the next Good edge armed the backstop from a stale report | The Bad edge clears `t.Unsignalable` (`4d21ccaf`) | Removed ⇒ red: `An_unsignalable_report_does_not_survive_a_Bad_edge` (3 s settle, Bad edge before it elapses, reconnect, no mark for 4.5 s) | +| **F3** an MTConnect condition Unavailable at baseline never became known | A delta emission signals the touched conditions whose level is not Unavailable. It runs after the events, under the same lock, and needs the tracker baseline (`ea19c3ed`). `Sample_delta_does_not_signal…` became `Sample_delta_signals_its_touched_conditions_and_a_rebaseline_signals_all` | Delta signal removed ⇒ red: that test and `A_condition_Unavailable_at_baseline_is_signalled_when_a_delta_reports_it` | +| **F4** a Galaxy sentinel could signal refs whose snapshot entries arrived before the subscription | New `IGalaxyAlarmFeed.StreamOpened` (default no-op accessors), raised on the feed thread before each stream's first message. The driver records the live handle then and signals at the sentinel only if it is unchanged. The handle is added before `Start()`, with an undo if starting throws (`4c8539b8`) | Check neutralised ⇒ red: `A_sentinel_for_a_stream_opened_under_an_earlier_subscription_does_not_signal` (positive control: the next stream signals) | +| **N1** a deferred mark beyond capacity was dropped silently | `Deferred.Mark` never drops a withdrawal. A known mark beyond capacity is dropped (unknown is safe), and its source is remembered (`4a6c8942`) | Removed ⇒ red: `A_withdrawal_beyond_the_deferral_capacity_is_never_dropped` | +| **N2** a G3 discard was invisible to F5 | **Chose the message, not the Warning-only fallback.** The publish actor sends `ConditionMarksDiscarded(source, ids or null, realm)` to the discarded mark's sender, also for an overflowed known mark (ids null = all of the driver's refs). The scripted host is skipped. `DriverHostActor` puts the refs back in `Pending`, restarts the F5 window and logs a Warning (`4a6c8942`) | Publish-side tell removed ⇒ red: `A_discarded_driver_mark_is_reported_to_its_sender`. Host re-arm removed ⇒ red: `A_discarded_mark_rearms_F5_for_its_conditions` | +| **N3** FOCAS signalled type-selector conditions a truncated list showed inactive | On a list at the per-read cap, a condition that matched nothing is not signalled (any selector kind). One that matched something still is (`d377e377`) | Removed ⇒ red: `A_truncated_list_does_not_signal_a_condition_that_matched_nothing` | +| **N4** driver-internal outages with no actor edge | **Residual, documented** (plan §5.1 "Residuals"). A Galaxy stream reopen, a single FOCAS or Heidenhain device, and the MTConnect refused-connection fast path raise no `ConnectivityChanged`. Their conditions keep `state_known` with a Bad or `BadNoCommunication` quality until the next signal | — | +| **N5** scripted marks after a rebuild | **Residual, documented.** They rest on load latency: the re-assert and the held mark follow `LoadAsync`, and the re-materialise is queued ahead only because the rebuild is Told before the scripted apply. This exposure predates A1 | — | +| Docs: G2 | Plan §5.1 G2 now states the implemented behaviour (no gap-based suppression; `SequentialPublishing` orders an ordinary gap), with the residual and a pointer to #926 | — | +| Docs: A2 consumer contract | Plan §5.1: replay deltas from `StartCursor`; skip a delta at or below its condition's slice `Watermark`; `IsSnapshotCompleteFor(slices)`; a degraded rebuild withholds `snapshot_complete` until the next clean apply | — | + +**Test-rig change:** every connectivity edge now sends a withdrawal, so `NativeAlarmSignalTestBase.CollectAlarmTraffic` +skips withdrawals, as `AssertNoMark` already did. + +**L4 status (deviation from the A1 exit-gate text).** The Galaxy and Heidenhain L4 legs are blocked (#924). Galaxy needs +the VPN and mxaccessgw; Heidenhain has no fixture. **A1 merges with #924 open.** This is justified because A1 is invisible +until A2 puts condition state on the wire, and it is not fleet-deployable before A4. The other drivers' L4 evidence is +under "L4" above. + +### Review round 2 gates + +GATES2 +