Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

jsonrpc: decimal and exponent integer IDs still lose precision after #1401

Đang mở
#1,404 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@skosovsky đang làm issue này rồi.

Từ ngày 16/10/2026.

  • #1405 của @skosovsky — đang mở

Đá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
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
api

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

Mở trong Codespaces

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.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelcontextprotocol/go-sdk

Tất cả issue của modelcontextprotocol/go-sdk

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.