Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#1,404 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@skosovsky ya está trabajando en esto.

Desde el 16/10/2026.

  • #1405 de @skosovsky — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go
Área
api

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Go
Estrellas
5.2k
Forks
583
Merge medio
2 d 1 h
PR fusionados (30 d)
55

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de modelcontextprotocol/go-sdk

Todos los issues de modelcontextprotocol/go-sdk

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.