batch: Reject claimed runs after large source gaps#178
Merged
Conversation
Batch merge validation checks surrounding mapped lines before restoring a claimed run that is absent from the target version. Repeated target text can make a distant mapped line look like a valid leading anchor. Users can otherwise restore claimed content into an unrelated method instead of receiving a version mismatch. This commit begins preventing false merge anchors by rejecting bracketed runs that follow a significant unmapped source gap. Subsequent commits will cover the structural rule and align command-level failure reporting with the rejected interval.
Merge validation rejects bracketed claimed runs when a large unmapped source region separates the run from its preceding mapped line. The structural rule lacks a focused example where repeated method content could make an unrelated target line appear to be a trustworthy anchor. This commit continues guarding against false merge anchors by exercising the leading-gap rejection directly through the batch merge interface. The final commit will align the command-level regression expectation with the full interval rejected by that rule.
The include-from command reports the line selection that cannot be restored when merge validation finds incompatible target content. The leading-gap check rejects the complete requested interval rather than the narrower claimed run previously identified by the command regression test. This commit completes the false-anchor correction by expecting the command to report the full rejected selection while preserving the target unchanged. The merge layer and include-from command now have regression coverage for claimed runs that follow large unmapped source regions.
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.
Batch merge validation checks surrounding mapped lines before restoring a
claimed run that is absent from the target version.
Repeated target text can make a distant mapped line look like a valid leading
anchor. Users can otherwise restore claimed content into an unrelated method
instead of receiving a version mismatch.
This pull request addresses that problem by rejecting bracketed runs that
follow a significant unmapped source gap. It adds focused merge-layer
coverage and aligns the include-from command regression expectation with the
full rejected interval.
The merge layer and include-from command now reject this false-anchor shape
while preserving the target unchanged.
Tests:
uv run pytest tests/batch/test_merge_validation.py tests/commands/test_include_from.py