Skip to content

fix: keep sub-second precision in time search attributes - #654

Merged
chris-olszewski merged 1 commit into
temporalio:mainfrom
RaphaelFakhri:fix-search-attribute-time-precision
Nov 5, 2026
Merged

chris-olszewski merged 1 commit into
temporalio:mainfrom
RaphaelFakhri:fix-search-attribute-time-precision

Conversation

@RaphaelFakhri

Copy link
Copy Markdown
Contributor

What was changed

  • SearchAttributes._to_proto_pair encodes TIME values with Time#iso8601(9) instead of Time#iso8601, so fractional seconds are no longer dropped.
  • temporalio/search_attributes.rb now requires time, which provides Time#iso8601 and Time.iso8601.
  • Adds test_search_attribute_time_sub_second to client_workflow_test.rb and a fixed changelog fragment.

Why?

Time#iso8601 with no argument writes whole seconds. A Time search attribute set to 08:00:00.123456789 is sent as 08:00:00Z, and that is what describe and list return. The server keeps the fraction: a raw Datetime payload with nanoseconds is returned unchanged, and the other SDKs send fractional seconds.

The SDK also never required time. On Ruby 3.3, an application that does not load it itself gets NoMethodError: undefined method 'iso8601' when it sets a TIME search attribute. The test suite does not catch this because its development dependencies load time.

Checklist

  1. Closes [Bug] Time search attributes lose sub-second precision, and raise NoMethodError without require 'time' #653

  2. How was this tested:

    • New test ClientWorkflowTest#test_search_attribute_time_sub_second starts a workflow with a nanosecond-precision TIME attribute and checks that describe returns the same Time. It fails before the change (expected 08:00:00.123456789 UTC, got 08:00:00 UTC) and passes after it.
    • WorkerWorkflowTest#test_search_attributes_memo passes.
    • A workflow that calls upsert_search_attributes with Workflow.now returns full nanoseconds in the workflow and in describe, with no illegal call errors.
    • Rubocop reports no offenses on the changed files.
  3. Any docs updates needed? No.

@RaphaelFakhri
RaphaelFakhri requested a review from a team as a code owner November 5, 2026 07:37

@chris-olszewski chris-olszewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the find & fix!

@chris-olszewski
chris-olszewski merged commit dd77597 into temporalio:main Nov 5, 2026
12 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.

[Bug] Time search attributes lose sub-second precision, and raise NoMethodError without require 'time'

2 participants