jsonrpc: decimal and exponent integer IDs still lose precision after #1401
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Go
- Star
- 5.2k
- Fork
- 583
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 55
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/go-sdk
-
Session-lifecycle bookkeeping logs at info, spamming multiple log lines per request on stateless streamable HTTPCó thể đã có người làm @anneheartrecord đã nhận 49 ngày trước. Đang mởP3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
modelcontextprotocol/go-sdk#1204 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Expose generic `SendNotification` on `ServerSession` for custom protocol extensionsCó thể đã có người làm @ajuijas đã nhận 215 ngày trước. Đang mởneeds investigation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
modelcontextprotocol/go-sdk#745 · 13 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
mcp: a property with an array "type" (any pointer field from jsonschema.For) disables x-mcp-header handling for the whole toolCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 50/100
modelcontextprotocol/go-sdk#1406 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
mcp: a handler error without a code reaches the peer as JSON-RPC error code 0Có thể đã có người làm @talhayme đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
modelcontextprotocol/go-sdk#1394 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
mcp: rejected request IDs receive no JSON-RPC error envelopeCó thể đã có người làm @skosovsky đã nhận 4 ngày trước. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 68/100
modelcontextprotocol/go-sdk#1391 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelcontextprotocol/go-sdk
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
keyxmakerx/Chronicle#1469 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Gentleman-Programming/gentle-ai#5565 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug frontend grammar sev-3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
-
connector docs good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
soma-intelligence/open-health-sync#134 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug frontend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 3 ngày