uint and int refuse values past the JavaScript safe-integer ceiling
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 75/100
Direção de pesquisa
Start with src/compact_encoding/integer.py and read how MAX_SAFE_INTEGER is applied to integer codecs. Run the conformance cases int-past-range, int-past-range-min, uint-decode-ceiling, and uint56-decode-ceiling. Done means Python integers beyond the JavaScript safe-integer ceiling encode and decode according to the expected corpus results instead of being refused.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Found by running the compact-encoding-test conformance corpus against this port.
uint, int and the fixed-width codecs refuse values above 9007199254740991, the largest integer a JavaScript double holds exactly:
import compact_encoding as c
c.encode(c.int, 4503599627370496) # ValueError: integer is greater than the maximum safe integer
c.uint.decode(c.State(bytes.fromhex('ff0000000000002000'))) # ValueError: uint is greater than the maximum safe integer
c.uint56.decode(c.State(bytes.fromhex('00000000000020'))) # ValueError: uint is greater than the maximum safe integer
The ceiling comes from MAX_SAFE_INTEGER in src/compact_encoding/integer.py, mirroring the reference. The corpus treats it as the reference's limit rather than the format's: per holepunchto/compact-encoding-test#120 and #128, int writes 4503599627370496 as ff0000000000002000 and -4503599627370497 as ff0100000000002000, and both decodes return 9007199254740992. An implementation may refuse a value its number type cannot hold (the unrepresentable outcome), but Python's int holds all of them, so the refusal is a divergence (holepunchto/compact-encoding-test#19).
The corpus cases are int-past-range and int-past-range-min (rule signed-range), and uint-decode-ceiling and uint56-decode-ceiling (rule decode-ceiling).
- Linguagem predominante
- Python
- Estrelas
- 1
- Forks
- 1
- Merge médio
- 4d 6h
- PRs com merge (30d)
- 1
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de holepunchto/compact-encoding-python
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Todas as issues de holepunchto/compact-encoding-python
Issues semelhantes
-
infrastructure
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
khuisman/mcp-gee-sweet#1152 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
-
backroom bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
ditto-assistant/ditto-subnet#3069 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
open-webui/open-webui#32901 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
0.3.3 bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia