fix(code-review): resolve OpcUaServer-001 — UNS Area/Line rename refreshes folder DisplayName

A rename-only deploy produced an IsEmpty plan that short-circuited before MaterialiseHierarchy,
leaving the OPC UA folder DisplayName stale. AddressSpacePlanner now diffs UnsAreas/UnsLines by
stable id into a RenamedFolders set (counted in IsEmpty); the applier refreshes the folder in
place via a new UpdateFolderDisplayName on ISurgicalAddressSpaceSink (forwarded through
DeferredAddressSpaceSink so it is NOT inert on driver hosts; falls back to rebuild when the sink
is non-surgical). DeploymentArtifact byte-parity untouched (rename rides the existing Name
round-trip). No EF migration, no serialized wire/proto contract change. +13 OpcUaServer tests, Runtime rebuild test.
This commit is contained in:
Joseph Doherty
2026-06-20 23:10:24 -04:00
parent 94eec70fb0
commit 23b42b424d
13 changed files with 700 additions and 11 deletions
@@ -90,6 +90,30 @@ public class DeferredAddressSpaceSinkTests
surgical.UpdateCalled.ShouldBeTrue();
}
[Fact]
public void UpdateFolderDisplayName_returns_false_for_non_surgical_inner()
{
// SpySink does NOT implement ISurgicalAddressSpaceSink.
var sink = new DeferredAddressSpaceSink();
sink.SetSink(new SpySink());
sink.UpdateFolderDisplayName("area-1", "Plant South").ShouldBeFalse();
}
[Fact]
public void UpdateFolderDisplayName_returns_true_for_surgical_inner()
{
// OpcUaServer-001: the deferred wrapper must forward the folder-rename capability to a surgical inner.
var surgical = new SpySurgicalSink();
var sink = new DeferredAddressSpaceSink();
sink.SetSink(surgical);
var result = sink.UpdateFolderDisplayName("area-1", "Plant South");
result.ShouldBeTrue();
surgical.FolderRenameCalled.ShouldBeTrue();
}
// ---------- SetSink(null) reverts to null sink ----------
[Fact]
@@ -137,6 +161,7 @@ public class DeferredAddressSpaceSinkTests
private sealed class SpySurgicalSink : IOpcUaAddressSpaceSink, ISurgicalAddressSpaceSink
{
public bool UpdateCalled { get; private set; }
public bool FolderRenameCalled { get; private set; }
public void WriteValue(string nodeId, object? value, OpcUaQuality quality, DateTime sourceTimestampUtc) { }
public void WriteAlarmCondition(string alarmNodeId, AlarmConditionSnapshot state, DateTime sourceTimestampUtc) { }
@@ -150,5 +175,11 @@ public class DeferredAddressSpaceSinkTests
UpdateCalled = true;
return true;
}
public bool UpdateFolderDisplayName(string folderNodeId, string displayName)
{
FolderRenameCalled = true;
return true;
}
}
}