Tolerate a uniform indentation shift when it is still unique (#195 Tier 1) - #210
Merged
Merged
Conversation
… Tier 1)
Once hunk arithmetic stopped losing items, this became the dominant failure.
Measured on rdpapp, two consecutive passes:
T2: the SEARCH text does not occur in the file as whole lines.
It must match exactly, including indentation.
A model that reproduces the right lines and indents them differently has
named a location correctly and formatted it wrongly. Refusing that costs a
whole item for a mistake with no ambiguity in it -- which is not the trade the
exact matcher was defending.
So an exact match is tried first, and only when it fails is a shifted match
considered. Everything with a *choice* in it is still refused:
- the stripped lines must correspond one for one;
- every line must move by the same amount, so a different shape wearing the
same words is not accepted as a shift;
- it must match in exactly one place. Two candidates is still not a location.
The replacement is shifted by the same amount, so the result keeps the file's
own indentation rather than the model's.
`test_indentation_must_match` is replaced rather than deleted: the boundary it
guarded still exists, it has just moved. Three tests now pin it -- a unique
shift is applied, an ambiguous one is refused, and a changed shape is refused
rather than silently re-indented.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Part of #195. Does not close it.
Once hunk arithmetic stopped losing items, this became the dominant failure. Measured on rdpapp across two consecutive passes:
A model that reproduces the right lines and indents them differently has named a location correctly and formatted it wrongly. Refusing that loses a whole item for a mistake with no ambiguity in it.
Still refused — everything with a choice in it
Exact match is tried first. Only on failure is a shifted match considered, and it must satisfy all three:
The replacement is shifted by the same amount, so the file keeps its own indentation rather than the model's.
test_indentation_must_matchis replaced, not deleted — the boundary still exists, it has moved. Three tests pin the new one: a unique shift applies, an ambiguous one is refused, a changed shape is refused rather than silently re-indented.28 tests.
ruff,mypyclean.🤖 Generated with Claude Code