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

filesystem: read_text_file tail returns one line too few when the file ends with a newline

Abierto
#5,187 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

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

Línea de trabajo

Start with tailFile in src/filesystem/lib.ts and the trailing newline test in src/filesystem/__tests__/server-tools.test.ts; trace how the decoded tail is split, including LF, CRLF, and the chunk boundary. Update the test to capture the expected behavior, then verify tail: 1 and tail: 2 return the final lines without counting a trailing newline as an extra line.

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

Descripción

bug server-filesystem v2
Problem

tailFile in src/filesystem/lib.ts splits the decoded tail on \n and keeps the last N segments. For a file that ends with a newline, the empty segment after the final \n counts as one of the N lines: tail: 1 on "a\nb\nc\n" returns an empty string, and tail: 2 returns only c. The test in src/filesystem/__tests__/server-tools.test.ts that counts the trailing newline as a line pins this today. head does not have the problem.

Expected

A final newline ends the last line and is not counted as an extra empty line, for LF and CRLF files and across the chunk boundary tailFile reads in. The pinning test changes with the fix.

Prior work
  • #4674 by @jstar0
  • #4643 by @teddiesloco

The PR(s) above targeted the pre-refactor code and are closed as part of the backlog triage in #4875; this issue is where the work continues, with the PR(s) as a prototype. Thank you to their authors.

Lenguaje dominante
TypeScript
Estrellas
91.6k
Forks
11.9k
Merge medio
6 h 2 min
PR fusionados (30 d)
162

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 modelcontextprotocol/servers

Todos los issues de modelcontextprotocol/servers

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.