From 4bb360d07ca01a33c60916a783d86662bab270f0 Mon Sep 17 00:00:00 2001 From: Gracjan Sadowicz Date: Wed, 8 Jul 2026 23:57:35 +0200 Subject: [PATCH 1/2] RavenDB-26793 Fix bulk-insert time-series timestamps to treat naive datetimes as UTC Utils.get_unix_time_in_ms used datetime.timestamp(), which interprets a naive datetime in the machine's local timezone, so bulk-insert time-series timestamps were shifted by the local UTC offset on non-UTC machines (e.g. 2h on CET). The regular session path (Utils.datetime_to_string) treats naive datetimes as UTC; do the same here so both paths agree and results are timezone-independent. --- ravendb/tools/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ravendb/tools/utils.py b/ravendb/tools/utils.py index 78a81cbf..636457f4 100644 --- a/ravendb/tools/utils.py +++ b/ravendb/tools/utils.py @@ -15,7 +15,7 @@ from collections import Iterable, Sequence from ravendb.tools.projection import create_entity_with_mapper -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from enum import Enum from threading import Timer from copy import deepcopy @@ -958,4 +958,8 @@ def add_minutes(date: datetime, minutes: int): @staticmethod def get_unix_time_in_ms(date: datetime) -> int: + # Naive datetimes are treated as UTC (consistent with Utils.datetime_to_string) so that + # bulk-insert time-series timestamps are not shifted by the machine's local UTC offset. + if date.tzinfo is None: + date = date.replace(tzinfo=timezone.utc) return int(date.timestamp() * 1000) From af94dd87b11579ad7fb8b03762d89d87b61b7966 Mon Sep 17 00:00:00 2001 From: Gracjan Sadowicz Date: Wed, 8 Jul 2026 23:57:35 +0200 Subject: [PATCH 2/2] RavenDB-26793 Skip all C0 control characters in custom-entity-name test RavenDB now rejects control characters in document ids (including the generated HiLo id). The test injected control chars 1..13 into the collection name via a guard that only skipped 14..31, so it failed against current 6.2/7.2 servers. Skip the whole C0 control range (ord <= 31). --- .../client_tests/test_custom_entity_name.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ravendb/tests/jvm_migrated_tests/client_tests/test_custom_entity_name.py b/ravendb/tests/jvm_migrated_tests/client_tests/test_custom_entity_name.py index 1f44915f..cc63f4b7 100644 --- a/ravendb/tests/jvm_migrated_tests/client_tests/test_custom_entity_name.py +++ b/ravendb/tests/jvm_migrated_tests/client_tests/test_custom_entity_name.py @@ -100,7 +100,9 @@ def _customize_store(self, store: DocumentStore) -> None: ) def __test_when_collection_and_id_contain_special_chars(self, c: str) -> None: - if 14 <= ord(c) <= 31: + # RavenDB now rejects control characters in document ids (including the generated HiLo id), + # so skip the whole C0 control range rather than only 14..31. + if ord(c) <= 31: return self.c = c