fix(opcua): trace every rebuild path; align history tests with the B7 contract
B6 moved the address-space-rebuild span into ApplyPlan, so the two rebuilds that complete synchronously on the actor thread (no applier -> raw-sink rebuild; no artifact bytes -> held) stopped emitting it (OtOpcUaTelemetryHookTests.RebuildAddressSpace_starts_an_address_space_rebuild_span). Both now open their own span. B7 (late HistorianDataSource / HistorianDataUpdater re-evaluate the capability bits) reversed three tests that pinned the old "fixed at materialisation" contract. Re-expressed against the new one, end to end: - events: a folder promoted without a source is unsupported, then served once a source is wired (source reached); - in-process HistoryUpdate: clearing the updater retracts HistoryWrite and the old updater is never reached; - over the wire: a late updater lights HistoryWrite and an insert reaches it; a reset retracts the bit and the insert is BadHistoryOperationUnsupported. Refs #732 Claude-Session: https://claude.ai/code/session_01Ub9hGmYLQvn9XETzw7CMsT
This commit is contained in:
+21
-8
@@ -215,11 +215,13 @@ public sealed class HistoryUpdateOverTheWireTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Control (no retro-update): materialising the node BEFORE the updater is installed leaves it without
|
||||
/// the HistoryWrite bit, so the SDK base answers BadHistoryOperationUnsupported — even for an editor.
|
||||
/// Review 01 U3 (B7): an updater installed AFTER the node materialised re-composes the HistoryWrite bit on
|
||||
/// the existing node (no rebuild), so an editor's insert reaches the updater over the wire; clearing the
|
||||
/// updater again retracts the bit and the SDK base answers BadHistoryOperationUnsupported. (Before B7 the
|
||||
/// bit was fixed at materialisation and a late install stayed unsupported.)
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task An_updater_installed_after_the_node_materialised_is_unsupported()
|
||||
public async Task An_updater_installed_after_the_node_materialised_grants_history_write_and_a_reset_takes_it_back()
|
||||
{
|
||||
var ct = TestContext.Current.CancellationToken;
|
||||
var store = new SharedStore();
|
||||
@@ -228,16 +230,27 @@ public sealed class HistoryUpdateOverTheWireTests
|
||||
{
|
||||
rig.Enforce(true, [Key()], ClusterGrant(KeyPrincipal, "acl-editor", Editor));
|
||||
var id = rig.EnsureRawVariable("Speed", "Double", writable: false, Tagname);
|
||||
rig.Nm.HistorianDataUpdater = store;
|
||||
|
||||
using var session = await rig.ConnectAsync(anonymous: false, ct);
|
||||
var node = RawNode(session, id);
|
||||
(await ReadByteAsync(session, node, Attributes.AccessLevel, ct) & AccessLevels.HistoryWrite)
|
||||
.ShouldBe(0, "the bit is fixed at materialisation");
|
||||
.ShouldBe(0, "no updater at materialisation (non-vacuity for the refresh)");
|
||||
|
||||
var result = await UpdateAsync(session, node, PerformUpdateType.Insert, ct, (T1, 1.0));
|
||||
result.StatusCode.Code.ShouldBe(StatusCodes.BadHistoryOperationUnsupported);
|
||||
store.UpdateCalls.ShouldBe(0);
|
||||
rig.Nm.HistorianDataUpdater = store;
|
||||
|
||||
(await ReadByteAsync(session, node, Attributes.AccessLevel, ct) & AccessLevels.HistoryWrite)
|
||||
.ShouldBe(AccessLevels.HistoryWrite, "a late updater lights the bit on the existing node");
|
||||
var ok = await UpdateAsync(session, node, PerformUpdateType.Insert, ct, (T1, 1.0));
|
||||
ok.OperationResults.Select(c => c.Code).ShouldBe([StatusCodes.GoodEntryInserted]);
|
||||
store.UpdateCalls.ShouldBe(1);
|
||||
|
||||
rig.Nm.HistorianDataUpdater = null;
|
||||
|
||||
(await ReadByteAsync(session, node, Attributes.AccessLevel, ct) & AccessLevels.HistoryWrite)
|
||||
.ShouldBe(0, "a reset updater takes the bit back");
|
||||
var refused = await UpdateAsync(session, node, PerformUpdateType.Insert, ct, (T2, 2.0));
|
||||
refused.StatusCode.Code.ShouldBe(StatusCodes.BadHistoryOperationUnsupported);
|
||||
store.UpdateCalls.ShouldBe(1, "the reset updater is never reached");
|
||||
}
|
||||
finally { await rig.DisposeAsync(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user