fix(runtime): #995 a deploy no longer re-subscribes untouched drivers, and apply-time artifact work runs once off the pinned thread

R-11: DriverHostActor skips the deploy bulk push for a kept child whose seeding
fingerprint (value refs + raw/UNS fan-out + historization + alarm refs) is unchanged
and none of whose refs gained a mux consumer (VirtualTag / scripted alarm /
IDependencyConsumer driver). Skipped drivers are re-pushed when the address-space
outcome reports a rebuild (new additive RebuildCompleted.AddressSpaceRebuilt,
default true), degraded, timed out, or the apply threw. Boot/restore still push all.

R-14: ParsedDeploymentArtifact memoises the data projection + its validation per node
id (a throw re-thrown to every caller), and the row parsers skip it when the three data
arrays are empty. OpcUaPublishActor hashes the artifact once (RebuildAddressSpace.
ArtifactRevision) and reads the cluster redundancy mode from the plan step's parse
instead of a second parse on the pinned thread. InjectScriptSource skips JsonNode.Parse
for tag configs without a scriptId.
This commit is contained in:
Joseph Doherty
2026-12-03 11:09:42 -05:00
parent 2827a4c3bf
commit e6bfbdb6e5
9 changed files with 691 additions and 56 deletions
+18 -1
View File
@@ -188,7 +188,7 @@ routes it to `Unsubscribe`, dropping a stale handle.)
| Route | Trigger | What re-provisions it |
|---|---|---|
| **Deploy reconcile** | `ApplyDriverSpecs` → `SpawnChild` | `SpawnChild` sends `InitializeRequested` then the desired set; the apply's bulk push then sends the (freshly rebuilt) set to every child. |
| **Deploy reconcile** | `ApplyDriverSpecs` → `SpawnChild` | `SpawnChild` sends `InitializeRequested` then the desired set; the apply's bulk push then sends the (freshly rebuilt) set to every child **that needs it** (#995, below). |
| **Operator Restart** | `/hosts` → Restart → `HandleRestartDriver` | Stops the child, respawns from the cached spec — and `SpawnChild` sends the desired set, because it always does. **This is the 03/S16 fix**: there is no bulk push on this path, and before it the respawned child subscribed to nothing until the next deployment. |
| **Supervision restart** | a child throws ⇒ Akka's **default decider** ⇒ `Restart` | `DriverInstanceActor.PostRestart` Tells the host `ReprovisionRequested`; `HandleReprovisionRequested` logs a Warning naming the crash type, re-sends `InitializeRequested` (non-stub children) and the desired set. |
| **Force Reconnect** | `/hosts` → Force Reconnect → `HandleReconnectDriver` | **Nothing — verified.** It Tells `ForceReconnect` to the *same* child actor, so the instance and its `_desiredRefs`/`_desiredAlarmRefs` survive and the reconnect's Connected entry re-applies them itself. Pinned by `Force_reconnect_keeps_the_desired_set_and_re_subscribes` so a future edit to the restart paths cannot break the one that was already correct. |
@@ -247,6 +247,23 @@ Things to know before touching any of this:
re-subscribing** so a filtering driver does not accumulate two overlapping ones. There is still
deliberately no unsubscribe-on-**empty**: a removed alarm tag's condition node is torn down on the
address-space rebuild and `ForwardNativeAlarm` drops any transition whose `ConditionId` no longer maps.
- **A deploy no longer re-subscribes an untouched driver (#995, review 2026-12-02 R-11).** A re-subscribe tears down
the driver's whole data subscription (OpcUaClient monitored items, Galaxy advise through mxaccessgw, a forced
full re-read) and leaves a gap; on a kept driver whose set did not change its only job is **seeding** — the
initial values it produces give a node or consumer that is new since the last apply its first value. So the
deploy path (`HandleArtifactForApply` → `ApplyDesiredSubscriptions(skipUnchanged: true)`) skips a child only when
ALL hold: it is the child that already got a plain (non-acquisition) set from this host (`_plainPushedTo` — a
respawn is a new actor and is always pushed); its **seeding fingerprint** is unchanged (value refs, each ref's
fan-out NodeIds — raw + every referencing UNS mirror, so an added/re-pointed mirror re-pushes — its
historization, and the alarm refs); and none of its value refs **entered the mux-consumer set** (enabled
VirtualTag / scripted-alarm deps + every hosted `IDependencyConsumer` driver's refs — the mux replays a retained
value only for refs a replay-opting subscriber already named). A **full rebuild** recreates every node without a
value, and only the publish actor knows whether the apply was one, so skipped drivers are held per correlation and
re-pushed when `RebuildCompleted.AddressSpaceRebuilt` (additive, default `true`) or `Degraded` says so, when the
outcome times out, or when the apply throws. Boot/restore applies still push every child. Pinned by
`DriverHostActorUnchangedResubscribeTests` (absence + mirror / VirtualTag / rebuild / degraded positive controls).
⚠️ A NEW kind of value consumer (something that registers driver refs with the mux and needs a first value) must
join `ConsumerRefs`, or its first deploy leaves it waiting for the next value change.
- ⚠️ **A data re-subscribe must not touch the alarm feed (#662).** Every deploy's bulk push re-sends
`SetDesiredSubscriptions` to every kept driver, and `HandleSubscribeAsync` drops the prior DATA
subscription first. That teardown used to be the full `DetachSubscription`, which also unhooked