From dc2f3fa9700aef2ac6fef6bb4be4aba52f9a35d8 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 13 Jul 2026 09:58:07 -0400 Subject: [PATCH] test(r2-06): pin 0.2.0 Boolean->Int1 explicit-presence (HasDataType) provisioning (06/U-7) --- ...erverhistorian-failfast-plan.md.tasks.json | 2 +- .../GatewayTagProvisionerTests.cs | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/archreview/plans/R2-06-serverhistorian-failfast-plan.md.tasks.json b/archreview/plans/R2-06-serverhistorian-failfast-plan.md.tasks.json index aebd3c96..2bf733da 100644 --- a/archreview/plans/R2-06-serverhistorian-failfast-plan.md.tasks.json +++ b/archreview/plans/R2-06-serverhistorian-failfast-plan.md.tasks.json @@ -51,7 +51,7 @@ { "id": "T7", "subject": "U-7 pin: GatewayTagProvisionerTests Boolean_definition_carries_explicit_Int1_presence (asserts HistorianDataType.Int1 AND HasDataType — 0.2.0 proto3-optional presence witness; pin, no RED phase)", - "status": "pending", + "status": "completed", "blockedBy": [] }, { diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Historian.Gateway.Tests/GatewayTagProvisionerTests.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Historian.Gateway.Tests/GatewayTagProvisionerTests.cs index ad022a47..a98dad05 100644 --- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Historian.Gateway.Tests/GatewayTagProvisionerTests.cs +++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Historian.Gateway.Tests/GatewayTagProvisionerTests.cs @@ -31,6 +31,35 @@ public sealed class GatewayTagProvisionerTests Assert.Equal(0, result.Skipped); } + /// + /// archreview 06/U-7 — pins the 0.2.0 Boolean→Int1 provisioning semantics at TWO levels. The + /// 0.1.0→0.2.0 client bump made HistorianTagDefinition.DataType proto3-optional (explicit + /// presence): under 0.1.0 the provisioner's Int1 (wire 0) was indistinguishable from unset, + /// so the gateway defaulted Boolean tags to Float; under 0.2.0 the same call carries explicit + /// presence and provisions Int1 (the intended behavior). Asserting BOTH the mapped type AND + /// HasDataType compile-pins the package floor (the HasDataType/ClearDataType + /// members exist only on the 0.2.0 proto3-optional contract — a downgrade breaks the build) and + /// assert-pins that the provisioner always sends explicit presence (a future contract change that + /// stopped sending it would break the assert). This is a pin, not a fix — it passes on current code. + /// + [Fact] + public async Task Boolean_definition_carries_explicit_Int1_presence() + { + var fake = new FakeHistorianGatewayClient { EnsureTagsResult = new TagOperationResults() }; + var p = Provisioner(fake); + + await p.EnsureTagsAsync( + new[] { new HistorianTagProvisionRequest("Pump1.Run", DriverDataType.Boolean, null, null) }, + TestContext.Current.CancellationToken); + + var defs = fake.LastEnsureDefinitions!; + Assert.Single(defs); + Assert.Equal(HistorianDataType.Int1, defs[0].DataType); + // 0.2.0 proto3-optional presence witness — explicit presence is what flips the gateway from its + // SDK-default Float to the requested Int1. Without this, a Boolean tag would provision as Float. + Assert.True(defs[0].HasDataType); + } + [Fact] public async Task Maps_metadata_and_coalesces_null_metadata_to_empty() {