From 3595f00dadd79a0c21e9c408cbaac1e7298b645e Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 10 Sep 2026 15:36:28 -0400 Subject: [PATCH] =?UTF-8?q?test(site-runtime):=20HandshakeResetEchoTests?= =?UTF-8?q?=20=E2=80=94=20label=20the=20legacy=20pin=20as=20permanent=20be?= =?UTF-8?q?haviour=20(#36=20review)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude-Session: https://claude.ai/code/session_01XPsuy2ZZ5Gbyfpt8PrK5BV --- .../Actors/HandshakeResetEchoTests.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Actors/HandshakeResetEchoTests.cs b/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Actors/HandshakeResetEchoTests.cs index 41110774..d566f725 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Actors/HandshakeResetEchoTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Actors/HandshakeResetEchoTests.cs @@ -84,7 +84,12 @@ public class HandshakeResetEchoTests : TestKit, IDisposable private static IReadOnlyDictionary Values(int batchId) => new Dictionary { ["MoveOutBatchID"] = AttributeValueCodec.Encode(batchId) }; - /// The defect, as documentation: the legacy overload answers from the stale cache. + /// + /// Pins the PERMANENT legacy behaviour, not a bug awaiting a fix: the six-argument overload is + /// deliberately unchanged (deployed scripts keep their semantics) and answers from the stale + /// cache — callers migrate to the reset-aware overload instead. Never "fix" the fast-path in + /// place; delete this test only if the legacy overload itself is removed. + /// [Fact] public async Task LegacyOverload_FastPathsOnThePreviousRunsCachedTrue() { @@ -127,11 +132,13 @@ public class HandshakeResetEchoTests : TestKit, IDisposable // Only now the batch + trigger. var batch = dcl.ExpectMsg(TimeSpan.FromSeconds(5)); Assert.Equal(TriggerTag, batch.TriggerTagPath); + // TriggerValue may arrive boxed as bool or as its already-encoded string; normalise both sides. Assert.Equal(AttributeValueCodec.Encode(true), AttributeValueCodec.Encode(batch.TriggerValue)); Assert.True(batch.Values.ContainsKey(BatchTag)); dcl.Reply(new WriteTagBatchResponse(batch.CorrelationId, true, null, DateTimeOffset.UtcNow)); - // Still pending: the cache now holds False. + // Still pending: the cache now holds False, and nothing can complete the call until the + // TagValueUpdate below is sent — no race here, only a documented intermediate state. Assert.False(call.IsCompleted); // The device completes THIS request.