test(site-runtime): HandshakeResetEchoTests — label the legacy pin as permanent behaviour (#36 review)
Claude-Session: https://claude.ai/code/session_01XPsuy2ZZ5Gbyfpt8PrK5BV
This commit is contained in:
@@ -84,7 +84,12 @@ public class HandshakeResetEchoTests : TestKit, IDisposable
|
|||||||
private static IReadOnlyDictionary<string, string?> Values(int batchId)
|
private static IReadOnlyDictionary<string, string?> Values(int batchId)
|
||||||
=> new Dictionary<string, string?> { ["MoveOutBatchID"] = AttributeValueCodec.Encode(batchId) };
|
=> new Dictionary<string, string?> { ["MoveOutBatchID"] = AttributeValueCodec.Encode(batchId) };
|
||||||
|
|
||||||
/// <summary>The defect, as documentation: the legacy overload answers from the stale cache.</summary>
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task LegacyOverload_FastPathsOnThePreviousRunsCachedTrue()
|
public async Task LegacyOverload_FastPathsOnThePreviousRunsCachedTrue()
|
||||||
{
|
{
|
||||||
@@ -127,11 +132,13 @@ public class HandshakeResetEchoTests : TestKit, IDisposable
|
|||||||
// Only now the batch + trigger.
|
// Only now the batch + trigger.
|
||||||
var batch = dcl.ExpectMsg<WriteTagBatchRequest>(TimeSpan.FromSeconds(5));
|
var batch = dcl.ExpectMsg<WriteTagBatchRequest>(TimeSpan.FromSeconds(5));
|
||||||
Assert.Equal(TriggerTag, batch.TriggerTagPath);
|
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.Equal(AttributeValueCodec.Encode(true), AttributeValueCodec.Encode(batch.TriggerValue));
|
||||||
Assert.True(batch.Values.ContainsKey(BatchTag));
|
Assert.True(batch.Values.ContainsKey(BatchTag));
|
||||||
dcl.Reply(new WriteTagBatchResponse(batch.CorrelationId, true, null, DateTimeOffset.UtcNow));
|
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);
|
Assert.False(call.IsCompleted);
|
||||||
|
|
||||||
// The device completes THIS request.
|
// The device completes THIS request.
|
||||||
|
|||||||
Reference in New Issue
Block a user