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

未关闭 适合新手
#653 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@RaphaelFakhri 已经在做这个了。

开始于 2026年11月5日。

  • #654 来自 @RaphaelFakhri —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
ruby
领域
api, backend

调研方向

首先阅读Temporalio::SearchAttributes._to_proto_pair,issue中将其标识为Time值的编码器;payload没有指出其源文件或测试。检查SDK如何编码小数秒以及如何加载标准库time,然后使用最小复现验证序列化后的值保留秒以下精度,并且无需在应用层执行require 'time'即可工作。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
Ruby
星标
207
派生
46
平均合并
1 天 15 小时
30 天内合并 PR
34

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

temporalio/sdk-ruby 的其他 Issue

查看 temporalio/sdk-ruby 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。