jsonrpc: decimal and exponent integer IDs still lose precision after #1401
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 25/100
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
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de modelcontextprotocol/go-sdk
-
Session-lifecycle bookkeeping logs at info, spamming multiple log lines per request on stateless streamable HTTPPosiblemente ocupada @anneheartrecord la tomó hace 49 días. AbiertoP3
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
modelcontextprotocol/go-sdk#1204 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Expose generic `SendNotification` on `ServerSession` for custom protocol extensionsPosiblemente ocupada @ajuijas la tomó hace 215 días. Abiertoneeds investigation
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
modelcontextprotocol/go-sdk#745 · 13 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 50/100
modelcontextprotocol/go-sdk#1406 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
mcp: a handler error without a code reaches the peer as JSON-RPC error code 0Posiblemente ocupada @talhayme la tomó hoy. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
modelcontextprotocol/go-sdk#1394 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
mcp: rejected request IDs receive no JSON-RPC error envelopePosiblemente ocupada @skosovsky la tomó hace 4 días. Abierto
Dificultad 4/5 1-2 días Aptitud para principiantes 68/100
modelcontextprotocol/go-sdk#1391 ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelcontextprotocol/go-sdk
Issues similares
-
bug
Dificultad 2/5 Medio día Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
kubernetes-sigs/external-dns#6816 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
ANSI translator ignores SGR 22/24 (and other attribute-off codes): bold and underline never turn offAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Named Tuple element with a space in its name fails to parsePosiblemente ocupada @spicysharkco la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ClickHouse/clickhouse-go#2073 ·
Los mantenedores suelen responder en 1 día