decodeListing reports truncated listings as errors on Go 1.27

Abierto
#120 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@CJstate ya está trabajando en esto.

Desde el 4/12/2026.

  • #122 de @CJstate — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
go
Área
backend

Línea de trabajo

Read internal/files/lister.go around decodeListing at line 459 and the TestDecodeListingByteCap case in decode_internal_test.go. Reproduce the behavior with the Go versions described in the issue, then check how reaching the byte cap affects decode errors. Done when the test treats a capped listing as truncated without returning the unexpected end of JSON input error.

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

Descripción

TestDecodeListingByteCap fails on Go 1.27 and passes on the pinned toolchain (go1.26.11), so main is fine today and this will break when the toolchain moves.

--- FAIL: TestDecodeListingByteCap/entry_boundary
    decode_internal_test.go:29: got 1 entries, truncated false, err unexpected end of JSON input

decodeListing treats a cut-off body as truncated only when the error is io.EOF or io.ErrUnexpectedEOF (internal/files/lister.go:459). On Go 1.27, encoding/json's Decoder reports running out of input as *json.SyntaxError "unexpected end of JSON input", and More() returns true at that point instead of false. A small probe reading {"list":[{"Name":"a"} and then calling Token():

go1.26.11: More: false  Token: *errors.errorString EOF
go1.27.4:  More: true   Token: *json.SyntaxError unexpected end of JSON input

So a listing that hits the byte cap comes back as an error instead of a truncated listing. Since lr.N <= 0 already says the cap was hit, the fix could be to treat any decode error after the limit is reached as truncation, rather than matching on the error type.

I hit this because my machine runs with GOTOOLCHAIN=local, so the toolchain line was ignored.

Lenguaje dominante
Go
Estrellas
5
Forks
0
Merge medio
21 h 13 min
PR fusionados (30 d)
53

Preparar el entorno

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 nebari-dev/tapas

Todos los issues de nebari-dev/tapas

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.