filesystem: read_text_file tail returns one line too few when the file ends with a newline
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
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
- 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/servers
-
docs(git): clarify unconfined default scope and repository confinement options in README and CLIAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
modelcontextprotocol/servers#5231 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
docs(git): clarify unconfined default scope and repository confinement options in README and CLIAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
modelcontextprotocol/servers#5230 ·
Los mantenedores suelen responder en 1 día
-
git: README should state plainly that without --repository every reachable repository is in scopeAbiertodocumentation server-git v2
Dificultad 1/5 1-3 horas Aptitud para principiantes 84/100
modelcontextprotocol/servers#5225 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
modelcontextprotocol/servers#5217 ·
Los mantenedores suelen responder en 1 día
-
filesystem: search_files does not expand non-wildcard excludePatterns like directory_tree doesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
modelcontextprotocol/servers#5216 ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelcontextprotocol/servers
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
VictoriaMetrics/victorialogs-datasource#747 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
bug from-studio
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
esengine/DeepSeek-Reasonix#14608 ·
Los mantenedores suelen responder en 1 día
-
triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
getarcaneapp/arcane#4590 ·
Los mantenedores suelen responder en 1 día
-
支持对已取消(cancelled)任务生成报告Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Clouditera/VulnHunter#57 ·