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

Open Beginner friendly
#653 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@RaphaelFakhri is already working on this.

Since Nov 5, 2026.

  • #654 by @RaphaelFakhri — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
ruby
Domain
api, backend

Research direction

Start by reading Temporalio::SearchAttributes._to_proto_pair, identified in the issue as the encoder for Time values; the payload does not name its source file or a test. Check how the SDK encodes fractional seconds and loads the time standard library, then use the minimal reproduction to verify the serialized value preserves sub-second precision and works without an application-level require 'time'.

Written by the indexing model from the issue text.

Description

Set a TIME (Datetime) search attribute from Ruby and read the same value back.

Describe the bug

SearchAttributes._to_proto_pair encodes Time values with Time#iso8601, which writes zero fraction digits. Any sub-second part is dropped before the value reaches the server. The server keeps sub-second precision: a raw Datetime payload of "2027-01-15T08:00:00.123456789Z" comes back unchanged from DescribeWorkflowExecution. The Python, Go and .NET SDKs send fractional seconds.

Separately, Time#iso8601 and Time.iso8601 come from the time standard library, and the SDK never requires it. On Ruby 3.3, an application that does not load time itself (plain Ruby, no Rails) gets NoMethodError: undefined method 'iso8601' for an instance of Time as soon as it sets a TIME search attribute.

Minimal reproduction

require 'temporalio/client'

key = Temporalio::SearchAttributes::Key.new('MyTime', Temporalio::SearchAttributes::IndexedValueType::TIME)
time = Time.at(1_800_000_000, 123_456_789, :nanosecond, in: 'UTC')
_, payload = Temporalio::SearchAttributes._to_proto_pair(key, time)
puts payload.data
  • Ruby 3.3 without require 'time': NoMethodError: undefined method 'iso8601' for an instance of Time.
  • With require 'time': prints "2027-01-15T08:00:00Z". Starting a workflow with this attribute and describing it returns 2027-01-15 08:00:00 UTC instead of 2027-01-15 08:00:00.123456789 UTC.

Environment

  • SDK: temporalio 1.10.0 and current main
  • Ruby 3.3.x, Linux aarch64
  • Server: Temporal CLI dev server started by WorkflowEnvironment.start_local
Dominant language
Ruby
Stars
207
Forks
46
Avg merge
1d 15h
Merged PRs (30d)
34

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from temporalio/sdk-ruby

All issues in temporalio/sdk-ruby

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.