Fix excerpt range semantics and EOF recovery - #4975
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
total_linescontract in CLI/MCP results.--end eofand--clamprecovery modes while retaining strict behavior for numeric ranges that exceed EOF.E020_LINE_OUT_OF_RANGE, keep the numeric-only--end-linealias strict, and preserve rightmost-option semantics for repeated end aliases.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-changesdotnet run --project tools/CodeIndex.Changelog -- check(49 fragments validated)dotnet build CodeIndex.sln -c Release --no-restore -p:UseSharedCompilation=false(0 warnings, 0 errors)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
USER_GUIDE.mdandTESTING_GUIDE.mdin both English and Japanese.changelog.d/unreleased/4877.fixed.md.Follow-up candidates
Fixes #4877