Raise ValueError for naive datetime search attributes - #1882
Open
KingLizard1020 wants to merge 2 commits into
Open
KingLizard1020 wants to merge 2 commits into
KingLizard1020 wants to merge 2 commits into
Conversation
Mirror the untyped encoder timezone check into the typed path so upserting or encoding a datetime search attribute without tzinfo fails client-side instead of as a server BadSearchAttributes error. Signed-off-by: Kailash Nelson <37966146+KingLizard1020@users.noreply.github.com>
github-actions
Bot
force-pushed
the
cursor/datetime-search-attr-tz-0487
branch
from
September 17, 2026 17:34
cb5b372 to
825e69c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses temporalio/sdk-python#611. Related: #572.
encode_typed_search_attribute_valuenow raisesValueError("Timezone must be present on all search attribute dates")when encoding a datetime search attribute that lacks a timezone. This matches the deprecated untypedencode_search_attribute_valuespath.Previously the typed path called
isoformat()on naive datetimes and sent a string the server rejected withBadSearchAttributes. Bothupsert_search_attributesand client-side typed attributes go through the typed encoder, so this covers both.Raising (rather than warning) is intentional: these values already failed on the server, and matching the untyped encoder keeps one client-side contract.
Test plan
test_encode_typed_search_attribute_value_datetime_requires_timezonenext totest_encode_search_attribute_values. Naive datetimes raise; timezone-aware datetimes still encode.uv run pytest tests/test_converter.py— 33 passed, including the new regression test andtest_encode_search_attribute_values.