filesystem: read_text_file tail returns one line too few when the file ends with a newline
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 91.4k
- Fork
- 11.8k
- Merge medio
- 6h 37m
- PR unite (30g)
- 147
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelcontextprotocol/servers
-
chore v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
modelcontextprotocol/servers#5261 ·
I maintainer di solito rispondono entro 1 giorno
-
docs(git): clarify unconfined default scope and repository confinement options in README and CLIAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
modelcontextprotocol/servers#5231 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
docs(git): clarify unconfined default scope and repository confinement options in README and CLIAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 74/100
modelcontextprotocol/servers#5230 ·
I maintainer di solito rispondono entro 1 giorno
-
git: README should state plainly that without --repository every reachable repository is in scopeApertadocumentation server-git v2
Difficoltà 1/5 1-3 ore Idoneità per principianti 84/100
modelcontextprotocol/servers#5225 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
chore v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
modelcontextprotocol/servers#5223 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di modelcontextprotocol/servers
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
openremote/openremote#3487 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
coollabsio/jean#867 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ehmpathy/rhachet-roles-bhuild#616 ·
I maintainer di solito rispondono entro 1 giorno
-
📘 Docs supabase/cli
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
bug(cli): theme file home-directory check uses startsWith (sibling dirs pass, Windows casing fails)Apertaarea/core kind/bug priority/p2 status/bot-triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
google-gemini/gemini-cli#29955 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno