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

オープン 初心者向け
#653 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@RaphaelFakhri がすでに取り組んでいます。

2026年11月5日 から。

  • #654 @RaphaelFakhri による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
ruby
領域
api, backend

調査の方向性

まず、issueでTime値のエンコーダーとして示されているTemporalio::SearchAttributes._to_proto_pairを読みます。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時間
マージ済み PR(30日)
34

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

temporalio/sdk-ruby のほかの issue

temporalio/sdk-ruby の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。