fix(virtualtags): a disabled VirtualTag keeps its node and reads BadOutOfService (lmxopcua#787, owner decision)
v2-ci / unit-tests (push) Has been cancelled

Revises 963b0d66, which dropped a disabled VirtualTag from the runtime plan so a
bound client got BadNodeIdUnknown. Now the plan carries Enabled (part of value
equality): AddressSpaceComposer.Compose and DeploymentArtifact.BuildEquipmentVirtualTagPlans
keep the row with Enabled=false (byte-parity), the applier materialises the node as
normal, and VirtualTagHostActor spawns no VirtualTagActor for it but publishes
BadOutOfService (new OpcUaStatus constant) with a null value stamped at deploy, on
every apply. Enabled flips are node-irrelevant to the change classifier; enabled->disabled
stops the child, disabled->enabled resumes evaluation. Validator exemption and name
uniqueness unchanged. Scripted alarms keep their not-materialised convention.
Tests updated; new wire test DisabledVirtualTagWireTests. docs/VirtualTags.md updated.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-10 04:48:56 -05:00
parent 8582ce91bc
commit f201f16fd4
10 changed files with 238 additions and 30 deletions
@@ -163,10 +163,11 @@ public sealed class DeploymentArtifactVirtualTagHistorizeParityTests
d.ChangeTriggered.ShouldBeTrue();
}
/// <summary>lmxopcua#787 — a disabled VirtualTag is dropped by both the artifact decode and the composer
/// (byte-parity), so it is neither deployed nor evaluated; absent/non-bool Enabled keeps the default true.</summary>
/// <summary>lmxopcua#787 — a disabled VirtualTag stays in the plan (node materialised) in BOTH the artifact
/// decode and the composer (byte-parity), marked Enabled=false so it is never evaluated; an absent/non-bool
/// Enabled keeps the default true.</summary>
[Fact]
public void ParseComposition_drops_disabled_virtual_tag_in_parity_with_composer()
public void ParseComposition_keeps_disabled_virtual_tag_marked_disabled_in_parity_with_composer()
{
var area = new UnsArea { UnsAreaId = "area-1", ClusterId = "c1", Name = "filling" };
var line = new UnsLine { UnsLineId = "line-1", UnsAreaId = "area-1", Name = "line-1" };
@@ -188,8 +189,10 @@ public sealed class DeploymentArtifactVirtualTagHistorizeParityTests
});
var decoded = DeploymentArtifact.ParseComposition(blob);
composed.EquipmentVirtualTags.ShouldHaveSingleItem().VirtualTagId.ShouldBe("vt-on");
decoded.EquipmentVirtualTags.ShouldHaveSingleItem().VirtualTagId.ShouldBe("vt-on");
composed.EquipmentVirtualTags.Select(v => (v.VirtualTagId, v.Enabled))
.ShouldBe(new[] { ("vt-off", false), ("vt-on", true) }, ignoreOrder: false);
decoded.EquipmentVirtualTags.Select(v => (v.VirtualTagId, v.Enabled))
.ShouldBe(new[] { ("vt-off", false), ("vt-on", true) }, ignoreOrder: false);
decoded.EquipmentVirtualTags.SequenceEqual(composed.EquipmentVirtualTags).ShouldBeTrue();
}
@@ -85,9 +85,10 @@ public sealed class DriverHostActorVirtualTagTests : RuntimeActorTestBase
}
/// <summary>lmxopcua#787: a deployment carrying a disabled VirtualTag next to an enabled one hands the
/// VirtualTag host ONLY the enabled plan — the disabled tag is never spawned, so never evaluated.</summary>
/// VirtualTag host BOTH plans, the disabled one flagged Enabled=false — the host keeps its node, spawns no
/// evaluator for it and publishes BadOutOfService (see VirtualTagHostActorTests).</summary>
[Fact]
public void Apply_does_not_forward_disabled_VirtualTag_to_virtual_tag_host()
public void Apply_forwards_disabled_VirtualTag_flagged_disabled_to_virtual_tag_host()
{
var db = NewInMemoryDbFactory();
var deploymentId = SeedDeploymentWithVirtualTag(db, RevA, withDisabledSibling: true);
@@ -104,7 +105,9 @@ public sealed class DriverHostActorVirtualTagTests : RuntimeActorTestBase
coordinator.ExpectMsg<ApplyAck>(TimeSpan.FromSeconds(5)).Outcome.ShouldBe(ApplyAckOutcome.Applied);
var apply = vtHost.ExpectMsg<VirtualTagHostActor.ApplyVirtualTags>(TimeSpan.FromSeconds(5));
apply.Plans.ShouldHaveSingleItem().VirtualTagId.ShouldBe("vt-1");
apply.Plans.Select(p => (p.VirtualTagId, p.Enabled))
.OrderBy(x => x.VirtualTagId, StringComparer.Ordinal)
.ShouldBe(new[] { ("vt-1", true), ("vt-off", false) });
}
private static DeploymentId SeedDeploymentWithVirtualTag(