fix(virtualtags): route VirtualTag outputs through the dependency mux so VT->VT reads work (lmxopcua#791)
v2-ci / unit-tests (push) Waiting to run
v2-ci / unit-tests (push) Waiting to run
Proven broken first: VirtualTagToVirtualTagFlowTests (real mux + host + Roslyn
evaluator) failed on master - VT A evaluated, VT B reading A by its key never did.
VT outputs only reached their OPC UA node; the mux carried driver values only.
- VirtualTagHostActor also sends each real result (not re-asserts) and a disabled
tag's BadOutOfService to the mux as VirtualTagOutput, keyed by the VT's UNS
NodeId identifier {EquipmentId}/{Name}. Publish path unchanged (single source).
- DependencyMuxActor pins VT outputs (retained with no subscriber, no grace,
immune to SourceRemoved) and replays them; VirtualTagOutputsRemoved releases
keys that leave the deployed set.
- DraftValidator: blocking VirtualTagDependencyCycle (A->B->A, self-read, loops
through Calculation tags, {{equip}} refs resolved); disabled VTs are not nodes.
EquipReferenceUnresolved names the key form when {{equip}}/<name> is a VT.
- Runtime backstop: the host re-detects VT cycles per apply and does not route
outputs of tags on one.
- AdminUI ScriptTagCatalog lists VTs by key (the bare leaf name never resolved).
- docs/VirtualTags.md documents the routing, key, retention and cycle rules.
Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
@@ -41,8 +41,9 @@ public sealed record ScriptTagInfo(string Path, string Kind, string DataType, st
|
||||
|
||||
/// <summary>
|
||||
/// Default <see cref="IScriptTagCatalog"/>. Returns ONLY the resolvable keys a script may pass to
|
||||
/// <c>ctx.GetTag</c> / <c>ctx.SetVirtualTag</c> — in v3 that is a raw tag's <b>RawPath</b>, plus the
|
||||
/// leaf <c>Name</c> (best-effort) for virtual tags.
|
||||
/// <c>ctx.GetTag</c> / <c>ctx.SetVirtualTag</c> — in v3 that is a raw tag's <b>RawPath</b>, plus each virtual
|
||||
/// tag's key <c>{EquipmentId}/{Name}</c> (its UNS NodeId identifier, which the dependency mux routes its output
|
||||
/// under — lmxopcua#791).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
@@ -195,7 +196,7 @@ public sealed class ScriptTagCatalog(
|
||||
|
||||
var vtagRows = await db.VirtualTags
|
||||
.AsNoTracking()
|
||||
.Select(v => new { v.Name, v.DataType })
|
||||
.Select(v => new { v.EquipmentId, v.Name, v.DataType })
|
||||
.ToListAsync(ct);
|
||||
|
||||
var entries = new List<ScriptTagInfo>(tagRows.Count + vtagRows.Count);
|
||||
@@ -213,9 +214,10 @@ public sealed class ScriptTagCatalog(
|
||||
|
||||
foreach (var v in vtagRows)
|
||||
{
|
||||
// Virtual tag — best-effort: the live resolution of virtual-tag cascade/write targets is
|
||||
// unconfirmed, so emit the leaf Name only.
|
||||
entries.Add(new ScriptTagInfo(v.Name, "Virtual tag", v.DataType, null));
|
||||
// Virtual tag — its key is the UNS NodeId identifier VirtualTagHostActor publishes to AND routes its
|
||||
// output under in the dependency mux (lmxopcua#791), so ctx.GetTag("{EquipmentId}/{Name}") reads it.
|
||||
// (The leaf Name this used to emit never resolved: nothing was published under it.)
|
||||
entries.Add(new ScriptTagInfo(v.EquipmentId + RawPaths.Separator + v.Name, "Virtual tag", v.DataType, null));
|
||||
}
|
||||
|
||||
return entries;
|
||||
|
||||
Reference in New Issue
Block a user