Skip to content

RavenDB-26793 Time-series bulk-insert UTC fix + custom-entity-name control-char guard#303

Merged
poissoncorp merged 2 commits into
ravendb:v7.2from
poissoncorp:RavenDB-26793
Jul 9, 2026
Merged

RavenDB-26793 Time-series bulk-insert UTC fix + custom-entity-name control-char guard#303
poissoncorp merged 2 commits into
ravendb:v7.2from
poissoncorp:RavenDB-26793

Conversation

@poissoncorp

Copy link
Copy Markdown
Contributor

Two client-side fixes surfaced while validating the 6.2.18 / 7.2.5 nightlies against the Python client.

1. Bulk-insert time-series timestamps shifted by local UTC offset (bug)

Utils.get_unix_time_in_ms() used datetime.timestamp(), which interprets a naive datetime in the machine's local timezone. Bulk-insert time-series timestamps were therefore shifted by the local UTC offset on non-UTC machines (e.g. +2h on CET), whereas the regular session path (Utils.datetime_to_string) treats naive datetimes as UTC. That made ~18 test_time_series_bulk_insert / test_typed_bulk_insert cases fail locally (they pass on CI because CI runs in UTC).

Fix: treat naive datetimes as UTC in get_unix_time_in_ms (its only caller is the bulk-insert time-series path), consistent with datetime_to_string. tz-aware datetimes are unaffected.

2. test_custom_entity_name guard let control chars through (test)

Current 6.2.x / 7.2.x servers now reject control characters in document ids (including the generated Raven/Hilo/... id) via DocumentIdWorker.ThrowIdentifierWithControlCharacters. Verified locally: bundled 7.2.1 accepts them (test passes), while both 6.2.18-nightly and 7.2.5-nightly reject them (HTTP 500). The test injected control chars 1..13 into the collection name through a guard that only skipped 14..31; widened it to skip the whole C0 control range (ord(c) <= 31).

Verification

  • black --check clean.
  • The 26 previously-failing cases (18 bulk-insert TS + typed bulk-insert + test_custom_entity_name) pass against a local 7.2.5-nightly server.

Notes for reviewers

  • test_custom_entity_name is a jvm-migrated test; the 14 <= c <= 31 guard is a straight port, so the JVM / C# / Node suites likely carry the same guard and will start failing against these nightlies — worth fixing across clients or documenting the id contract.
  • The server returns HTTP 500 for a control-char id (client-invalid input); arguably it should be a 4xx. That's a separate server-side consideration, not addressed here.

…atetimes 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 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).
@poissoncorp poissoncorp merged commit cfe2d77 into ravendb:v7.2 Jul 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant