jsonrpc: decimal and exponent integer IDs still lose precision after #1401
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Start from MakeID and the DecodeMessage path in the jsonrpc package, where integer-literal IDs are kept exact and decimal or exponent forms fall back to float64. Run the four table inputs (9007199254740993.0, 90071992547409930e-1, -9007199254740993.0, and the plain integer) through both DecodeMessage and MakeID, and check the cancellation match against notifications/cancelled. Done means every integral decimal or exponent form keeps its exact value, while fractional and out-of-range values still take the existing fallback. Linked PR #1405 already addresses this, so coordinate with it first.
索引モデルが issue の本文から書いたものです。
説明
After #1401 (95591a7676778ac3dbc27b2611653f0b9e66b3c3), integer-literal request IDs retain their precision, but equivalent decimal/exponent forms still go through the float64 fallback in MakeID.
Reproduction through both DecodeMessage and MakeID(json.Number(...)):
| Input ID | Expected numeric value | Actual |
|---|---|---|
| 9007199254740993 | 9007199254740993 | 9007199254740993 |
| 9007199254740993.0 | 9007199254740993 | 9007199254740992 |
| 90071992547409930e-1 | 9007199254740993 | 9007199254740992 |
| -9007199254740993.0 | -9007199254740993 | -9007199254740992 |
For example, decode {"jsonrpc":"2.0","id":9007199254740993.0,"method":"m"}. The decoded Request.ID.Raw() is 9007199254740992. The same occurs for response decoding.
Cancellation also uses MakeID: an integer request ID of 9007199254740993 does not match notifications/cancelled with requestId 9007199254740993.0 or 90071992547409930e-1.
These values are mathematically integral and within int64. Preserving their numeric value does not require retaining the original decimal spelling. JSON-RPC requires the response ID value to match the request: https://www.jsonrpc.org/specification#request_object.
Proposed scope: keep the integer-literal fast path, then normalize integral decimal/exponent forms exactly without exponent-sized allocations. Preserve the current fallback for genuinely fractional/out-of-range values and the existing float64 API behavior. The stricter rejection policy proposed in #1178 is separate.
- 主要言語
- Go
- スター
- 5.2k
- フォーク
- 583
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 55
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/go-sdk のほかの issue
-
Session-lifecycle bookkeeping logs at info, spamming multiple log lines per request on stateless streamable HTTP対応中かも @anneheartrecord が 50 日前に担当しました。 オープンP3
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
modelcontextprotocol/go-sdk#1204 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Expose generic `SendNotification` on `ServerSession` for custom protocol extensions対応中かも @ajuijas が 215 日前に担当しました。 オープンneeds investigation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/go-sdk#745 · コメント 13 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
mcp: a property with an array "type" (any pointer field from jsonschema.For) disables x-mcp-header handling for the whole tool対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 50/100
modelcontextprotocol/go-sdk#1406 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
mcp: a handler error without a code reaches the peer as JSON-RPC error code 0対応中かも @talhayme が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
modelcontextprotocol/go-sdk#1394 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
mcp: rejected request IDs receive no JSON-RPC error envelope対応中かも @skosovsky が 4 日前に担当しました。 オープン
難易度 4/5 1〜2日 初心者へのやさしさ 68/100
modelcontextprotocol/go-sdk#1391 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/go-sdk の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
devantler-tech/ksail#7836 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
keyxmakerx/Chronicle#1469 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
bug needs-acceptance wg/router-models-inference-runtime
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
vllm-project/semantic-router#5177 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Gentleman-Programming/gentle-ai#5565 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信