[Bug] JSON payload decoding raises ArgumentError with json 3.x (JSON.parse options are keyword-only)
维护者通常 1 天内回复
@GregoryTravis 已经在做这个了。
开始于 2026年10月13日。
评估
调研方向
从 temporalio/lib/temporalio/converters/payload_converter/json_plain.rb 开始,并使用 json 3.x 运行最小复现。检查两个 JSON.parse 调用路径,并验证 payload 解码在 json 2.x 和 3.x 下都能正常工作,包括经过编码的失败属性,同时确保 JSON 生成不受影响。
由索引模型根据 Issue 内容生成。
描述
What are you really trying to do?
Decode JSON payloads (and failures with encode_common_attributes: true) with json 3.x installed.
Describe the bug
json 3.0 changed JSON.parse to take its options as keyword arguments only:
def parse(source, on_load: nil, object_class: nil, array_class: nil, **options)
Temporalio::Converters::PayloadConverter::JSONPlain#from_payload passes them as a positional hash:
JSON.parse(payload.data, @parse_options)
(temporalio/lib/temporalio/converters/payload_converter/json_plain.rb, both branches, still present on main.)
So with json >= 3.0 every JSON payload decode raises:
ArgumentError: wrong number of arguments (given 2, expected 1)
json-3.0.2/lib/json/common.rb:296:in `parse'
temporalio-1.9.0/lib/temporalio/converters/payload_converter/json_plain.rb:55:in `from_payload'
temporalio-1.9.0/lib/temporalio/converters/payload_converter/composite.rb:66:in `from_payload'
temporalio-1.9.0/lib/temporalio/converters/data_converter.rb:90:in `from_payloads'
A quieter side effect: FailureConverter#from_failure ignores errors while decoding encoded_attributes, so with encode_common_attributes: true the decoded error's message is left as "Encoded failure" and nothing is raised.
Encoding is unaffected: JSON.generate(value, @generate_options) still accepts a positional hash in json 3.
temporalio.gemspec doesn't constrain json, so a fresh resolve picks up 3.x.
Minimal Reproduction
# Gemfile: gem "temporalio", "1.9.0"; gem "json", "3.0.2"
require "temporalio/converters"
dc = Temporalio::Converters::DataConverter.default
dc.from_payloads(dc.to_payloads([{ "a" => 1 }]))
# => ArgumentError: wrong number of arguments (given 2, expected 1)
Passes with json 2.21.2.
Suggested fix
Splat the options so it works on both json 2.x and 3.x:
JSON.parse(payload.data, **@parse_options)
and/or add json to the gemspec with a lower bound that supports keyword options.
Environment/Versions
- temporalio 1.9.0 (also present on
main) - json 3.0.2
- Ruby 3.2, 3.3, 3.4 (reproduced on all three in CI; locally on 3.3.4, arm64-darwin)
Additional context
Workaround: pin gem "json", "< 3" in the application's Gemfile.
- 主要语言
- Ruby
- 星标
- 207
- 派生
- 45
- 平均合并
- 1 天 16 小时
- 30 天内合并 PR
- 25
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
temporalio/sdk-ruby 的其他 Issue
-
Enable concurrent payload visiting - Ruby可能已有人在做 @jmaeagle99 于 12 天前认领。 未关闭
temporalio/sdk-ruby#616 · 已指派 1 人 ·
维护者通常 1 天内回复
-
External Payload Storage Foundation - Ruby可能已有人在做 @jmaeagle99 于 16 天前认领。 未关闭
temporalio/sdk-ruby#614 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[Bug] Exception in an unawaited Workflow::Future is silently swallowed, leaving the workflow stuck RUNNING可能已有人在做 @GregoryTravis 于 12 天前认领。 未关闭bug
难度 3/5 半天 新手友好度 40/100
temporalio/sdk-ruby#613 · 1 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
-
Proposal: handle SIGTERM by default to initiate graceful worker shutdown可能已有人在做 @eamsden 于 17 天前认领。 未关闭
temporalio/sdk-ruby#611 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[Feature Request] Add thread lifecycle hook to `Worker::ThreadPool`可能已有人在做 @GregoryTravis 于 61 天前认领。 未关闭enhancement
temporalio/sdk-ruby#563 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 temporalio/sdk-ruby 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
up-for-grabs/up-for-grabs.net#6330 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 72/100
TheOdinProject/curriculum#31490 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
hotwired/turbo-rails#791 ·
-
难度 2/5 1-3 小时 新手友好度 85/100
FinanceFlash/unvibecode#273 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复