From 97c639b5562cb05021140ff5f5c883da8a3fa55e Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 24 Nov 2026 14:25:45 -0500 Subject: [PATCH] =?UTF-8?q?test(grpc-data):=20A2b=20smoke=20probe=20?= =?UTF-8?q?=E2=80=94=20scripted=20outcome=20is=20applied=20(2),=20method?= =?UTF-8?q?=20bits=20Primary-only,=20record=20comment/ClientUserId/marker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/validation/grpc-data/probe/Program.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/validation/grpc-data/probe/Program.cs b/scripts/validation/grpc-data/probe/Program.cs index 4b9d445df..02cb1b4ea 100644 --- a/scripts/validation/grpc-data/probe/Program.cs +++ b/scripts/validation/grpc-data/probe/Program.cs @@ -272,6 +272,8 @@ try static object Record(W.ConditionState r) => new { key = r.ConditionKey, r.Version, r.Removed, r.StateKnown, r.Active, r.Acknowledged, r.Severity, r.Message, + comment = r.HasComment ? r.Comment : null, clientUserId = r.HasClientUserId ? r.ClientUserId : null, + activation = r.Activation is null ? null : r.Activation.Incarnation[..Math.Min(8, r.Activation.Incarnation.Length)] + ":" + r.Activation.Sequence, info = r.Info is null ? null : new { r.Info.ConditionType, r.Info.ConditionName, r.Info.SourceKind, placements = r.Info.Placements.Select(p => p.Address.NamespaceUri + "|" + p.Address.Identifier).ToArray() }, }; @@ -366,11 +368,16 @@ try var leaked = snapshot.Concat(deltas).Any(r => Record(r).ToString()!.Contains("modbus/plc", StringComparison.Ordinal)); var ackJson = JsonSerializer.SerializeToElement(ackEvidence); var methodState = ackEvidence is null ? -1 : ackJson.GetProperty("firstState").GetInt32(); - var methodsOk = (featured.Operations & 384) == 384 && (plain.Operations & 384) == 0 && ackEvidence is not null + // Method bits: with the header on the Primary only (stripped off-Primary), never without the header. + // State: scripted ⇒ 2 (applied), native ⇒ 4 (AcceptedUnconfirmed); Secondary ⇒ 1 (RejectedBeforeDispatch). + // The stream may carry more than one acked record (a state-only re-projection after the method's own record); + // "exactly one ack" is the ORIGIN's event count, asserted by conditions_smoke.py. + var scripted = snapshot.FirstOrDefault(r => r.Active && r.Info is not null)?.Info.SourceKind == 2; + var methodsOk = (featured.Operations & 384) == (primary ? 384u : 0u) && (plain.Operations & 384) == 0 && ackEvidence is not null && ackJson.GetProperty("headerless").GetString() == "FailedPrecondition" + && ackJson.GetProperty("duplicateEqual").GetBoolean() && (primary - ? methodState == 4 && ackJson.GetProperty("duplicateEqual").GetBoolean() - && deltas.Count(r => r.Active && r.Acknowledged) == 1 + ? methodState == (scripted ? 2 : 4) && deltas.Any(r => r.Active && r.Acknowledged && r.StateKnown) : methodState == 1); var passed = capsOk && methodsOk && (primary ? ackStatus == 1 && total >= 1 && complete && snapshot.Count == total && snapshot.Any(r => r.Active && r.StateKnown)