From bc87947d11c62b8709d0815cd28d16213dacb1a7 Mon Sep 17 00:00:00 2001 From: Preston Vasquez Date: Wed, 17 Dec 2025 17:45:11 -0700 Subject: [PATCH 1/5] DRIVERS-2782 Allow variable access to snapshotTimeout --- source/sessions/snapshot-sessions.md | 2 +- source/sessions/tests/README.md | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/source/sessions/snapshot-sessions.md b/source/sessions/snapshot-sessions.md index 76b984db72..6785a879ae 100644 --- a/source/sessions/snapshot-sessions.md +++ b/source/sessions/snapshot-sessions.md @@ -137,7 +137,7 @@ class ClientSession { } ``` -Getting the value of `snapshotTime` on a non-snapshot session MUST raise an error. +Getting the value of `snapshotTime` on a non-snapshot session SHOULD raise an error. Transactions are not allowed with snapshot sessions. Calling `session.startTransaction(options)` on a snapshot session MUST raise an error. diff --git a/source/sessions/tests/README.md b/source/sessions/tests/README.md index 69e46e8142..f9acc6326e 100644 --- a/source/sessions/tests/README.md +++ b/source/sessions/tests/README.md @@ -270,10 +270,20 @@ Snapshot sessions tests require server of version 5.0 or higher and replica set Snapshot sessions tests require server of version 5.0 or higher and replica set or a sharded cluster deployment. -- Start a session by calling `startSession` on with `snapshot = false`. +- Start a session by calling `startSession` with `snapshot = false`. + +Drivers SHOULD implement one of the following approaches: + +**Approach 1: Validation (preferred if idiomatic)** + - Try to access the session's snapshot time. - Assert that a client side error was raised. +**Approach 2: Immutability (if error-returning getters are not idiomatic)** + +- Attempt to mutate the session's `snapshotTime` field through any publicly accessible API. +- Assert that the original session's `snapshotTime` remains unchanged. + ## Changelog - 2025-09-25: Added tests for snapshotTime. From 2a5829fc44a0f7734d66d8a11f55e9a12ef5c92f Mon Sep 17 00:00:00 2001 From: Preston Vasquez Date: Wed, 17 Dec 2025 17:47:40 -0700 Subject: [PATCH 2/5] DRIVERS-2782 Update CHANGELOG --- source/sessions/snapshot-sessions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/source/sessions/snapshot-sessions.md b/source/sessions/snapshot-sessions.md index 6785a879ae..ec419e39ac 100644 --- a/source/sessions/snapshot-sessions.md +++ b/source/sessions/snapshot-sessions.md @@ -270,6 +270,7 @@ C# driver will provide the reference implementation. The corresponding ticket is ## Changelog +- 2025-12-17: Allow ambiguous snapshotTime access. - 2025-09-23: Exposed snapshotTime to applications. - 2024-05-08: Migrated from reStructuredText to Markdown. - 2021-06-15: Initial version. From ecc49a544b7ddf9c623b0aa86955c42c076e1e83 Mon Sep 17 00:00:00 2001 From: Preston Vasquez Date: Wed, 17 Dec 2025 18:17:04 -0700 Subject: [PATCH 3/5] DRIVERS-2782 Rephrase with MUST --- source/sessions/snapshot-sessions.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/sessions/snapshot-sessions.md b/source/sessions/snapshot-sessions.md index ec419e39ac..68ed142d79 100644 --- a/source/sessions/snapshot-sessions.md +++ b/source/sessions/snapshot-sessions.md @@ -137,7 +137,8 @@ class ClientSession { } ``` -Getting the value of `snapshotTime` on a non-snapshot session SHOULD raise an error. +The `snapshotTime` field MUST be immutable; in APIs that expose `snapshotTime` with a getter, attempting to read it on a +non-snapshot session MUST raise an error. Transactions are not allowed with snapshot sessions. Calling `session.startTransaction(options)` on a snapshot session MUST raise an error. @@ -270,7 +271,7 @@ C# driver will provide the reference implementation. The corresponding ticket is ## Changelog -- 2025-12-17: Allow ambiguous snapshotTime access. +- 2025-12-17: Clarify snapshotTime semantics: the field is immutable, and accessing it on a non-snapshot session is an error. - 2025-09-23: Exposed snapshotTime to applications. - 2024-05-08: Migrated from reStructuredText to Markdown. - 2021-06-15: Initial version. From 8f2f55adb0955a2232d52bc40b7fdc0e6767c6f3 Mon Sep 17 00:00:00 2001 From: Preston Vasquez Date: Thu, 18 Dec 2025 10:14:43 -0700 Subject: [PATCH 4/5] DRIVERS-2782 Fix linting errors --- source/sessions/snapshot-sessions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/sessions/snapshot-sessions.md b/source/sessions/snapshot-sessions.md index 68ed142d79..c98f3a6174 100644 --- a/source/sessions/snapshot-sessions.md +++ b/source/sessions/snapshot-sessions.md @@ -137,7 +137,7 @@ class ClientSession { } ``` -The `snapshotTime` field MUST be immutable; in APIs that expose `snapshotTime` with a getter, attempting to read it on a +The `snapshotTime` field MUST be immutable; in APIs that expose `snapshotTime` with a getter, attempting to read it on a non-snapshot session MUST raise an error. Transactions are not allowed with snapshot sessions. Calling `session.startTransaction(options)` on a snapshot session @@ -271,7 +271,7 @@ C# driver will provide the reference implementation. The corresponding ticket is ## Changelog -- 2025-12-17: Clarify snapshotTime semantics: the field is immutable, and accessing it on a non-snapshot session is an error. +- 2025-12-17: Clarify snapshotTime semantics: the field is either immutable or validated. - 2025-09-23: Exposed snapshotTime to applications. - 2024-05-08: Migrated from reStructuredText to Markdown. - 2021-06-15: Initial version. From 66939d125433b03aa1cc29a6cb7e647c10e83d3a Mon Sep 17 00:00:00 2001 From: Preston Vasquez Date: Thu, 18 Dec 2025 10:53:13 -0700 Subject: [PATCH 5/5] DRIVERS-2782 Use read-only instead of immutable --- source/sessions/snapshot-sessions.md | 4 ++-- source/sessions/tests/README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/sessions/snapshot-sessions.md b/source/sessions/snapshot-sessions.md index c98f3a6174..e08e358fb3 100644 --- a/source/sessions/snapshot-sessions.md +++ b/source/sessions/snapshot-sessions.md @@ -137,7 +137,7 @@ class ClientSession { } ``` -The `snapshotTime` field MUST be immutable; in APIs that expose `snapshotTime` with a getter, attempting to read it on a +The `snapshotTime` field MUST be read-only; in APIs that expose `snapshotTime` with a getter, attempting to read it on a non-snapshot session MUST raise an error. Transactions are not allowed with snapshot sessions. Calling `session.startTransaction(options)` on a snapshot session @@ -271,7 +271,7 @@ C# driver will provide the reference implementation. The corresponding ticket is ## Changelog -- 2025-12-17: Clarify snapshotTime semantics: the field is either immutable or validated. +- 2025-12-17: Clarify snapshotTime semantics: the field is either read-only or validated. - 2025-09-23: Exposed snapshotTime to applications. - 2024-05-08: Migrated from reStructuredText to Markdown. - 2021-06-15: Initial version. diff --git a/source/sessions/tests/README.md b/source/sessions/tests/README.md index f9acc6326e..3c3aa3fd01 100644 --- a/source/sessions/tests/README.md +++ b/source/sessions/tests/README.md @@ -279,7 +279,7 @@ Drivers SHOULD implement one of the following approaches: - Try to access the session's snapshot time. - Assert that a client side error was raised. -**Approach 2: Immutability (if error-returning getters are not idiomatic)** +**Approach 2: Ensure Read-Only (if error-returning getters are not idiomatic)** - Attempt to mutate the session's `snapshotTime` field through any publicly accessible API. - Assert that the original session's `snapshotTime` remains unchanged.