From 02f2dafe2a0a7e2ec5d5a7523139770c5e042cd1 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 24 Jul 2026 15:20:59 -0400 Subject: [PATCH] test(sql): correct the cancelled-token test's overclaim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Its doc said it pinned "the real provider's cancellation path", but the token is cancelled before ReadAsync so the OCE is raised at the reader's SemaphoreSlim.WaitAsync gate, before any SqlConnection opens — it never exercises Microsoft.Data.SqlClient's in-flight command cancellation. Softened (option (a)) to state accurately what it proves: an already- cancelled token propagates as OCE and is never swallowed into a Bad snapshot or an unreachable-database verdict. The in-flight/deadline path is covered by SqlBlackholeTimeoutTests. Claude-Session: https://claude.ai/code/session_01GASWkNEi68FSCtvr6rLoEW --- .../SqlServerReadTests.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Sql.IntegrationTests/SqlServerReadTests.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Sql.IntegrationTests/SqlServerReadTests.cs index c258ff6b..c3fe2e99 100644 --- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Sql.IntegrationTests/SqlServerReadTests.cs +++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Sql.IntegrationTests/SqlServerReadTests.cs @@ -322,8 +322,16 @@ public sealed class SqlServerReadTests /// /// A cancelled poll propagates rather than publishing /// Bad-quality snapshots: the engine asked the poll to stop and nobody is waiting for values. The - /// asymmetry with a deadline breach (which DOES publish BadTimeout) is deliberate, so it is pinned - /// here against the real provider's cancellation path. + /// asymmetry with a deadline breach (which DOES publish BadTimeout) is deliberate. + /// What this proves, precisely. The token is already cancelled before + /// ReadAsync is called, so the cancellation is observed at the reader's first checkpoint — + /// SemaphoreSlim.WaitAsync(_, token)before any SqlConnection opens. It + /// therefore does not exercise Microsoft.Data.SqlClient's in-flight cancellation of a + /// running command; that is left to the blackhole gate's deadline path + /// (SqlBlackholeTimeoutTests). What it pins is the driver-shell contract that a cancelled + /// token surfaces as an and is never swallowed into + /// a Bad snapshot or misread as an unreachable-database verdict — an offline-equivalent guarantee, + /// run here over the real provider only to keep it beside its siblings. /// [Fact] public async Task ReadAsync_realSqlServer_cancelledTokenPropagatesRatherThanBadCoding()