Skip to content

fix: preserve trailing blank lines in ReadFile responses - #751

Merged
dwash96 merged 1 commit into
cecli-dev:v1.13.0from
snehaapratap:fix/746-trailing-blank-read
Nov 15, 2026
Merged

dwash96 merged 1 commit into
cecli-dev:v1.13.0from
snehaapratap:fix/746-trailing-blank-read

Conversation

@snehaapratap

Copy link
Copy Markdown

Fixes #746.

HashPos joins logical lines with newlines and no final terminator. Splitting that output with splitlines() loses the last empty logical line, so a range reaching EOF fails the response bounds check after its context was already cached. Split on the formatter's newline separator to preserve the original line count and return the requested content.

Adds 14 ReadFile cases using the real formatter: EOF and numeric ranges, with no terminator, one terminator, trailing blank lines, blank-only files, and CRLF input. Ten cases failed before the change.

Validation on Python 3.12:

  • Focused read/hash suites: 125 passed.
  • All tool tests plus hash suites: 428 passed, 4 skipped, 1 failed. The unrelated comma-separated grep glob test also fails on unchanged HEAD (confirmed separately).
  • Repository pre-commit hooks pass for both changed files (isort, Black, Flake8, codespell).
  • Source and wheel builds pass.

AI assistance: implemented and validated with OpenAI Codex.

@dwash96
dwash96 changed the base branch from main to v1.13.0 November 15, 2026 04:47
@dwash96
dwash96 merged commit 6c1e4f7 into cecli-dev:v1.13.0 Nov 15, 2026
@dwash96 dwash96 mentioned this pull request Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReadFile returns empty response and caches range on files with a trailing blank line

2 participants