Skip to content

Fix excerpt range semantics and EOF recovery - #4975

Merged
Widthdom merged 5 commits into
mainfrom
fix-issue4877
Jul 29, 2026
Merged

Fix excerpt range semantics and EOF recovery#4975
Widthdom merged 5 commits into
mainfrom
fix-issue4877

Conversation

@Widthdom

Copy link
Copy Markdown
Owner

Summary

  • Preserve the caller's requested excerpt range separately from the context-expanded effective range, and expose the indexed total_lines contract in CLI/MCP results.
  • Add explicit --end eof and --clamp recovery modes while retaining strict behavior for numeric ranges that exceed EOF.
  • Treat zero and negative coordinates as E020_LINE_OUT_OF_RANGE, keep the numeric-only --end-line alias strict, and preserve rightmost-option semantics for repeated end aliases.
  • Document the CLI/MCP behavior in both English and Japanese and add a bilingual changelog fragment.

Root cause

Excerpt range normalization reused context-expanded values as the requested coordinates, which erased the original request. Numeric overshoot also flowed into unsafe range construction, while coordinate validation classified zero inconsistently and offered no explicit EOF/clamping contract.

Validation

  • dotnet format CodeIndex.sln --no-restore --verify-no-changes
  • dotnet run --project tools/CodeIndex.Changelog -- check (49 fragments validated)
  • dotnet build CodeIndex.sln -c Release --no-restore -p:UseSharedCompilation=false (0 warnings, 0 errors)
  • Integrated excerpt/CLI-schema/inspect/MCP/golden regressions: .NET 8: 100 passed; .NET 9: 99 passed, 1 platform-dependent test skipped
  • Focused Issue Separate requested and effective excerpt ranges and add explicit EOF/clamp modes #4877 regressions after the second review fixes: 6 passed on .NET 8 and 6 passed on .NET 9
  • Local CodeIndex status: 1,275/1,275 files matched; index and reference graph fresh and complete
  • Full-suite exploratory runs before final integration found one unrelated watcher timing failure that passed in isolation and one stale inspect expectation that was corrected; all affected and integrated targets passed afterward on both TFMs.

Adversarial review

Two Codex review rounds completed. The first round found invalid completion literals and missing empty-result MCP range metadata; the second found repeated end-alias precedence and invalid start-overshoot recovery advice. All actionable findings were fixed and covered by regressions.

Documentation / changelog

  • Updated USER_GUIDE.md and TESTING_GUIDE.md in both English and Japanese.
  • Added changelog.d/unreleased/4877.fixed.md.

Follow-up candidates

  • None.

Fixes #4877

@Widthdom
Widthdom marked this pull request as ready for review July 29, 2026 08:17
@Widthdom
Widthdom merged commit e6a81be into main Jul 29, 2026
12 checks passed
@Widthdom
Widthdom deleted the fix-issue4877 branch August 2, 2026 12:49
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.

Separate requested and effective excerpt ranges and add explicit EOF/clamp modes

1 participant